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

Side by Side Diff: nacltoons/src/FrontEnd.cc

Issue 12226130: [nacltoons] Add initial frontend and physics game scenes. (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « nacltoons/src/FrontEnd.h ('k') | nacltoons/src/GameplayScene.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 #include "FrontEnd.h"
5 #include "GameplayScene.h"
6
7 USING_NS_CC;
8
9 CCScene* FrontEnd::scene() {
10 CCScene* scene = CCScene::create();
11 CCLayer* frontend = FrontEnd::create();
12 scene->addChild(frontend);
13 return scene;
14 }
15
16 void FrontEnd::StartGame(CCObject* sender) {
17 CCLog("StartGame pressed");
18 CCTransitionScene* transition;
19 CCDirector* director = CCDirector::sharedDirector();
20
21 // transition to a new Gameplay scene.
22 CCScene* scene = Gameplay::scene();
23 director->setDepthTest(true);
24 transition = CCTransitionPageTurn::create(1.0f, scene, false);
25 director->pushScene(transition);
26 }
27
28 bool FrontEnd::init() {
29 if (!CCLayerColor::initWithColor(ccc4(0, 0xD8, 0x8F, 0xD8)))
30 return false;
31
32 setTouchEnabled(true);
33
34 // Create and position the menu.
35 CCLabelTTF* start_label = CCLabelTTF::create("Start Game", "Arial.ttf", 24);
36
37 CCMenuItemLabel* start = CCMenuItemLabel::create(start_label,
38 this, menu_selector(FrontEnd::StartGame));
39
40 CCMenu* menu = CCMenu::create(start, NULL);
41 addChild(menu);
42
43 // Position Menu
44 CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();
45 CCPoint origin = CCDirector::sharedDirector()->getVisibleOrigin();
46 menu->alignItemsVertically();
47 float xpos = origin.x + visibleSize.width/2;
48 float ypos = origin.y + visibleSize.height/2;
49 menu->setPosition(ccp(xpos, ypos));
50 return true;
51 }
OLDNEW
« no previous file with comments | « nacltoons/src/FrontEnd.h ('k') | nacltoons/src/GameplayScene.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698