- [Instructor] Hi, this is the last video
of this section, Coding the Main Function.
In the previous video we looked at
building the game engine.
In this video, we will code the main function
to see the background of the game.
Let's start with renaming the HelloSFML.cpp file
as main.cpp.
First, right click on the HelloSFML file
in the solution explorer and select rename,
and change the name to main.cpp.
This will be the file that contains our main function
and the code that instantiates the engine class.
Add this highlighted code to main.cpp.
First, we add an include directive
for the engine class, then,
inside the main function, declare an instance
of engine, then call its run function.
Everything will be handled by the engine class
until the player quits and the execution returns
to main and the return zero statement.
That was easy.
Now we can run the game
by clicking on local windows debugger button
and see the empty background either full screen
or split screen, which will eventually contain
all the action.
Here's the game so far in full screen mode
showing just the background.
Now, tap the E key and you'll be able to see
the screen neatly partitioned into two halves
ready for split screen co-op gameplay.
Take a look at the neatly partitioned two halves.
Awesome.
Cool, that marks the end of this section.
In this section we started off
with an introduction to the final project,
Thomas was late.
We then moved on to structuring
the Thomas was late code.
In the later videos, we learned building
the game engine and coding the main function.
That's amazing.
In the next section, we'll be learning
about advanced OOP, inheritance, and polymorphism.