Skip to main content
gamedev.net
🔒 Locked

Newbie level loading question

Started by Jovan 2 replies 750+ views
Original Post
Jovan
Jovan
I am making a small game in opengl, and I came across a maze: How are levels actually loaded? Strictly speaking 'without' the use of a map editor, or level files, simply .cpp /.h files, how does lets say the 'Menu' screen transfer over to another screen? Do i need to erase the GL scene and start over again.. or? Any tutorials or articles would be plenty of help, i didnt find any tho :(. Thanks ahead!
mumpo
mumpo
Based on your question, I don't know if your game loop looks anything like this, but here is one way:
// iState is a globally accessable integer.// Whenever the program needs to change what you called the "level" it sets// iState to the appropriate value and then just waits for the next frame.    while(true)    {        switch(iState)        {        case 1: // main menu            {                MainMenuUpdate();                MainMenuRender();            } break;        case 2: // graphics settings menu            {                GraphicsMenuUpdate();                GraphicsMenuRender();            } break;        case 3: // in-game            {                GameUpdate();                GameRender();            } break;        }    }
Jovan
Jovan
Ah!

So, the levels are stored in the GameUpdate ?
Slug
Slug
You should make your own structure and write/load your model into then draw it

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.