Skip to content

ToyRendererApp

Shahriar Shahrabi edited this page May 11, 2020 · 2 revisions

ToyRendererApp

The ToyRender Application is the container which holds your game. The engine receives an instance of this class, created by your game code and runs the active scene on it. Once the game is lunched, the EntryPoint function is called, which creates an instance of the ToyRendererApp, and the Run function of this class is called. The actual game loop is within this run function.

The most important member of this class is the active scene. The active scene is a Scene which holds your game world. In the game loop, for each GameObject in your active scene, its Update, Render etc functions are called, which derives the real time logic of your game. For more information have a look at the Engine Loop .

This is fairly automated, so as far as the game side is concerned, it just needs to provide the engine with an instance of this class, and a Scene as its active scene.

A simple example of such instance would be:

class Sandbox : public ToyRenderer::ToyRendererApp {
public: 
	Sandbox() {
			CLIENT_LOG_INFO("sand box has been initialized");
     	    activeScene = new Scene();
	}
	~Sandbox() {
	}
};

For a more complicated Scene, have a look at the Starter Scene.

Clone this wiki locally