Documentation
Everything you need to create a game with FRAG
Documentation is still very much a work in progress. Please understand there may be rapid changes to this section of the website.
FRAG’s game loop is pretty standard and can be broken down into several sections. The initialization phase of the game loop begins when the startFrag procedure is called. During this phase of the game loop, the framework itself along with all of its subsystems will be initialized. The initApp procedure of the app object provided to the startFrag procedure, will also be invoked - allowing the FRAG application to execute whatever initialization logic it needs to. Once the framework, subsystems, and application have all finished carrying out their initialization logic, the game loop actually begins. During every iteration of the game loop, the updateApp procedure will be called. This provides the application with a hook where it can implement whatever update logic it needs to.
Along with the updateApp procedure, the renderApp procedure will be called each frame. Similar to how application state updates should be performed during the updateApp invocation, any drawing that is to be done should be performed during this call.
The final phase of the game loop is the shutdown phase. This phase is entered when the framework calls the shutdownApp procedure. For this phase to be entered, the conditional check which was enforcing the actual loop of the game loop, must fail. This is generally caused by the end-user of the application closing it, or the application unexpectedly terminating. During the invocation of the shutdownApp procedure, resources which are not automatically released by the framework, or garbage-collected, should be freed.
The Implementation
How FRAG does it
Initialization
Let’s get things started…
Update
Your game logic goes here!
Render
Ready. Set. Draw.
Shutdown
Don’t forget to clean up after yourself!