Eitherway it all boiled down to my problem laying with the fact that I had my For Loop outside of a function of my main loop (oops!). Now I can get it to compile but it wont do anything now! When I run the eboot the screen is blank.
Anyone care to look at my code and lemme know where I messed up?
Object Constructors
Code: Select all
/////////// INITIALIZE THE OBJECT STRUCTURES ///////////
class Object
{
protected:
int x, y;
int graphicwidth;
int graphicheight;
int height, width;
int solid;
SDL_Surface *graphic;
public:
Object(int tempx, int tempy, SDL_Surface *tempgraphic)
{;};
Object(){;};
~Object();
void step();
void draw();
void setGraphicHeight(int tempHeigt);
void setGraphicWidth(int tempWidth);
int getGraphicHeight();
int getGraphicWidth();
void setSolid(int tempSolid);
void setX(int tempX);
void setY(int tempY);
int getX();
int getY();
int direction;
void setGraphic(SDL_Surface *graphic);
};
/////////// SETUP THE OBJECTS CONSTRUCTOR ///////////
Object::Object(int tempx, int tempy, SDL_Surface *tempgraphic)
{
x = tempx;
y = tempy;
graphic = tempgraphic;
graphicwidth = graphic->w;
graphicheight = graphic->h;
solid = 0;
}
/////////// SETUP THE OBJECTS DESTRUCTOR ///////////
Object::~Object()
{
if (graphic)
{SDL_FreeSurface(graphic);}
}
Code: Select all
/////////// CREATE THE BLOCK OBJECT, CHILD OF OBJECT ///////////
class PlayerBlocks : public Object{
private:
int color;
public:
PlayerBlocks(int tempx,int tempy, SDL_Surface *graphic) : Object(tempx, tempy, graphic) {;}
void setColor(int tempcolor);
int selected;
void input();
};
/////////// CREATE THE MASTERCONTROL OBJECT, CHILD OF OBJECT ///////////
class MasterControl : public Object {
public:
MasterControl(int tempx,int tempy, SDL_Surface *graphic) : Object(tempx, tempy, graphic) {;}
void input();
};
Code: Select all
/////////// CREATE THE OBJECTS ///////////
std::vector<PlayerBlocks> VerticalBlue;
MasterControl Master(0,0,NULL);
Object Background(0,0,gfx_background);
Object Titleimage(0,0,gfx_titleimage);
Object Bottomimage(0,233,gfx_bottomimage);
Object TopWall(16,120,gfx_topwall);
Object BottomWall((SCR_H)-16, 120, gfx_bottomwall);
Object LeftWall(120,10, gfx_leftwall);
Object RightWallTop(363, 16, gfx_rightwalltop);
Object RightWallBottom(363,(SCR_H)-(13+RightWallBottom.getGraphicHeight()), gfx_rightwallbottom);
Code: Select all
for(int i = 0;i < NumberOfBlocks;i++)
{
VerticalBlue.push_back(PlayerBlocks(0,0,NULL));
}
/////////// SET UP THE OBJECTS ///////////
VerticalBlue[1].setGraphic(gfx_bluevertical);
VerticalBlue[1].setX((SCR_W/2)-(VerticalBlue[1].getGraphicWidth()/2));
VerticalBlue[1].setY((SCR_H/2)-(VerticalBlue[1].getGraphicHeight()/2));
VerticalBlue[1].setColor(2);
VerticalBlue[1].selected = 1;
VerticalBlue[1].direction = 1;