当前位置: 首页>>代码示例>>C++>>正文


C++ StateManager::DefineValidStateTransition方法代码示例

本文整理汇总了C++中StateManager::DefineValidStateTransition方法的典型用法代码示例。如果您正苦于以下问题:C++ StateManager::DefineValidStateTransition方法的具体用法?C++ StateManager::DefineValidStateTransition怎么用?C++ StateManager::DefineValidStateTransition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StateManager的用法示例。


在下文中一共展示了StateManager::DefineValidStateTransition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: IwMain

S3E_MAIN_DECL void IwMain()
{
    strcpy(EVENT_APPLE_DROP, "AppleDrop");
    strcpy(EVENT_NEW_DUMPTRUCK, "NewDumptruck");
    srand(time(null));

    wordBuilder = new WordBuilder;

    GameManager *mgr;
    mgr = new GameManager();

    mgr->SetRequestedFPS(100);

    mgr->GetResourceManager()->RegisterResourceGroup("images.group");

    IMAGE_MAIN_MENU = mgr->GetResourceManager()->RegisterImage("MainMenu");
    IMAGE_CHANGE_PLAYER_BUTTON = mgr->GetResourceManager()->RegisterImage("ChangePlayerButton");
    IMAGE_START_GAME_BUTTON = mgr->GetResourceManager()->RegisterImage("StartGameButton");
    IMAGE_LEVEL_SELECT = mgr->GetResourceManager()->RegisterImage("LevelSelectionScreen");
    IMAGE_PLAY_BUGS_BUTTON = mgr->GetResourceManager()->RegisterImage("BogsIcon");
    IMAGE_PLAY_APPLES_BUTTON = mgr->GetResourceManager()->RegisterImage("ApplesIcon");
    IMAGE_PLAY_SANDBOX_BUTTON = mgr->GetResourceManager()->RegisterImage("SandboxIcon");
    IMAGE_PLAY_WALL_BUTTON = mgr->GetResourceManager()->RegisterImage("WallIcon");
    IMAGE_MAIN_MENU_BUTTON = mgr->GetResourceManager()->RegisterImage("MainMenuButton");

    IMAGE_LADYBUG = mgr->GetResourceManager()->RegisterImage("ladybug");
    IMAGE_SPLAT = mgr->GetResourceManager()->RegisterImage("splat");
    IMAGE_BUGS_BACKGROUND = mgr->GetResourceManager()->RegisterImage("bugs_background");

    IMAGE_APPLES_BACKGROUND = mgr->GetResourceManager()->RegisterImage("apples_background");
    IMAGE_APPLE = mgr->GetResourceManager()->RegisterImage("apple");

    IMAGE_SANDBOX_BACKGROUND = mgr->GetResourceManager()->RegisterImage("sandbox_background");
    IMAGE_SANDCASTLE = mgr->GetResourceManager()->RegisterImage("sandcastle");
    IMAGE_DUMPTRUCK_FULL = mgr->GetResourceManager()->RegisterImage("dumptruck_full");
    IMAGE_DUMPTRUCK_EMPTY = mgr->GetResourceManager()->RegisterImage("dumptruck_empty");

    IMAGE_WALL_BACKGROUND = mgr->GetResourceManager()->RegisterImage("wall_background");
    IMAGE_BRICK1 = mgr->GetResourceManager()->RegisterImage("brick1");
    IMAGE_BRICK2 = mgr->GetResourceManager()->RegisterImage("brick2");
    IMAGE_BRICK3 = mgr->GetResourceManager()->RegisterImage("brick3");
    IMAGE_BRICK_TARGET = mgr->GetResourceManager()->RegisterImage("brick_target");

    IMAGE_STAR_0 = mgr->GetResourceManager()->RegisterImage("star_0");
    IMAGE_STAR_1 = mgr->GetResourceManager()->RegisterImage("star_1");
    IMAGE_STAR_2 = mgr->GetResourceManager()->RegisterImage("star_2");
    IMAGE_STAR_3 = mgr->GetResourceManager()->RegisterImage("star_3");
    IMAGE_STAR_4 = mgr->GetResourceManager()->RegisterImage("star_4");
    IMAGE_STAR_5 = mgr->GetResourceManager()->RegisterImage("star_5");

    FONT_TREB_16 = mgr->GetResourceManager()->RegisterFont("trebuchet16pt");
    FONT_TREB_24 = mgr->GetResourceManager()->RegisterFont("trebuchet24pt");
    FONT_TREB_36 = mgr->GetResourceManager()->RegisterFont("trebuchet36pt");

    FONT_COOPER_18 = mgr->GetResourceManager()->RegisterFont("cooper_18pt");
    FONT_COOPER_24 = mgr->GetResourceManager()->RegisterFont("cooper_24pt");
    FONT_COOPER_48 = mgr->GetResourceManager()->RegisterFont("cooper_48pt");

    SOUND_DING = mgr->GetResourceManager()->RegisterAudio("DING.wav");
    SOUND_BUZZ = mgr->GetResourceManager()->RegisterAudio("BUZZ.wav");

    GameManager::SetDebugFont(mgr->GetResourceManager()->GetFont(FONT_TREB_16));

    StateManager *state = mgr->GetStateManager();

    STATE_STARTUP = state->RegisterGameState("Startup");
    STATE_MAIN_MENU = state->RegisterGameState("MainMenu");
    STATE_LEVEL_SELECT = state->RegisterGameState("LevelSelect");

    STATE_BUGS_PLAYING = state->RegisterGameState("BugsPlaying");
    STATE_BUGS_SUMMARY = state->RegisterGameState("BugsSummary");

    STATE_APPLES_PLAYING = state->RegisterGameState("ApplesPlaying");
    STATE_APPLES_SUMMARY = state->RegisterGameState("ApplesSummary");

    STATE_SANDBOX_PLAYING = state->RegisterGameState("SandboxPlaying");
    STATE_SANDBOX_SUMMARY = state->RegisterGameState("SandboxSummary");

    STATE_WALL_PLAYING = state->RegisterGameState("WallPlaying");
    STATE_WALL_SUMMARY = state->RegisterGameState("WallSummary");

    state->DefineValidStateTransition(STATE_STARTUP, STATE_MAIN_MENU);
    state->DefineValidStateTransition(STATE_MAIN_MENU, STATE_LEVEL_SELECT);
    state->DefineValidStateTransition(STATE_LEVEL_SELECT, STATE_MAIN_MENU);

    state->DefineValidStateTransition(STATE_LEVEL_SELECT, STATE_BUGS_PLAYING);
    state->DefineValidStateTransition(STATE_BUGS_PLAYING, STATE_BUGS_SUMMARY);
    state->DefineValidStateTransition(STATE_BUGS_SUMMARY, STATE_LEVEL_SELECT);

    state->DefineValidStateTransition(STATE_LEVEL_SELECT, STATE_APPLES_PLAYING);
    state->DefineValidStateTransition(STATE_APPLES_PLAYING, STATE_APPLES_SUMMARY);
    state->DefineValidStateTransition(STATE_APPLES_SUMMARY, STATE_LEVEL_SELECT);

    state->DefineValidStateTransition(STATE_LEVEL_SELECT, STATE_SANDBOX_PLAYING);
    state->DefineValidStateTransition(STATE_SANDBOX_PLAYING, STATE_SANDBOX_SUMMARY);
    state->DefineValidStateTransition(STATE_SANDBOX_SUMMARY, STATE_LEVEL_SELECT);

    state->DefineValidStateTransition(STATE_LEVEL_SELECT, STATE_WALL_PLAYING);
    state->DefineValidStateTransition(STATE_WALL_PLAYING, STATE_WALL_SUMMARY);
    state->DefineValidStateTransition(STATE_WALL_SUMMARY, STATE_LEVEL_SELECT);
//.........这里部分代码省略.........
开发者ID:david-southern,项目名称:BugSquisher,代码行数:101,代码来源:main.cpp


注:本文中的StateManager::DefineValidStateTransition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。