|
WindowMainLoop
Shows how Gosu's main loop works.
Gosu's Window Main LoopUsually, you create a subclass of Gosu::Window and override the parts that you need. Then, you create an instance of this class and call show on it. What happens then is this:
Examples of what you can do in these events are shown in the RubyTutorial and CppTutorial pages. There are some variations to this loop: of course, you can allocate Images and other resources whenever you want. It might also be useful to call show twice. And the close function may not be called, technically, if the user closes the window using the standard methods on his operating system. One recent bit of magic is the method bool needsRedraw() const or needs_redraw?, respectively, that you can override on Gosu::Window. It allows advanced games to implement frame skipping when the computer cannot catch up, or may save resources on puzzle games that only need to be redrawn when something has happened. Most games should be fine without overriding this method, though. |
Sign in to add a comment
