Skip to content
raphaelceccato edited this page Feb 14, 2024 · 3 revisions

Engine

The Engine object is the main object that does all the initializing and deinitializing stuff. There may be only one instance of it at once. You should create a Engine object in your game startup code and remember to delete it at the end (tip: avoid using new/delete with Engine, so it can be destroyed automatically at the end of your game).

createWindow(const char* title, int width, int height, bool resizable)

Creates a game window.

Parameters:
title: the title of the window
width and height: the size of the window
resizable: determines if the window can be resized and maximized

Returns: a Window pointer. This object is handled automatically by the library, so you should not call delete on it

getTicks()

Returns: the number of ticks since the start of the game

playSound(Sound* sound, int channel)

Plays a sound in the specified sound channel.

Parameters:
sound: a pointer to a Sound object
channel: the number of the channel to play the sound. The allowed range is from 0 to NUM_SOUND_CHANNELS - 1

getSoundChannel(int channel)

Parameters:
channel: index of the channel (the allowed range is from 0 to NUM_SOUND_CHANNELS - 1)

Returns: the pointer to a SoundChannel object