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


C++ Level::LoadLevel方法代码示例

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


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

示例1: GetWorlds

// Get worlds in world folder
void PixelMap::GetWorlds(GUI_Creator *gui)
{
	if (!gui)
		return;

	STRING home = GetSaveFolder();

	FileSearch search = FileSearch();
	search.path = home;
	search.deep = false;
	if (!ListFiles(&search))
		return;

	while (search.files.size())
	{
		STRING file = search.files.top();
		search.files.pop();
		Level lvl = Level();
		lvl.LoadLevel(file);
		if (lvl.info.seed)
		{
			int i = worlds.size();
			worlds.push_back(Port::FileName(file));
			gui->Append(GUI_WORLDFILE, lvl.info.name, i);
		}
	}
	gui->Set(GUI_WORLDFILE, 0);
}
开发者ID:McTwist,项目名称:PixelMap,代码行数:29,代码来源:PixelMap.cpp

示例2: AdditionalInit

void MyGame::AdditionalInit() {
    //limit the fps to 60 fps
    m_iFPSLimit = 60;
    m_bLimitFPS = true;
    player.Init("data/animations/xeon_animation.xml");

    debugLevel.LoadProjectSettings("data/maps/SDL_Game.oep");
    debugLevel.LoadLevel("data/maps/Debug Level.oel");
}
开发者ID:krej,项目名称:SDL-Game,代码行数:9,代码来源:main.cpp

示例3: main

int main()
{
    srand(time(0));
    sf::ContextSettings settings;
    settings.antialiasingLevel = 8;

    // create the window
    sf::RenderWindow window(sf::VideoMode(928, 448), "Labshooter", sf::Style::Default, settings);

    sf::Clock clock;

    sf::Texture playerTexture;
    playerTexture.loadFromFile("assets/player.png");

    sf::Texture tileTexture;
    tileTexture.loadFromFile("assets/tile.png");

    sf::Sprite playerSprite;
    playerSprite.setTexture(playerTexture);

    sf::Sprite tileSprite;
    tileSprite.setTexture(tileTexture);

    SoundManager::LoadSound("shoot", "assets/shoot.wav");
    SoundManager::LoadSound("shoot2", "assets/shoot2.wav");
    SoundManager::LoadSound("hurt", "assets/hurt.wav");

    level.LoadLevel("assets/level1");

    // run the program as long as the window is open
    while (window.isOpen())
    {
        sf::Time elapsed = clock.restart();

        // check all the window's events that were triggered since the last iteration of the loop
        sf::Event event;
        while (window.pollEvent(event))
        {
            // "close requested" event: we close the window
            if (event.type == sf::Event::Closed)
                window.close();
        }
        level.Update(elapsed.asMilliseconds());
        /*if(sf::Keyboard::isKeyPressed(sf::Keyboard::D)) {
            move(0.5 * elapsed.asMilliseconds(), 0, playerSprite, tileSprite);
        }
        if(sf::Keyboard::isKeyPressed(sf::Keyboard::A)) {
            move(-0.5 * elapsed.asMilliseconds(), 0, playerSprite, tileSprite);
        }
        if(sf::Keyboard::isKeyPressed(sf::Keyboard::W)) {
            move(0, -0.5 * elapsed.asMilliseconds(), playerSprite, tileSprite);
        }
        if(sf::Keyboard::isKeyPressed(sf::Keyboard::S)) {
            move(0, 0.5 * elapsed.asMilliseconds(), playerSprite, tileSprite);
        }*/

        tileSprite.setPosition(50, 50);

        // clear the window with black color
        window.clear(sf::Color::White);

        // draw everything here...
        //window.draw(playerSprite);
        //window.draw(tileSprite);
        level.Render(&window);

        // end the current frame
        window.display();
    }

    return 0;
}
开发者ID:esenti,项目名称:labshooter,代码行数:72,代码来源:main.cpp

示例4: main

int main(int argc, char* args[])
{

	enum {MENU, RUNNING, GAMEOVER, END};
	int state = MENU;

	int score = 0;
	int deaths = 0;

	//Holds all game objects vectors
	vector<Net *> nets;
	vector<Coral *> corals;
	vector<School *> schools;
	vector<SceneryFish *> sceneryFish;
	vector<GobblerFish *> gobblerFish;

	//back buffer || bit messy can clean up
	System system("Fishy Game", false, 640, 480, 32, 60);
	if (!system.Setup())
	{
		MessageBox(NULL, "SDL DID NOT INITIALISE PROPERLY", NULL, MB_OK);
		return -1;
	}
	SDL_Surface* buffer = system.GetBuffer();

	Timer timer;
	Timer delta;
	Camera camera(640, 480);

	Level level;
	Menu menu;
	Hud hud;
	
	School* school;
	Net* net = NULL;
	Coral* coral = NULL;

	Mix_Music *music = NULL;
	Fish fish("Sprites/Player_Spritesheet.bmp", 64, 64, 0, 0, 200, 200);
	level.LoadLevel(fish, corals, nets, sceneryFish, gobblerFish);
	music = Mix_LoadMUS( "Sounds/DST-Aethereal.wav" );

	delta.Start();

	while(!system.Done())
	{
		srand(time(NULL));

		if(Mix_PlayingMusic () == 0)
		{
			Mix_PlayMusic(music, -1);
		}

		switch(state)
		{
		case MENU:

			state = (menu.Update( delta, system.GetEvent()));
			menu.Draw(buffer, camera);

			break;
		case RUNNING:


		hud.Update(score, deaths );

		//update
		fish.Update( delta.GetTicks() );

		for( int c = 0; c < corals.size(); c++)
		{
			corals[c]->Update(delta.GetTicks());
		}

		for( int i = 0; i < schools.size(); i++)
		{
			schools[i]->Update( delta.GetTicks(), fish, corals);
			for(int j = 0; j < 3; j++)
			{
				if(schools[i]->GetFish(j)->GetEaten()
					&& (!schools[i]->GetFish(j)->GetScored())) 
				{ 
						deaths += 1;
						schools[i]->GetFish(j)->SetScored(true);
				}
				if(schools[i]->GetFish(j)->GetSaved()
					&& (!schools[i]->GetFish(j)->GetScored()))
				{ 
					score += 10; 
					schools[i]->GetFish(j)->SetScored(true);
				}
			}
		}

		for( int g = 0; g < gobblerFish.size(); g++)
		{
			gobblerFish[g]->Update(delta.GetTicks(), schools);
		}

		for( int i = 0; i < nets.size(); i++)
//.........这里部分代码省略.........
开发者ID:TaintedGear,项目名称:Fishy-Rescue,代码行数:101,代码来源:main.cpp


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