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


C++ LocalPlayer::setViewport方法代码示例

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


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

示例1: dummyInit

void Game::dummyInit()
{
  LocalPlayer *player = new LocalPlayer(this, "Kali", Data::wizard(WizardID::KALI), GREEN, Data::race("barbarians"), 60, 40);
  LocalPlayer *player2 = new LocalPlayer(this, "Antani", Data::wizard(WizardID::MERLIN), BLUE, Data::race("barbarians"), 60, 40);

  
  Army* army2 = new Army(player2, {
    new Hero(Data::unit("hero_dwarf")->as<HeroSpec>()),
    new RaceUnit(Data::unit("barbarian_spearmen")->as<RaceUnitSpec>()),
    new FantasticUnit(Data::unit("funit_magic_spirit")->as<SummonSpec>()),
  });
  
  player2->add(army2);
  placeArmy(army2, Position(2, 2, ARCANUS));
  
  players.push_back(player);
  players.push_back(player2);
  current = players.begin();
  
  world->fill(TILE_WATER, ARCANUS);
  world->fill(TILE_WATER, MYRRAN);
  world->rect(TILE_GRASS, 3, 3, 10, 10, ARCANUS);
  world->rect(TILE_MOUNTAIN, 4, 4, 2, 2, ARCANUS);
  world->line(TILE_HILL, 4, 8, 11, true, ARCANUS);
  world->rect(TILE_GRASS, 1, 1, 6, 6, MYRRAN);
  world->line(TILE_MOUNTAIN, 6, 8, 5, false, MYRRAN);
  world->line(TILE_HILL, 5, 8, 6, true, MYRRAN);
  world->line(TILE_WATER, 2, 6, 6, true, ARCANUS);
  world->set(TILE_WATER, 4, 7, ARCANUS);
  world->set(TILE_HILL, 4,4, ARCANUS);
  world->set(TILE_DESERT, 8,8, ARCANUS);
  world->set(TILE_DESERT, 7,8, ARCANUS);
  world->set(TILE_DESERT, 9,8, ARCANUS);
  world->set(TILE_DESERT, 8,7, ARCANUS);
  world->set(TILE_DESERT, 8,9, ARCANUS);
  world->set(TILE_DESERT, 7,9, ARCANUS);
  world->set(TILE_DESERT, 9,9, ARCANUS);
  world->set(TILE_DESERT, 10,9, ARCANUS);
  
  world->get(7, 8, ARCANUS)->placeManaNode(new ManaNode(School::SORCERY, 0));
    
  //WorldGenerator.generate(world, ARCANUS);
  //WorldGenerator.generate(world, MYRRAN);

  Army* a = new Army(player, {
		new FantasticUnit(Data::unit("funit_great_drake")->as<SummonSpec>()),
    new RaceUnit(Data::unit("barbarian_spearmen")->as<RaceUnitSpec>()),
		new RaceUnit(Data::unit("barbarian_swordsmen")->as<RaceUnitSpec>()),
		new RaceUnit(Data::unit("barbarian_bowmen")->as<RaceUnitSpec>()),
		new RaceUnit(Data::unit("barbarian_cavalry")->as<RaceUnitSpec>()),
    new FantasticUnit(Data::unit("funit_great_drake")->as<SummonSpec>()),
		new RaceUnit(Data::unit("barbarian_berserkers")->as<RaceUnitSpec>()),
  });
  
  SpellCast cast = SpellCast(player, Spells::BLESS);
  a->get(0)->skills()->add(cast);
  
  //map.get(5, 5, ARCANUS).placeManaNode(mapMechanics.generateManaNode(world, 5, 5, ARCANUS));
  //this.meldNode(a, 5, 5, ARCANUS);
  //map.get(5, 6, ARCANUS).placeManaNode(new ManaNode());
  //map.get(6, 5, ARCANUS).placeManaNode(new ManaNode());
  //map.get(6, 6, ARCANUS).placeManaNode(new ManaNode());
  world->get(4, 3, ARCANUS)->placeResource(Resource::COAL);
  world->get(3, 4, ARCANUS)->placeResource(Resource::WILD_GAME);
  //map.rect(TILE_GRASS, 2, 2, 6, 3);
  //map.rect(TILE_GRASS, 8, 4, 1, 1);
  world->get(3,4,ARCANUS)->placeRoad(true);
  world->get(3,5,ARCANUS)->placeRoad(true);
  world->get(4,5,ARCANUS)->placeRoad(true);
  world->get(5,5,ARCANUS)->placeRoad(true);

  world->set(TILE_VOLCANO, 0, 0, ARCANUS);
  world->set(TILE_VOLCANO, 59, 0, ARCANUS);
  world->set(TILE_VOLCANO, 0, 39, ARCANUS);
  world->set(TILE_VOLCANO, 59, 39, ARCANUS);
  world->set(TILE_HILL, 1, 2, MYRRAN);
  
  player->fog()->setRect(0, 0, 60, 40, ARCANUS);
  player->fog()->setRect(0, 0, 60, 40, MYRRAN);
  player->setViewport(5, 5);
  
  player->book()->discoverSpell(Spells::BLESS);
  player->book()->discoverSpell(Spells::CORRUPTION);
  player->book()->discoverSpell(Spells::CHANGE_TERRAIN);
  player->book()->discoverSpell(Spells::RAISE_VOLCANO);
  player->book()->discoverSpell(Spells::GUARDIAN_SPIRIT);
  
  new LocalGame(this);
  
  placeArmy(a, Position(5, 6, ARCANUS));
  placeArmy(new Army(player, {new FantasticUnit(Data::unit("funit_magic_spirit")->as<SummonSpec>()),new FantasticUnit(Data::unit("funit_great_drake")->as<SummonSpec>())}), Position(4, 3, ARCANUS));
  placeArmy(new Army(player, {new FantasticUnit(Data::unit("funit_great_drake")->as<SummonSpec>()), new Hero(Data::unit("hero_dwarf")->as<HeroSpec>())}), Position(4, 8, ARCANUS));
  
  City* florence = new City(player, "Florence", 4000, Position(3, 3, ARCANUS));
  florence->addBuilding(Building::MAGE_FORTRESS);
  florence->addBuilding(Building::SMITHY);
  florence->addBuilding(Building::BUILDERS_HALL);
  florence->addBuilding(Building::BARRACKS);
  florence->addBuilding(Building::FIGHTERS_GUILD);
  florence->addBuilding(Building::SUMMONING_CIRCLE);
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


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