Hi,
Sometimes when compiling a project I'll get the compiler results window pop
up and it mentions a function in one of my classes. - no error though, it
just lists the line
Now the wierd thing is if I keep attempting to compile eventually it'll
succeed and I'll get no messages, but then it can reverse to failing just as
easily (with no editing done in between).
this is the message
c:\programming\source code\c++\sdl coding\shootemup\object_class.cpp: In
method `void Object::draw()':
Any help/advice greatly appreciated
Thanks very much,
Rich.
file object_class.h
#ifndef GUARD_object_class
#define GUARD_object_class
#include "SDL\SDL.h"
class Object{
public:
double obj_xpos; // screen x pos
double obj_ypos; // screen y pos
double obj_xoff; // gfx source x offset
double obj_yoff; // gfx source y offset
double obj_xsiz; // gfx x size
double obj_ysiz; // gfx y size
SDL_Surface* obj_SDL; // contain graphics loc etc
Object(){};
Object(SDL_Surface*, const double&, const double&);
virtual ~Object();
void draw();
};
#endif
-------------------------------
file object_class.cpp
#include "object_class.h"
#include "global_vars.h"
#include "SDL\SDL.h"
Object::Object(SDL_Surface* image,
const double& xpos,
const double& ypos){ // data, xpos, ypos
obj_xpos = xpos; // screen x pos
obj_ypos = ypos; // screen y pos
obj_xoff = 0; // source gfx x offset
obj_yoff = 0; // source gfx y offset
obj_xsiz = image->w; // copy the image x size
obj_ysiz = image->h; // and image y size
obj_SDL = image; // and copy the SDL_Surface structure
pointer
}
Object::~Object(){
}
void Object::draw(){ // << this is the function it mentions
srce.x = obj_xoff;
srce.y = obj_yoff;
srce.w = obj_xsiz;
srce.h = obj_ysiz;
dest.x = obj_xpos;
dest.y = obj_ypos;
source_gfx = obj_SDL;
SDL_BlitSurface(source_gfx, &srce, screen, &dest);
}
|