本文整理汇总了C++中Map::GetInitialPlayerPos方法的典型用法代码示例。如果您正苦于以下问题:C++ Map::GetInitialPlayerPos方法的具体用法?C++ Map::GetInitialPlayerPos怎么用?C++ Map::GetInitialPlayerPos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Map
的用法示例。
在下文中一共展示了Map::GetInitialPlayerPos方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv) {
Renderer* r = NULL;
try {
r = new Renderer(800, 600);
EventQueue ev(r);
CharacterManager cm;
r->SetCharManager(&cm);
Player player = Player(10, 10, "Dann Von Veigar");
player.SetEventQueue(&ev);
Item it = Item("Insígnia do MC Bin Laden", "insignia do mestre Bin Laden", 3000);
player.AddItem(&it);
Sprite s = Sprite("..\\characters\\dann.png", 1.5f, 0);
player.SetSprite(&s);
Asura asu = Asura{ 0,0 };
Akhbran ahk = Akhbran{ 0,0 };
CharFactory* cf = new CharFactory(&cm);
Tree t = Tree(20, 20);
Sprite stree = Sprite("..\\characters\\arvore1.png", 1, 60, 80);
t.SetSprite(&stree);
cf->RegisterCharacter(t.GetTypeID(), &t);
cm.AddCharacter(&player);
cm.SetPlayer(&player);
/*
cm.AddCharacter(cf->PutCharacter(t.GetTypeID(), 3, 8));
cm.AddCharacter(cf->PutCharacter(t.GetTypeID(), 6, 11));
cm.AddCharacter(cf->PutCharacter(t.GetTypeID(), 9, 20));
cm.AddCharacter(cf->PutCharacter(t.GetTypeID(), 12, 25));
cm.AddCharacter(cf->PutCharacter(t.GetTypeID(), 15, 20));
cm.AddCharacter(cf->PutCharacter(t.GetTypeID(), 18, 11));
cm.AddCharacter(cf->PutCharacter(t.GetTypeID(), 21, 8));
cm.AddCharacter(cf->PutCharacter(t.GetTypeID(), 24, 11));
cm.AddCharacter(cf->PutCharacter(t.GetTypeID(), 27, 20));
*/
cm.AddCharacter(&asu);
cm.AddCharacter(&ahk);
Map* m;
Map::LoadTiles();
MapOpener mpop;
m = mpop.Open("..\\maps\\map2.map");
if (!m) {
char strmaperr[32];
sprintf_s(strmaperr, 32, "Erro ao abrir o mapa!");
throw std::runtime_error(strmaperr);
}
int px, py;
m->GetInitialPlayerPos(px, py);
float fx = px, fy = py;
player.SetPosition(fx, fy);
std::vector<CharacterData>* chd = m->GetCharData();
if (chd->size() > 0) {
for (auto i = chd->begin(); i != chd->end(); i++) {
cm.AddCharacter(cf->PutCharacter(i->Type, i->XPos, i->YPos));
}
}
r->SetMap(m);
cm.SetMap(m);
HUD* hud = new HUD(&player);
r->SetHUD(hud);
bool render = true;
double fps = (1/60), start_time, end_time;
float start_animations = al_get_time();
float start_events = al_get_time();
float playerdx = 0, playerdy = 0;
start_time = al_get_time();
while (render) {
//.........这里部分代码省略.........