void SceneSplashScreen::showPlayer1(const char *playerType, const float time) { if( showingPlayer1 == false ) { showingPlayer1 = true; CCTimer *timer = new CCTimer(); { CCTile3DButton *tile = tilePlayer1; LoadPlayerType( tile, playerType ); tile->positionTileAbove( tileWhiteStripe ); tile->setPositionX( -camera->targetWidth * 0.75f ); } { LAMBDA_1( EventCallback, SceneSplashScreen, scene, { CCCameraAppUI *camera = scene->camera; { CCTile3DButton *tile = scene->tilePlayer1; tile->setTileMovementX( -camera->targetWidth * 0.5f + tile->collisionBounds.x ); } { CCTile3DButton *tile = scene->tileCountry1; tile->setTileMovementX( camera->targetWidth * 0.5f - tile->collisionBounds.x ); } }) timer->onTime.add( new EventCallback( this ) ); }
// Called after our constructor is called void SceneSample::setup() { // Set our virtual camera width to be 320 // This means that the width of the view will be 320 camera->setCameraWidth( 320.0f ); { CCTile3DButton *tile = new CCTile3DButton( this, // Pass in this scene 100.0f, // Specify the width of the tile "Resources/f7u12_derp.png" ); // Texture to load // On tile pressed and released LAMBDA_1( MyCallback, CCTile3DButton, tile, tile->setBaseTexture( "Resources/f7u12_rage.png", Resource_Packaged ); ) tile->onRelease.add( new MyCallback( tile ) ); // Add the tile to our list of touchable tiles, to allow for user interaction addTile( tile ); }
// Called after our constructor is called void SceneSample::setup() { // Set our virtual camera width to be 320 // This means that the width of the view will be 320 camera->setCameraWidth( 320.0f ); { CCTile3DButton *tile = new CCTile3DButton( this, // Pass in this scene 100.0f, // Specify the width of the tile "Resources/f7u12_derp.png" ); // Texture to load } { CCTile3DButton *tile = new CCTile3DButton( this, // Pass in this scene 100.0f, // Specify the width of the tile "Resources/f7u12_troll.png" ); // Texture to load tile->translate( 0.0f, tile->collisionBoundsLength.y, 0.0f ); } // refresh the scene range refreshCameraView(); }
// Called after our constructor is called void SceneSample1::setup() { // Set our virtual camera width to be 320 // This means that the width of the view will be 320 camera->setCameraWidth( 320.0f ); // Background { CCTile3DButton *tile = new CCTile3DButton( this ); // Pass in this scene tile->setupTextured( 640.0f, // Specify the width of the tile "Resources/background.png" ); // Texture to load // Add the tile to our list of touchable tiles, to allow for user interaction addTile( tile ); } // Create a tile CCTile3DButton *tileHelloWorld = NULL; { CCTile3DButton *tile = new CCTile3DButton( this ); tile->setupText( "Hello World", // Tell it to say 'Hello World' 64.0f, // Specify the height of the text true ); // Request the text to be centered // Set the colour of the text model to be black tile->setTextColour( CCColour( 1.0f ), true ); addTile( tile ); tileHelloWorld = tile; } // Create a tile with an image { CCTile3DButton *tile = new CCTile3DButton( this ); tile->setupTextured( 128.0f, "Resources/f7u12_derp.png" ); addTile( tile ); // Position it underneath our hello world tile tile->positionTileBelow( tileHelloWorld ); } // refresh the scene range refreshCameraView(); }
void SceneSplashScreen::setup() { CCText texPath = "Resources/"; texPath += CLIENT_NAME; texPath += "/uimenu/ui_background.png"; const float backgroundWidth = gEngine->textureManager->getTexture( texPath.buffer )->getRawWidth(); camera->setCameraWidth( backgroundWidth, false ); { CCTile3DButton *tile = new CCTile3DButton( this ); tile->setupTextured( "Resources/common/uimenu/ui_vs_whitestripe.png", Resource_Packaged, true ); tile->setTileScale( 1.0f ); tileWhiteStripe = tile; tile->shouldRender = false; } { { CCTile3DButton *tile = new CCTile3DButton( this ); tile->setupTextured( "Resources/common/uimenu/ui_vs_bluestripe.png", Resource_Packaged, true ); tile->setTileScale( 1.0f ); tile->positionTileAbove( tileWhiteStripe ); tile->drawOrder = 201; tileBlueStripe = tile; tile->translate( camera->targetWidth, 0.0f, 0.0f ); { CCTile3DButton *tile = new CCTile3DButton( this ); tile->setupTextured( "Resources/common/uimenu/ui_vs_whitestripe.png", Resource_Packaged, true ); tile->setTileScale( 1.0f ); tile->drawOrder = 202; tile->translate( 0.0f, ( tileBlueStripe->collisionBounds.y + tile->collisionBounds.y ), 0.0f ); tile->removeFromScene(); tileBlueStripe->addChild( tile ); } { CCTile3DButton *tile = new CCTile3DButton( this ); tile->setupTextured( "Resources/common/uimenu/ui_vs_whitestripe.png", Resource_Packaged, true ); tile->setTileScale( 1.0f ); tile->drawOrder = 203; tile->translate( 0.0f, -( tileBlueStripe->collisionBounds.y + tile->collisionBounds.y ), 0.0f ); tile->removeFromScene(); tileBlueStripe->addChild( tile ); } } } { { CCTile3DButton *tile = new CCTile3DButton( this ); tile->setupTextured( "Resources/common/uimenu/ui_vs_redstripe.png", Resource_Packaged, true ); tile->setTileScale( 1.0f ); tile->positionTileBelow( tileWhiteStripe ); tile->drawOrder = 201; tileRedStripe = tile; tile->translate( -camera->targetWidth, 0.0f, 0.0f ); { CCTile3DButton *tile = new CCTile3DButton( this ); tile->setupTextured( "Resources/common/uimenu/ui_vs_whitestripe.png", Resource_Packaged, true ); tile->setTileScale( 1.0f ); tile->drawOrder = 203; tile->translate( 0.0f, ( tileRedStripe->collisionBounds.y + tile->collisionBounds.y ), 0.0f ); tile->removeFromScene(); tileRedStripe->addChild( tile ); } { CCTile3DButton *tile = new CCTile3DButton( this ); tile->setupTextured( "Resources/common/uimenu/ui_vs_whitestripe.png", Resource_Packaged, true ); tile->setTileScale( 1.0f ); tile->drawOrder = 202; tile->translate( 0.0f, -( tileRedStripe->collisionBounds.y + tile->collisionBounds.y ), 0.0f ); tile->removeFromScene(); tileRedStripe->addChild( tile ); } } } { CCTile3DButton *tile = new CCTile3DButton( this ); tile->setTileScale( 1.0f ); tile->drawOrder = 203; tilePlayer1 = tile; } { CCTile3DButton *tile = new CCTile3DButton( this ); tile->setTileScale( 1.0f ); tile->drawOrder = 204; tilePlayer2 = tile; } { CCTile3DButton *tile = new CCTile3DButton( this ); tile->setTileScale( 1.0f ); tile->drawOrder = 203; tileCountry1 = tile; } { CCTile3DButton *tile = new CCTile3DButton( this ); tile->setTileScale( 1.0f ); tile->drawOrder = 204; tileCountry2 = tile; } { CCTile3DButton *tile = new CCTile3DButton( this ); tile->setupTextured( "Resources/common/uimenu/ui_vs.png", Resource_Packaged, true ); tile->setTileScale( 1.0f ); tile->drawOrder = 205; tileVS = tile; } refreshCameraView(); lockCameraView(); }