I am writing code that displays a background with the gui menu overlay. But, once the code runs it displays properly but the cursor shows the program is waiting on something while it is in the draw loop. (the spinning circle.) I have gone through the examples to change my code and nothing seems to help.
Is there a concept about the engine that I am missing?
2D and 3 D mix
Re: 2D and 3 D mix
Doesn't tell me anything so far. Do you have some code to reproduce this? And on which platform is this happening? My guess so far would be that you coded some endless loop. (for example the main-loop without ever calling device-run)
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: 2D and 3 D mix
Took me awhile I I scaled it down to try it. This is the code I se to draw a 2d Image.
This is the code I created to cycle to have a menu overlay. I am trying to just create the background with the gui overlay and have the mouse pointer move and select.
If I comment out the loop it works. I suspect I do not nderstand dho to do what I need.
The game->Draw method right now only calls device->run()
Code: Select all
// Display the splash screen while initializing the game
driver->beginScene(true, true, irr::video::SColor(150, 150, 150, 150));
driver->draw2DImage(back, irr::core::rect<irr::s32>(0,0,MAXX,MAXY), irr::core::rect<irr::s32>(0,0,MAX_X_RES,MAX_Y_RES));
smgr->drawAll();
driver->endScene();
Code: Select all
while ((FederationCommand::gameState = game->MainMenu()) != FederationCommand::GameState_t::ExitGame) {
if (FederationCommand::gameState == FederationCommand::GameState_t::StartGame) {
game->GamePrep(); // do a few things to pepare the main game code for running.
// this is the game loop
while (IsRunning) {
game->Update(); // run the game update
game->Draw(); // draw the graphics
}
}
if (FederationCommand::gameState == FederationCommand::GameState_t::SaveLoad) game->SaveLoadGame();
} The game->Draw method right now only calls device->run()
Re: 2D and 3 D mix
Sorry, but that is no code I can compile here and test. That's just function calls for your game-class about which no-one else besides you knows anything. It's not possible to understand what's going on from this.
But in case you don't want to reduce your code now for the forum - just debug it. The moment you see your wait-cursors do stop your application (debug - break-all in VS) and check where it hangs.
But in case you don't want to reduce your code now for the forum - just debug it. The moment you see your wait-cursors do stop your application (debug - break-all in VS) and check where it hangs.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: 2D and 3 D mix
The issue was in concept. I was trying to put up a 2 d screen and do other activity then have the program make shanges.
I realize everything needs to be in the game loop. So the 2 menu selection is in the game loop, then when I wish to close it and start the 3D portion I need to change this in the update portion before the scene is drawn again.
So to maximize performance I should create all teh game states ahead of time so all I have to do is call the appropriate scene manager and gui from within the game loop.
Does this sound about right?
I realize everything needs to be in the game loop. So the 2 menu selection is in the game loop, then when I wish to close it and start the 3D portion I need to change this in the update portion before the scene is drawn again.
So to maximize performance I should create all teh game states ahead of time so all I have to do is call the appropriate scene manager and gui from within the game loop.
Does this sound about right?
Re: 2D and 3 D mix
Sounds ok. I usually create all dialogs at the start and then just make them visible/invisible for switching between them. Altought creating a menu is often so fast that you can also do it in your loop.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm