3 Engine
acetheking987 edited this page 2024-09-06 13:49:03 +00:00

Engine

The engine initializes SDL2, TFF and handles basic functions

Functions

Constructor

This initializes SDL2 and creates a window. engine = new Engine("Game", 800, 600);

startFrame

This sets the frameStart variable to the output of SDL_GetTicks() to be able to adjust framerate.

render

This updates the screen with any changes by running SDL_RenderPresent(renderer);. It also automatically delays to reach the desired framerate if necessary.

clear

This clears the screen with a provided color engine->clear({ 100, 150, 255, 255 });, this color is a SDL_Colour type.

Update

This runs all the input updates using the Input class.

Deconstructor

This destroys the renderer and window, It also runs SDL_Quit() and TFF_Quit().