Jump to content
  • Advertisement
Sign in to follow this  
iedoc

new screens

This topic is 5005 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

this might sound stupid, but i don't know how to do a screen change or whatever. if your going to enter a building or something, how are you supposed to clear the screen and start drawing again?

Share this post


Link to post
Share on other sites
Advertisement
im using opengl right now. and what i mean is, what if your walking around, see a house in the game and open the door and enter. then the screen goes black, and then the new place your in, which is the house or whatever comes up. another example would be going into your statistics screen. how do you have that come up, and when your done, go away and end up back where you were when you entered the stats screen?

Share this post


Link to post
Share on other sites
Well, depends on the effect. If you just want to enter the building with no loading, you have to set up your engine to dynamically load objects on the fly and create good occlusion methods.

If you want to allow loading, simply blast an image to the screen that says loading, destroy the current world, and create the new world. When the world is done, remove the image from the screen and start rendering other objects.

The stats screen is a little different. You wont want to destroy the previous world. However, you just dont render the other objects. Infact, you probably will "pause" all logic in the screen, so you dont get shot up or anything by enemies, etc.

Share this post


Link to post
Share on other sites
I would use a class which represents the users current location. You could maybe have a method of the class that can draw the area by passing a vertex array to the drawing function. I'm just starting with OpenGL so be mindful to get a second opinion, but as I understand it, you should be able to draw by passing the vertices to the draw method in order to draw different areas.

Share this post


Link to post
Share on other sites
thats exactly what i want to do, the second one, but i don't know how to delete or blast the current world.

Share this post


Link to post
Share on other sites
what if i had the stats screen always there, just out of site, and when i want to use it, just bring it into site. do you think that would work, or would it make the program too slow?

Share this post


Link to post
Share on other sites
Well, how do you create your world? If you know how to create it, you should know how to destroy it. And then just create a new world.

Also, the stats screen should not be up all the time. You should only render it when you want it to be shown, and that way you can also change your user input to correspond to the GUI of the stats screen.

Share this post


Link to post
Share on other sites
Somewhere along the line, you're going to have to have some kind of object processor or manager that is responsible for this kind of thing. When you transition, you'll have to flush the list of object's it's working with and reload new ones (for the new area). The tricky part is that there are also objects that you do NOT want deleted like characters and GUI elements etc.

So organizationally, you'll need to have that processor object firmly coded. It may also be responsible for world creation and destruction.

Share this post


Link to post
Share on other sites
I have done this exact thing you're trying to do (only I used SDL), but I think the idea is pretty much the same. The only thing is I used global variables (gasp) which I guess is somehow terrible.
My main area is embedded in a function called Street(x,y).

I check collision with the door, and if I get a hit, I call a function for that door, like House(). Inside House(), which is it's own .cpp file linked through a header, the screen is painted just like it was when street was created. (either by pixels or by loading a .bmp). When you leave the house, it makes a call to Street() and passes it the x,y coordinates so the player shows up right outside of the door.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!