Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Unified Diff: nacltoons/src/frontend.cc

Issue 12220140: [nacltoons] Cleanup initial game code. (Closed) Base URL: https://nativeclient-sdk.googlecode.com/svn/trunk/src
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: nacltoons/src/frontend.cc
diff --git a/nacltoons/src/frontend.cc b/nacltoons/src/frontend.cc
index 27d688909a271c3b30de0c349d14704f955cac3f..4df4cc91d82a6b5038bd5ae4ab07a338ac34c642 100644
--- a/nacltoons/src/frontend.cc
+++ b/nacltoons/src/frontend.cc
@@ -6,26 +6,29 @@
USING_NS_CC;
-CCScene* FrontEnd::scene() {
- CCScene* scene = CCScene::create();
- CCLayer* frontend = FrontEnd::create();
- scene->addChild(frontend);
- return scene;
+bool FrontEndScene::init() {
+ if (!CCScene::init())
+ return false;
+
+ // Create new (autorelease) layer and add it as child.
+ CCLayer* frontend = FrontEndLayer::create();
+ addChild(frontend);
+ return true;
}
-void FrontEnd::StartGame(CCObject* sender) {
+void FrontEndLayer::StartGame(CCObject* sender) {
CCLog("StartGame pressed");
CCTransitionScene* transition;
CCDirector* director = CCDirector::sharedDirector();
- // transition to a new Gameplay scene.
- CCScene* scene = Gameplay::scene();
+ // transition to a new (autorelease) GameplayScene.
+ CCScene* scene = GameplayScene::create();
director->setDepthTest(true);
transition = CCTransitionPageTurn::create(1.0f, scene, false);
director->pushScene(transition);
}
-bool FrontEnd::init() {
+bool FrontEndLayer::init() {
if (!CCLayerColor::initWithColor(ccc4(0, 0xD8, 0x8F, 0xD8)))
return false;
@@ -35,7 +38,7 @@ bool FrontEnd::init() {
CCLabelTTF* start_label = CCLabelTTF::create("Start Game", "Arial.ttf", 24);
CCMenuItemLabel* start = CCMenuItemLabel::create(start_label,
- this, menu_selector(FrontEnd::StartGame));
+ this, menu_selector(FrontEndLayer::StartGame));
CCMenu* menu = CCMenu::create(start, NULL);
addChild(menu);

Powered by Google App Engine
This is Rietveld 408576698