O'Reilly logo

Cocos2d-x Game Development Essentials by Gareth Jones, Arutosh Gurung, Frahaan Hussain

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Housekeeping

A new project has been generated, but the default files are called HelloWorldScene; these files will be refactored to represent a real game. This chapter will cover refactoring the default files that are generated.

Refactoring HelloWorldScene.h

The following steps will guide you on how to refactor HelloWorldScene.h:

  1. Rename HelloWorldScene.h to MainMenuScene.h:
    Refactoring HelloWorldScene.h
  2. Open MainMenuScene.h.
  3. Rename the # commands at the top of the document, as follows:
    • From #ifndef __HELLOWORLD_SCENE_H__ to #ifndef __MAINMENU_SCENE_H__
    • From #define __HELLOWORLD_SCENE_H__ to #define __MAINMENU_SCENE_H__

    You will see the following screen:

  4. Rename the HelloWorld class to ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required