OF game with several screens?

I’m a new to both openframeworks and c++ (enjoying both a lot).

I have a question and not sure where to look for an answer - if anyone could point me in the right direction.
I would like to make a game, but it should consist of several screens, like a startscreen and a game screen. Is there some best practices to set this up in OF?

Lets say I have a start screen and a game screen. I would need to load and display a splash image in the start screen that can be discarded as soon as we leave the start screen and enter the game.
In the game screen we need other images and sounds.

To me it looks like I would need separated setup() update() and draw()-methods (and some kind of exit()). Does any of this exist already if OF or should I create it from scratch myself?

Thanks a lot

1 Like

Hi Tommy,

yes, you are on your own, OF is just the good framework. You could start in the ofApp::draw() method with a simple switch

switch ( screenVariable ){
case startScreen:

case gameScreen:




1 Like

Thanks a lot for taking time to answer.
I guess I’ll just have to stop searching and start coding =D

1 Like

You can also use some sort of state machine paradigm, for example:


I agree that state machine sounds like a useful pattern here.
Thanks for the link, I will check it out!