new screens

Started by
11 comments, last by Radagar 19 years, 1 month ago
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?
Advertisement
What graphics API are you using? Can you also explain more what you mean?
-----------------------------Play Stompy's Revenge! Now!
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?
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.
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.

-----------------------------Play Stompy's Revenge! Now!
thats exactly what i want to do, the second one, but i don't know how to delete or blast the current world.
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?
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.
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.
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.

This topic is closed to new replies.

Advertisement