Code: Select all
class GameState
{
virtual void OnEnter();
virtual void OnLeave();
[...]
};
class GSIntro : public GameState
{
};
class GSPlay : public GameState
{
};
Code: Select all
/**************************************************************************************************
* Name :
*
* Desc :
*
* Param :
*************************************************************************************************/
void GSIntro::OnEnter(irr::IrrlichtDevice *device, GameStateManager *gsMgr)
{
this->deviceValue = device;
this->gameStateManager = gsMgr;
// Texturen für die Buttons laden
this->newGameValue = this->deviceValue->getVideoDriver()->getTexture("images\\newGame.png");
this->quitGameValue = this->deviceValue->getVideoDriver()->getTexture("images\\quit.png");
this->deviceValue->getVideoDriver()->makeColorKeyTexture(this->newGameValue,
irr::core::position2d<irr::s32>(0, 0));
this->deviceValue->getVideoDriver()->makeColorKeyTexture(this->quitGameValue,
irr::core::position2d<irr::s32>(0, 0));
// gui erzeugen
this->buttonNewGame = this->deviceValue->getGUIEnvironment()->addButton(irr::core::rect<irr::s32>(50,250,150,250 + 32),
0,
buttonID::NEWGAME,
L"",
L"Launches a new Window");
this->buttonNewGame->setUseAlphaChannel(true);
this->buttonQuitGame = this->deviceValue->getGUIEnvironment()->addButton(irr::core::rect<irr::s32>(50,300,150,300 + 32),
0,
buttonID::QUIT,
L"",
L"Quit Game");
this->buttonQuitGame->setUseAlphaChannel(true);
// den Buttons Texturen zuweisen
this->buttonNewGame->setImage(this->newGameValue,
irr::core::rect<irr::s32>(0, 0, 100, 32));
this->buttonQuitGame->setImage(this->quitGameValue,
irr::core::rect<irr::s32>(0, 0, 100, 32));
this->backgroundValue = this->deviceValue->getVideoDriver()->getTexture("images\\backgroundGSIntro.jpg");
}
After GSIntro->OnEnter all objects(texture, button,...) are loaded correctly.
Everytime my state changes new objects are created.
So any adivice for me?
EDIT:
Here are two pictures of my problem.
http://88.198.14.185/~odenterdata/1.jpg
http://88.198.14.185/~odenterdata/2.jpg