For the intermediate tutorial series we will be leaving behind the BaseApplication framework. Now that we have a basic understanding of Ogre, we want to be able to manipulate many of the working pieces in our application. To make this simpler, we will now use a single header and cpp file. They contain a slightly simplified version of the tutorial framework. You should not organize your projects like this when you begin making your own Ogre applications. Having everything in one enormous class is terrible object-oriented programming. This is just for the purpose of the tutorials. |
Setup
Here is the base code you should start each tutorial with. It might look overwhelming, but that is just because we were hiding some things in BaseApplication before. It's all of the same methods doing the same work as the framework (minus the overlay system, we will use CEGUI). As long as you stay focused on just the new parts we add, then you should slowly start to get familiar with pretty much everything in these two files by the end of the series. Each tutorial will include a screenshot in the introduction to demonstrate the finished result.
If you're interested in building these tutorials with cmake, then you can use this CMakeLists.txt.
You will also need to make sure you have this test.layout file loaded with the resources for your project:
<?xml version="1.0" ?> <GUILayout version="4"> <Window type="DefaultWindow" name="root"> <Window type="TaharezLook/Label" name="TerrainLabel"> <Property name="Position" value="{{0, 2}, {0, 2}}" /> <Property name="Size" value="{{0.3, 0}, {0.1, 0}}" /> <Property name="Text" value="Intermediate Tutorials" /> </Window> </Window> </GUILayout>
The use of layouts with CEGUI is covered in Basic Tutorial 7.You can create a 'layouts' directory in your media folder, then add that directory to your resources.cfg file:
... [Layouts] FileSystem=../media/layouts FileSystem=/usr/local/share/cegui-0/layouts
Notes
When the tutorial shifts to a new method it will always be mentioned explicitly. For example, you will see: "Add the following to the beginning of createScene:" If a new code section is reached and nothing has been mentioned, then you can assume the code continues exactly where the last section left off. If you spot any cases where this isn't true, then please leave a comment or make the change yourself.
During these tutorials, when a block of code (i.e. something between brackets { }) is broken up over more than one code section, a ^ will be used as a reminder that the code is continuing an unfinished block. This should not be included in your project. It is soley for formatting.
An example:
if (skyIsBlue) { sunshineOnMyFace = true;
Later...
^ if (seeThunderCloud) { takeCover(); } }
These should be read as one single if statement.