Game Development Reference
In-Depth Information
What just happened?
We created the implementation for our HelloWorld class. Here are the most important
bits to take notice of:
• The HelloWorld:: scope resolution is not optional here. Every single method
declared in your interface belongs to the new class that needs the correct scope res-
olution in the implementation file.
• You also need the scope resolution when calling the super class like Lay-
er::init() . There is no built-in super keyword in the standard C++ library.
• You use this instead of self . The -> notation is used when you're trying to ac-
cess an object's properties or methods through a pointer to the object (a pointer is
the information of where you find the actual object in memory). The . (dot) nota-
tion is used to access an object's methods and properties through its actual instance
(the blob of memory that comprises the actual object).
• We create an update loop, which takes a float for its delta time value simply by
calling scheduleUpdate . You will see more options related to this later in this
topic.
• You can use the auto keyword as the type of an object if it's obvious enough to
the compiler which type an object is.
• The inline methods, of course, are not implemented in the class since they exist
only in the interface.
And that's enough of syntax for now. C++ is one of the most extensive languages out there
and I do not wish to leave you with the impression that I have covered all of it. But it is a
language made by developers for developers. Trust me, you will feel right at home working
with it.
The information listed previously will become clearer once we move on to building the
games. But now, onwards to the big scary monster: memory management.
Search WWH ::




Custom Search