forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Hmm...more C++ errors

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
psiko_scweek



Joined: 12 Nov 2005
Posts: 42

PostPosted: Sat Sep 30, 2006 8:25 am    Post subject: Hmm...more C++ errors Reply with quote

Arlight not too sure if you remember me, I was having a bunch of problems using std::vector.

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:
/////////// 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);}
}


SubObjects
Code:
/////////// 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();
};


creating the objects
Code:
/////////// 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:
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;


thanks all
Back to top
View user's profile Send private message Yahoo Messenger
Wally



Joined: 26 Sep 2005
Posts: 672

PostPosted: Sat Sep 30, 2006 7:26 pm    Post subject: Reply with quote

Code:
{
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)
{;}; <-- never seen anything like this, what is it for??
Back to top
View user's profile Send private message AIM Address
Aion



Joined: 24 Jul 2006
Posts: 40
Location: Montreal

PostPosted: Sat Sep 30, 2006 11:51 pm    Post subject: Reply with quote

Looks weird, but only declare an empty method for the constructor. Just {} would have done the job.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group