Skip to content
Sadman Kazi edited this page Jul 23, 2015 · 6 revisions

The Core Engine class serves as the main abstraction layer for the main program. All the other modules run from within this class. This is also the class that contains the main game loop. All the other engine objects are ran from within this class's methods.

####Constructor and Destructor: The constructor takes in the title, the width and the height of the main window (in that order). That's it. It uses that information to initialize a new Window and stores its address in m_mainWindow. It also constructs a new Game and stores that in m_game. m_isRunning is also initialized as true.

The destructor deletes and cleans up member pointers.

####Member Variables:

Name Type Visibility Description
m_mainWindow Window* private Main Window that is displayed on the screen
m_title const std::string private Title of the main window
m_width int private Width of the main window
m_height int private Height of the main window
m_isRunning bool private Stores whether the engine is running or not, used for knowing when the end the game loop
m_game Game* private Object for handling all game logic, input, game rendering, etc.

####Member Functions:

Name Return Type Visibility Parameters Description
Start() void public none Starts the main engine and game loop by resetting the timer and invoke Run()
Stop() void public none Stops the main engine by setting m_isRunning to false, eventually stopping the game loop in Run()
Run() void private none Contains the main game loop, it makes calls to all the required m_game functions, and renders the frames by using a timer
Render() void private none Called from Run(), it clears the screen and renders m_mainWindow and m_game

This project follows architectural decisions very similar to TheBennyBox's 3d Game Engine Tutorial. A lot of the things that I have learned for this project was from reading Learning Modern 3D Graphics Programming by Jason McKesson.

Clone this wiki locally