Jump to content

Switching between screens in Win32 app

- - - - -

  • Please log in to reply
No replies to this topic

#1
TheSourceOfX

TheSourceOfX

    Learning Programmer

  • Members
  • PipPipPip
  • 45 posts
I have been learning to program OpenGL Win32 apps for a little while now and I ran into a problem. I want to make a game, and games usually require there to be multiple different screens (i.e. menu, game board, settings) and I can't think of a clean and, most importantly, fast way to switch between them. Originally I thought of making a different drawing function for each screen. When the program draws to the screen, which it currently does at a frame rate of 60 FPS, it would call the drawing function whose address is stored in some pointer. When I want to change to a different screen, like the menu, I would change that pointer to point to the menu's drawing function. This seemed good because that way each drawing function was specific to the screen it drew, but the problem came in that calling a function via a pointer is very slow, and doing it at 60 FPS took a long time. Does anyone know of a better way to switch between screens in a program? I imagine that there must be a fast way to do it since so many programs out there rely on multiple screens.

-TheSourceOfX




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users