See the file LICENSE for the license governing this code.
TitleScene
displays the game’s title and provides a simple menu with options to start a new single-player game, load an existing single-player save game slot, play multiplayer and edit options.
#pragma once
#include "Headers.h"
class TitleScene : public Scene
{
public:
TitleScene();
virtual ~TitleScene();
Updates the scene.
virtual void update(float delta);
Create an auto-released copy of TitleScene
.
static TitleScene* create();
private:
typedef Scene super;
typedef TitleScene self;
Sprite* title, *version, *cursor;
Layer* window;
double lastInputTime;
double startGameTime;
Menu* menu;
struct Choice
{
string text;
function<void (Ref*)> callback;
Label* label = nullptr;
MenuItem* menuItem = nullptr;
Size textSize;
};
vector<Choice> choices;
int currentChoice;
void showMainMenu();
void showSaveGameMenu();
void showMultiplayerMenu();
void showSettingsMenu();
void startGame();
void showMenu();
void hideMenu(float duration);
void moveCursor();
};
Core
Object types