Game Development Reference
In-Depth Information
The HelloWorldScene class
When you run the application, you get a screen with the words
Hello World
and a
bunch of numbers in one corner; those are the display statistics you decided you wanted
around in the
AppDelegate
class.
The actual screen is created by the oddly named
HelloWorldScene
class. It is a
Layer
class that creates its own scene (don't worry if you don't know what a
Layer
or a
Scene
class is; you will know soon).
When it initializes,
HelloWorldScene
puts a button on the screen that you can press to
exit the application. The button is actually a
Menu
item part of a
Menu
object that only has
one button, with two image states for the button, and one call back event when the said but-
ton is pressed.
The
Menu
object automatically handles touch events targeting its members, so you don't
get to see any of that code floating about. Then, there is also the necessary
Label
object to
show the
Hello World
message and the background image.