class GameChat {
unsigned int ChatX;
unsigned int ChatXSize;
unsigned int ChatOutY;
unsigned int ChatInY;
unsigned int ChatOutYSize;
Textarea* GameTextOut[5];
Textbox* GameTextIn[5];
public:
GameChat ( );
void Update ( );
};
GameChat::GameChat ( )
{
unsigned int ScreenH = dbScreenHeight ( );
unsigned int ScreenW = dbScreenWidth ( );
this->ChatXSize = 12;//(ScreenW-(ScreenW/4))/9;
this->ChatOutYSize = 12;//(ScreenH/3)/13;
this->ChatX = 200;//(ScreenW/2) - (this->ChatXSize/2);
this->ChatOutY = 400;//ScreenH - this->ChatOutYSize - 32;
this->ChatInY = 560;//ScreenH - 32;
Textarea GameChatTextOut ( this->ChatX, this->ChatOutY, this->ChatXSize, this->ChatOutYSize );
Textbox GameChatTextIn ( this->ChatX, this->ChatInY, this->ChatXSize );
memset(this->GameTextOut,NULL,sizeof(this->GameTextOut));
memset(this->GameTextIn,NULL,sizeof(this->GameTextIn));
this->GameTextOut[0] = &GameChatTextOut;
this->GameTextIn[0] = &GameChatTextIn;
}
void GameChat::Update ( )
{
if ( this->GameTextOut[0] != NULL )
{
this->GameTextOut[0]->update ( );
}
if ( this->GameTextIn[0] != NULL )
{
this->GameTextIn[0]->update ( );
}
}
As soon as the first GameChat::Update ( ) is called the program crashes with a memory read error, this does not happen if I comment out
//this->GameTextOut[0]->update ( ); from the Update function.
I'm not sure if i'm even using the pointers properly..I was planning on releasing this class on the forum though once it was complete as an addon to DarkForm, if someone was to help that would be awesome cause I can't figure this out for the life of me..
Add me to your MSN!