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


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

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


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

示例1: IwMain


//.........这里部分代码省略.........
    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);

    state->SetInitialState(STATE_STARTUP);

    StateVariable initialValue;

    initialValue.intValue = 0;
    VAR_POINTS = state->RegisterVariable("GamePoints", initialValue);
    VAR_CURRENT_THINGY_COUNT = state->RegisterVariable("CurrentBugCount", initialValue);
    VAR_CURRENT_CORRECT_THINGY_COUNT = state->RegisterVariable("CorrectBugCount", initialValue);

    initialValue.stringValue = null;
    VAR_CURRENT_PHONEME = state->RegisterVariable("CurrentPhoneme", initialValue);

    // These objects do not register, so we have to delete them ourselves
    MainMenu *mainMenu = new MainMenu(mgr);
    LevelSelection *levelSelect = new LevelSelection(mgr);
    BugsLevel *bugsLevel = new BugsLevel(mgr);
    ApplesLevel *applesLevel = new ApplesLevel(mgr);
    SandboxLevel *sandboxLevel = new SandboxLevel(mgr);
    WallLevel *wallLevel = new WallLevel(mgr);

    levelSummary = new LevelSummary(mgr);

    state->ChangeState(STATE_MAIN_MENU);

    mgr->MainLoop();

    delete levelSummary;
    delete wallLevel;
    delete sandboxLevel;
    delete applesLevel;
    delete bugsLevel;
    delete levelSelect;
    delete mainMenu;

    delete mgr;
    delete wordBuilder;
}
开发者ID:david-southern,项目名称:BugSquisher,代码行数:101,代码来源:main.cpp


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