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


C++ Engine::ChangeState方法代码示例

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


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

示例1: main

int main()
{
	Engine game;

	// initialize the engine
	if(!game.Init("10 Seconds")) {
		return 1;
	}

    game.window.setJoystickThreshold(10);
	game.ChangeState(GMenuState::Instance());

	// main loop
	while(game.Running()) {
		game.HandleEvents();
		game.Update();
		if(game.Running())
			game.Draw();
	}

	// cleanup the engine
	game.Cleanup();

	return 0;
}
开发者ID:Chase-C,项目名称:Ten-Seconds-to-Death,代码行数:25,代码来源:main.cpp

示例2: main

int main(int argc, char *argv[])
{
    json_object * str = json_object_new_string("cunt\n");
    std::cout << "My string is " << json_object_get_string(str);
#ifdef __APPLE__
    CFBundleRef mainBundle = CFBundleGetMainBundle();
    CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle);
    char path[PATH_MAX];
    if (!CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path, PATH_MAX))
    {
        // error!
    }
    CFRelease(resourcesURL);
    
    chdir(path);
    std::cout << "Current Path: " << path << std::endl;
#endif
#ifdef _DEBUG
#ifdef __LINUX__ // !!!! MOVE THIS TO MAIN STARTUP !!!!
	const std::string delim = "/"
#else
	const std::string delim = "\\";
#endif // __LINUX__
	std::string log_file = "Logfiles" + delim + "tiles.txt";
	LOG_SET_FILENAME(log_file.c_str());
#endif // _DEBUG
    std::cout << getwd << std::endl;
	Engine engine;
	if (!engine.Initialise())
		return -1;

	engine.ChangeState(SplashState::GetInstance());

    while (engine.IsRunning())
	{
		engine.HandleEvents();
		engine.Update();
		engine.Render();
	}

#ifdef _DEBUG
	LOG_WRITE_FILE;
#endif

    return 0;
}
开发者ID:Norcinu,项目名称:Bomberman-ish,代码行数:46,代码来源:Main.cpp

示例3: main

int main( int argc, char* argv[] )
{	
	int iLevelWidth = 1024;
	int iLevelHeight = 768;

	Initialise(iLevelWidth, iLevelHeight, false, "Game!");

	Engine Game;

	Game.ChangeState(IntroState::Instance());

	do 
	{
		Game.Update();

	} while ( FrameworkUpdate() == false );
	

	Shutdown();

	return 0;
}
开发者ID:blueskies9041,项目名称:Sam,代码行数:22,代码来源:main.cpp

示例4: main

int main ( int argc, char *argv[] )
{
    Engine game;

    // initialize the engine
    game.Init( "Splatter", 1200, 600 , 0, false);

    // load the intro
    game.ChangeState( MainMenuState::Instance());

    // main loop
    while ( game.Running() )
    {
        game.HandleEvents();
        game.Update();
        game.Draw();
        SDL_RenderPresent(game.renderer);
    }

    // cleanup the engine
    game.Cleanup();

    return 0;
}
开发者ID:jlashner,项目名称:Splatter,代码行数:24,代码来源:main.cpp

示例5: StartUpBeforeCreateWindow

void StartUpBeforeCreateWindow()
{
#if defined(IPHONE)
  std::string dataDir = GetDataDir();
  std::cout << "Data Dir: " << dataDir << "\n";
  File::SetRoot(dataDir, "/");
#endif

#ifdef GEKKO
  // TODO Better to put this in library main() if we can get the app's directory
  File::SetRoot("/apps/amju_scp/data/", "/");
#endif

#if defined (AMJU_USE_BASS)
  TheSoundManager::Instance()->SetImpl(new BassSoundPlayer);
#endif

  GlueFile* gf = new GlueFileMem;
  gf->SetPrintUnusedInDtor(true);

  if (!FileImplGlue::OpenGlueFile(GLUE_FILE, gf))
  {
    ReportError("Failed to open data glue file");
    return; // TODO false;
  }

  GlueFile* pMusicGlueFile = new GlueFileMem;
  if (pMusicGlueFile->OpenGlueFile(MUSIC_GLUE_FILE, true)) // true = read only 
  {
    TheSoundManager::Instance()->SetGlueFile(pMusicGlueFile);
  }
  else
  {
    ReportError("Failed to open music glue file");
    return; // TODO false;
  }

/*
  // TODO Other languages - preferences
  if (!Localise::LoadStringTable("english.txt"))
  {
    ReportError("No localise string table.");
  }

  // Add resource loaders
  TheResourceManager::Instance()->AddLoader("obj", ObjLoader);
  TheResourceManager::Instance()->AddLoader("font", FontLoader);
  TheResourceManager::Instance()->AddLoader("mod", BinaryResourceLoader);
  TheResourceManager::Instance()->AddLoader("snd", BinaryResourceLoader);
  TheResourceManager::Instance()->AddLoader("wav", BinaryResourceLoader);
	
  // Add SceneNode types to factory
  TheSceneNodeFactory::Instance()->Add(SceneNode::NAME, &SceneNode::Create);
  TheSceneNodeFactory::Instance()->Add(SceneMesh::NAME, &SceneMesh::Create);
	
	
  TheResourceManager::Instance()->LoadResourceGroup("2dtext-group");
  TheHud::Instance()->Load();

#ifdef BYPASS_TITLE
  // TODO Only needed if we bypass title
  TheResourceManager::Instance()->LoadResourceGroup("3dtext-group");
  TheResourceManager::Instance()->LoadResourceGroup("gui-group");
  TheLevelManager::Instance()->SetLevelId(1);
  StartGame(1, AMJU_MAIN_GAME_MODE); // TODO two player etc
  TheGame::Instance()->SetCurrentState(GSLoadLevel::NAME); 
#else
  TheGame::Instance()->SetCurrentState(TheGSLogo::Instance());	
#endif
*/

#ifdef GEKKO
  TheCursorManager::Instance()->Load(Vec2f(0.025f, -0.08f)); // position hotspot
#endif

  Engine* engine = Engine::Instance();
  engine->ChangeState(EsLogo::Name, Engine::IMMEDIATE);

  engine->GetGameState()->SetName("gs.cfg");
  engine->GetGameState()->Load();

  ConfigHack(); // set config from auto-generated source file.

#ifdef MACOSX
  std::string root = "./"; //GetRoot();
  std::cout << "Root is " << root.c_str() << "\n";
  File::SetRoot(root, "/");
#endif

#ifdef _DEBUG
std::cout << "main(): got root\n";
#endif

  engine->LoadConfigFile(GAME_CFG);
  engine->InitGl();

  TheGame::Instance()->SetCurrentState(engine);	

}
开发者ID:jason-amju,项目名称:amju-scp,代码行数:99,代码来源:StartUp.cpp


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