// 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(); }