4 * Created on: Aug 1, 2012
8 #include "app/Application.h"
10 #include "battle/BattleState.h"
11 #include "battle/Hero.h"
12 #include "battle/Monster.h"
13 #include "battle/PartyLayout.h"
14 #include "battle/Resources.h"
15 #include "battle/Stats.h"
16 #include "common/Ikari.h"
17 #include "common/Inventory.h"
18 #include "common/Item.h"
19 #include "common/Spell.h"
20 #include "geometry/Vector.h"
21 #include "graphics/ComplexAnimation.h"
22 #include "graphics/Font.h"
23 #include "graphics/Frame.h"
24 #include "graphics/Gauge.h"
25 #include "graphics/Menu.h"
26 #include "graphics/SimpleAnimation.h"
27 #include "graphics/Sprite.h"
28 #include "loader/Interpreter.h"
29 #include "loader/ParsedSource.h"
30 #include "loader/Parser.h"
31 #include "sdl/InitImage.h"
32 #include "sdl/InitScreen.h"
33 #include "sdl/InitSDL.h"
40 #include <SDL_image.h>
42 using app::Application;
44 using battle::BattleState;
46 using battle::Monster;
47 using battle::PartyLayout;
50 using common::Inventory;
53 using geometry::Vector;
54 using graphics::ComplexAnimation;
56 using graphics::Frame;
57 using graphics::Gauge;
59 using graphics::SimpleAnimation;
60 using graphics::Sprite;
61 using loader::Interpreter;
62 using loader::ParsedSource;
65 using sdl::InitScreen;
73 int main(int argc, char **argv) {
74 const int width = 800;
75 const int height = 480;
77 const int framerate = 33;
79 // std::srand(std::time(0));
83 InitImage image(IMG_INIT_PNG);
86 Parser parser("test-data/test.l2s", source);
88 Interpreter intp(source);
91 InitScreen screen(width, height);
93 // temporary test data
94 SDL_Surface *bg(IMG_Load("test-data/battle-bg.png"));
95 PartyLayout monstersLayout(*intp.GetPartyLayout("monstersLayout"));
96 PartyLayout heroesLayout(*intp.GetPartyLayout("heroesLayout"));
98 Monster monster(*intp.GetMonster("lizard"));
99 Hero maxim(*intp.GetHero("maxim"));
100 Hero selan(*intp.GetHero("selan"));
101 Hero guy(*intp.GetHero("guy"));
102 Hero dekar(*intp.GetHero("dekar"));
104 battle::Resources battleRes;
106 SDL_Surface *swapCursorImg(IMG_Load("test-data/swap-cursor.png"));
107 Sprite swapCursorSprite(swapCursorImg, 32, 32);
108 battleRes.swapCursor = &swapCursorSprite;
109 SDL_Surface *attackIconsImg(IMG_Load("test-data/attack-type-icons.png"));
110 Sprite attackIconsSprite(attackIconsImg, 32, 32);
111 battleRes.attackIcons = &attackIconsSprite;
112 SDL_Surface *attackChoiceIconsImg(IMG_Load("test-data/attack-choice-icons.png"));
113 Sprite attackChoiceIconsSprite(attackChoiceIconsImg, 16, 16);
114 battleRes.attackChoiceIcons = &attackChoiceIconsSprite;
115 SDL_Surface *moveIconsImg(IMG_Load("test-data/move-icons.png"));
116 Sprite moveIconsSprite(moveIconsImg, 32, 32);
117 battleRes.moveIcons = &moveIconsSprite;
119 SDL_Surface *titleFrameImg(IMG_Load("test-data/title-frame.png"));
120 Frame titleFrame(titleFrameImg, 16, 16);
121 battleRes.titleFrame = &titleFrame;
123 SDL_Surface *largeFontImg(IMG_Load("test-data/large-font.png"));
124 Sprite largeFontSprite(largeFontImg, 16, 32);
125 Font largeFont(&largeFontSprite, 0, -2);
126 battleRes.titleFont = &largeFont;
128 ComplexAnimation numberAnimationPrototype(0, framerate);
129 numberAnimationPrototype.AddFrame(0, 0);
130 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -26));
131 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -42));
132 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -48));
133 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -42));
134 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -26));
135 numberAnimationPrototype.AddFrame(0, 0);
136 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -12));
137 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -20));
138 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -24));
139 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -20));
140 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -12));
141 numberAnimationPrototype.AddFrame(0, 0);
142 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -6));
143 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -10));
144 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -12));
145 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -10));
146 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -6));
147 numberAnimationPrototype.AddFrames(0, 0, Vector<int>(), 14);
148 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -36));
149 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -32));
150 numberAnimationPrototype.AddFrame(0, 0, Vector<int>(0, -18));
151 battleRes.numberAnimationPrototype = &numberAnimationPrototype;
153 SDL_Surface *bigNumbersImg(IMG_Load("test-data/big-numbers.png"));
154 Sprite bigNumbersSprite(bigNumbersImg, 16, 32);
155 battleRes.bigNumberSprite = &bigNumbersSprite;
156 SDL_Surface *bigGreenNumbersImg(IMG_Load("test-data/big-green-numbers.png"));
157 Sprite bigGreenNumbersSprite(bigGreenNumbersImg, 16, 32);
158 battleRes.greenNumberSprite = &bigGreenNumbersSprite;
160 SDL_Surface *heroTagImg(IMG_Load("test-data/hero-tag-sprites.png"));
161 Sprite heroTagSprite(heroTagImg, 32, 16);
162 battleRes.heroTagLabels = &heroTagSprite;
163 battleRes.levelLabelCol = 0;
164 battleRes.levelLabelRow = 0;
165 battleRes.healthLabelCol = 0;
166 battleRes.healthLabelRow = 1;
167 battleRes.manaLabelCol = 0;
168 battleRes.manaLabelRow = 2;
169 battleRes.moveLabelCol = 0;
170 battleRes.moveLabelRow = 3;
171 battleRes.ikariLabelCol = 0;
172 battleRes.ikariLabelRow = 4;
174 SDL_Surface *numbersImg(IMG_Load("test-data/numbers.png"));
175 Sprite numbersSprite(numbersImg, 16, 16);
176 Font heroTagFont(&numbersSprite, 0, -3);
177 battleRes.heroTagFont = &heroTagFont;
178 SDL_Surface *tagFramesImg(IMG_Load("test-data/tag-frames.png"));
179 Frame heroTagFrame(tagFramesImg, 16, 16, 1, 1, 0, 33);
180 battleRes.heroTagFrame = &heroTagFrame;
181 Frame activeHeroTagFrame(tagFramesImg, 16, 16);
182 battleRes.activeHeroTagFrame = &activeHeroTagFrame;
183 SDL_Surface *smallTagFrameImg(IMG_Load("test-data/small-tag-frame.png"));
184 Frame smallTagFrame(smallTagFrameImg, 8, 16);
185 battleRes.smallHeroTagFrame = &smallTagFrame;
186 Frame lastSmallTagFrame(smallTagFrameImg, 8, 16, 1, 1, 0, 33);
187 battleRes.lastSmallHeroTagFrame = &lastSmallTagFrame;
188 battleRes.heroesBgColor = SDL_MapRGB(screen.Screen()->format, 0x18, 0x28, 0x31);
190 SDL_Surface *gauges(IMG_Load("test-data/gauges.png"));
191 Gauge healthGauge(gauges, 0, 16, 0, 0, 16, 6, 1, 6);
192 battleRes.healthGauge = &healthGauge;
193 Gauge manaGauge(gauges, 0, 32, 0, 0, 16, 6, 1, 6);
194 battleRes.manaGauge = &manaGauge;
195 Gauge ikariGauge(gauges, 0, 48, 0, 0, 16, 6, 1, 6);
196 battleRes.ikariGauge = &ikariGauge;
198 SDL_Surface *selectFrameImg(IMG_Load("test-data/select-frame.png"));
199 Frame selectFrame(selectFrameImg, 16, 16);
200 battleRes.selectFrame = &selectFrame;
202 SDL_Surface *normalFontImg(IMG_Load("test-data/normal-font.png"));
203 Sprite normalFontSprite(normalFontImg, 16, 16);
204 Font normalFont(&normalFontSprite, 0, -2);
205 battleRes.normalFont = &normalFont;
207 SDL_Surface *disabledFontImg(IMG_Load("test-data/disabled-font.png"));
208 Sprite disabledFontSprite(disabledFontImg, 16, 16);
209 Font disabledFont(&disabledFontSprite, 0, -2);
210 battleRes.disabledFont = &disabledFont;
212 SDL_Surface *handCursorImg(IMG_Load("test-data/cursor-hand.png"));
213 Sprite handCursorSprite(handCursorImg, 32, 32);
214 battleRes.menuCursor = &handCursorSprite;
216 SDL_Surface *targetingIconsImg(IMG_Load("test-data/targeting-icons.png"));
217 Sprite weaponTargetCursor(targetingIconsImg, 32, 32);
218 Sprite magicTargetCursor(targetingIconsImg, 32, 32, 0, 32);
219 Sprite itemTargetCursor(targetingIconsImg, 32, 32, 0, 64);
220 battleRes.weaponTargetCursor = &weaponTargetCursor;
221 battleRes.magicTargetCursor = &magicTargetCursor;
222 battleRes.itemTargetCursor = &itemTargetCursor;
225 resetSpell.SetName("Reset");
226 maxim.AddSpell(&resetSpell);
228 strongSpell.SetName("Strong");
229 strongSpell.SetCost(3);
230 strongSpell.SetUsableInBattle();
231 strongSpell.GetTargetingMode().TargetMultipleAllies();
232 maxim.AddSpell(&strongSpell);
233 selan.AddSpell(&strongSpell);
235 strongerSpell.SetName("Stronger");
236 strongerSpell.SetCost(8);
237 strongerSpell.SetUsableInBattle();
238 strongerSpell.GetTargetingMode().TargetMultipleAllies();
239 maxim.AddSpell(&strongerSpell);
240 selan.AddSpell(&strongerSpell);
242 championSpell.SetName("Champion");
243 championSpell.SetCost(16);
244 championSpell.SetUsableInBattle();
245 championSpell.GetTargetingMode().TargetMultipleAllies();
246 maxim.AddSpell(&championSpell);
247 selan.AddSpell(&championSpell);
249 rallySpell.SetName("Rally");
250 rallySpell.SetCost(10);
251 rallySpell.SetUsableInBattle();
252 rallySpell.GetTargetingMode().TargetMultipleAllies();
253 maxim.AddSpell(&rallySpell);
254 selan.AddSpell(&rallySpell);
256 escapeSpell.SetName("Escape");
257 escapeSpell.SetCost(8);
258 selan.AddSpell(&escapeSpell);
260 valorSpell.SetName("Valor");
261 valorSpell.SetCost(30);
262 valorSpell.SetUsableInBattle();
263 valorSpell.GetTargetingMode().TargetMultipleAllies();
264 maxim.AddSpell(&valorSpell);
265 selan.AddSpell(&valorSpell);
267 battleRes.spellMenuHeadline = "Please choose a spell.";
268 battleRes.spellMenuPrototype = Menu<const Spell *>(&normalFont, &disabledFont, &handCursorSprite, 9, 6, 8, 0, 2, 32, 2, ':');
270 SDL_Surface *itemIcons(IMG_Load("test-data/item-icons.png"));
271 Sprite potionIcon(itemIcons, 16, 16);
272 Sprite ballIcon(itemIcons, 16, 16, 0, 16);
273 Sprite crankIcon(itemIcons, 16, 16, 0, 32);
274 Sprite spearIcon(itemIcons, 16, 16, 0, 48);
275 Sprite swordIcon(itemIcons, 16, 16, 0, 64);
276 Sprite axIcon(itemIcons, 16, 16, 0, 80);
277 Sprite rodIcon(itemIcons, 16, 16, 0, 96);
278 Sprite armorIcon(itemIcons, 16, 16, 0, 112);
279 Sprite shieldIcon(itemIcons, 16, 16, 0, 128);
280 Sprite helmetIcon(itemIcons, 16, 16, 0, 144);
281 Sprite ringIcon(itemIcons, 16, 16, 0, 160);
282 Sprite jewelIcon(itemIcons, 16, 16, 0, 176);
284 battleRes.weaponMenuIcon = &swordIcon;
285 battleRes.armorMenuIcon = &armorIcon;
286 battleRes.shieldMenuIcon = &shieldIcon;
287 battleRes.helmetMenuIcon = &helmetIcon;
288 battleRes.ringMenuIcon = &ringIcon;
289 battleRes.jewelMenuIcon = &jewelIcon;
293 antidote.SetName("Antidote");
294 antidote.SetMenuIcon(&potionIcon);
295 antidote.SetUsableInBattle();
296 antidote.GetTargetingMode().TargetSingleAlly();
297 inventory.Add(&antidote, 9);
299 magicJar.SetName("Magic jar");
300 magicJar.SetMenuIcon(&potionIcon);
301 magicJar.SetUsableInBattle();
302 magicJar.GetTargetingMode().TargetSingleAlly();
303 inventory.Add(&magicJar, 4);
305 hiPotion.SetName("Hi-Potion");
306 hiPotion.SetMenuIcon(&potionIcon);
307 hiPotion.SetUsableInBattle();
308 hiPotion.GetTargetingMode().TargetSingleAlly();
309 inventory.Add(&hiPotion, 4);
311 powerPotion.SetName("Power potion");
312 powerPotion.SetMenuIcon(&potionIcon);
313 inventory.Add(&powerPotion, 4);
315 escape.SetName("Escape");
316 inventory.Add(&escape, 2);
318 sleepBall.SetName("Sleep ball");
319 sleepBall.SetMenuIcon(&ballIcon);
320 sleepBall.SetUsableInBattle();
321 sleepBall.GetTargetingMode().TargetSingleEnemy();
322 inventory.Add(&sleepBall, 1);
324 multiBall.SetName("Multi-ball!");
325 multiBall.SetMenuIcon(&ballIcon);
326 multiBall.SetUsableInBattle();
327 multiBall.GetTargetingMode().TargetMultipleEnemies();
328 inventory.Add(&multiBall, 1);
330 figgoru.SetName("Figgoru");
331 figgoru.SetMenuIcon(&crankIcon);
332 figgoru.GetTargetingMode().TargetAllEnemies();
333 inventory.Add(&figgoru, 1);
334 battleRes.inventory = &inventory;
336 battleRes.itemMenuHeadline = "Please choose an item.";
337 battleRes.itemMenuPrototype = Menu<const common::Item *>(&normalFont, &disabledFont, &handCursorSprite, 15, 6, 8, 16, 1, 32, 2, ':');
339 SDL_Surface *swordAttackImg(IMG_Load("test-data/attack-sword.png"));
340 Sprite swordAttackSprite(swordAttackImg, 96, 96);
341 SimpleAnimation swordAttackAnimation(&swordAttackSprite, 2 * framerate, 4);
344 zircoSword.SetName("Zirco sword");
345 zircoSword.SetMenuIcon(&swordIcon);
346 zircoSword.GetTargetingMode().TargetSingleEnemy();
348 firestorm.SetName("Firestorm");
349 firestorm.SetCost(224);
350 firestorm.GetTargetingMode().TargetAllEnemies();
351 firestorm.SetPhysical();
352 zircoSword.SetIkari(&firestorm);
353 zircoSword.SetAttackAnimation(&swordAttackAnimation);
354 maxim.SetWeapon(&zircoSword);
356 zirconArmor.SetName("Zircon armor");
357 zirconArmor.SetMenuIcon(&armorIcon);
359 magicCure.SetName("Magic cure");
360 magicCure.SetCost(128);
361 magicCure.GetTargetingMode().TargetSingleAlly();
362 magicCure.SetMagical();
363 zirconArmor.SetIkari(&magicCure);
364 maxim.SetArmor(&zirconArmor);
366 holyShield.SetName("Holy shield");
367 holyShield.SetMenuIcon(&shieldIcon);
369 lightGuard.SetName("Light guard");
370 lightGuard.SetCost(128);
371 lightGuard.GetTargetingMode().TargetAllAllies(); // actually only targets self
372 lightGuard.SetMagical();
373 holyShield.SetIkari(&lightGuard);
374 maxim.SetShield(&holyShield);
376 legendHelm.SetName("Legend helm");
377 legendHelm.SetMenuIcon(&helmetIcon);
379 boomerang.SetName("Boomerang");
380 boomerang.SetCost(164);
381 boomerang.GetTargetingMode().TargetAllAllies(); // actually only targets self
382 boomerang.SetMagical();
383 legendHelm.SetIkari(&boomerang);
384 maxim.SetHelmet(&legendHelm);
386 sProRing.SetName("S-pro ring");
387 sProRing.SetMenuIcon(&ringIcon);
389 courage.SetName("Courage");
391 courage.GetTargetingMode().TargetMultipleAllies();
392 courage.SetMagical();
393 sProRing.SetIkari(&courage);
394 maxim.SetRing(&sProRing);
396 evilJewel.SetName("Evil jewel");
397 evilJewel.SetMenuIcon(&jewelIcon);
399 gloomy.SetName("Gloomy");
401 gloomy.GetTargetingMode().TargetAllEnemies();
403 evilJewel.SetIkari(&gloomy);
404 maxim.SetJewel(&evilJewel);
407 zircoWhip.SetName("Zirco whip");
408 zircoWhip.SetMenuIcon(&rodIcon);
409 zircoWhip.GetTargetingMode().TargetSingleEnemy();
411 thundershriek.SetName("Thundershriek");
412 thundershriek.SetCost(224);
413 thundershriek.GetTargetingMode().TargetAllEnemies();
414 thundershriek.SetPhysical();
415 zircoWhip.SetIkari(&thundershriek);
416 // selan.SetWeapon(&zircoWhip);
418 zirconPlate.SetName("Zircon plate");
419 zirconPlate.SetMenuIcon(&armorIcon);
421 suddenCure.SetName("Sudden cure");
422 suddenCure.SetCost(96);
423 suddenCure.GetTargetingMode().TargetAllAllies();
424 suddenCure.SetMagical();
425 zirconPlate.SetIkari(&suddenCure);
426 selan.SetArmor(&zirconPlate);
428 zircoGloves.SetName("Zirco gloves");
429 zircoGloves.SetMenuIcon(&shieldIcon);
431 forcefield.SetName("Forcefield");
432 forcefield.SetCost(64);
433 forcefield.GetTargetingMode().TargetAllAllies();
434 forcefield.SetMagical();
435 zircoGloves.SetIkari(&forcefield);
436 selan.SetShield(&zircoGloves);
438 holyCap.SetName("Holy cap");
439 holyCap.SetMenuIcon(&helmetIcon);
441 vulnerable.SetName("Vulnerable");
442 vulnerable.SetCost(196);
443 vulnerable.GetTargetingMode().TargetAllEnemies();
444 vulnerable.SetPhysical();
445 holyCap.SetIkari(&vulnerable);
446 selan.SetHelmet(&holyCap);
448 ghostRing.SetName("Ghost ring");
449 ghostRing.SetMenuIcon(&ringIcon);
451 destroy.SetName("Destroy");
452 destroy.SetCost(128);
453 destroy.GetTargetingMode().TargetMultipleEnemies();
454 destroy.SetMagical();
455 ghostRing.SetIkari(&destroy);
456 selan.SetRing(&ghostRing);
458 eagleRock.SetName("Eagle rock");
459 eagleRock.SetMenuIcon(&jewelIcon);
461 dive.SetName("Dive");
463 dive.GetTargetingMode().TargetSingleEnemy();
465 eagleRock.SetIkari(&dive);
466 selan.SetJewel(&eagleRock);
469 zircoAx.SetName("Zirco ax");
470 zircoAx.SetMenuIcon(&axIcon);
471 zircoAx.GetTargetingMode().TargetSingleEnemy();
473 torrent.SetName("Torrent");
474 torrent.SetCost(224);
475 torrent.GetTargetingMode().TargetAllEnemies();
476 torrent.SetPhysical();
477 zircoAx.SetIkari(&torrent);
478 // guy.SetWeapon(&zircoAx);
479 guy.SetArmor(&zirconArmor);
481 megaShield.SetName("Mega shield");
482 megaShield.SetMenuIcon(&shieldIcon);
484 ironBarrier.SetName("Iron barrier");
485 ironBarrier.SetCost(255);
486 ironBarrier.GetTargetingMode().TargetAllAllies(); // actually only targets self
487 ironBarrier.SetMagical();
488 megaShield.SetIkari(&ironBarrier);
489 guy.SetShield(&megaShield);
491 zircoHelmet.SetName("Zirco helmet");
492 zircoHelmet.SetMenuIcon(&helmetIcon);
494 slow.SetName("Slow");
496 slow.GetTargetingMode().TargetAllEnemies();
498 zircoHelmet.SetIkari(&slow);
499 guy.SetHelmet(&zircoHelmet);
501 powerRing.SetName("Power ring");
502 powerRing.SetMenuIcon(&ringIcon);
504 trick.SetName("Trick");
506 trick.GetTargetingMode().TargetAllEnemies();
508 zircoHelmet.SetIkari(&trick);
509 guy.SetRing(&powerRing);
510 guy.SetJewel(&evilJewel);
512 // NOTE: this is actually Artea equipment
514 lizardBlow.SetName("Lizard blow");
515 lizardBlow.SetMenuIcon(&swordIcon);
516 lizardBlow.GetTargetingMode().TargetSingleEnemy();
518 dragonRush.SetName("Dragon rush");
519 dragonRush.SetCost(164);
520 dragonRush.GetTargetingMode().TargetSingleEnemy();
521 dragonRush.SetPhysical();
522 lizardBlow.SetIkari(&dragonRush);
523 // dekar.SetWeapon(&lizardBlow);
525 holyRobe.SetName("Holy robe");
526 holyRobe.SetMenuIcon(&armorIcon);
528 crisisCure.SetName("Crisis cure");
529 crisisCure.SetCost(164);
530 crisisCure.GetTargetingMode().TargetAllAllies();
531 crisisCure.SetMagical();
532 holyRobe.SetIkari(&crisisCure);
533 dekar.SetArmor(&holyRobe);
534 dekar.SetShield(&zircoGloves);
535 dekar.SetHelmet(&holyCap);
537 rocketRing.SetName("Rocket ring");
538 rocketRing.SetMenuIcon(&ringIcon);
540 fake.SetName("Fake");
542 fake.GetTargetingMode().TargetSingleAlly();
544 rocketRing.SetIkari(&fake);
545 dekar.SetRing(&rocketRing);
547 krakenRock.SetName("Kraken rock");
548 krakenRock.SetMenuIcon(&jewelIcon);
550 tenLegger.SetName("Ten-legger");
551 tenLegger.SetCost(164);
552 tenLegger.GetTargetingMode().TargetAllEnemies();
553 tenLegger.SetPhysical();
554 rocketRing.SetIkari(&tenLegger);
555 dekar.SetJewel(&krakenRock);
557 battleRes.ikariMenuHeadline = "Please choose equipment.";
558 battleRes.noEquipmentText = "No equip";
559 battleRes.ikariMenuPrototype = Menu<const Item *>(&normalFont, &disabledFont, &handCursorSprite, 12, 6, normalFont.CharHeight() / 2, normalFont.CharWidth(), 1, normalFont.CharWidth() * 2, 0, ':', 12, normalFont.CharWidth());
561 battleRes.escapeText = "Escapes.";
563 BattleState *battleState(new BattleState(bg, monstersLayout, heroesLayout, &battleRes));
564 battleState->AddMonster(monster);
565 battleState->AddMonster(monster);
566 battleState->AddMonster(monster);
567 battleState->AddMonster(monster);
568 battleState->AddHero(maxim);
569 battleState->AddHero(selan);
570 battleState->AddHero(guy);
571 battleState->AddHero(dekar);
572 Application app(&screen, battleState);
573 app.Buttons().MapKey(SDLK_w, Input::PAD_UP);
574 app.Buttons().MapKey(SDLK_d, Input::PAD_RIGHT);
575 app.Buttons().MapKey(SDLK_s, Input::PAD_DOWN);
576 app.Buttons().MapKey(SDLK_a, Input::PAD_LEFT);
577 app.Buttons().MapKey(SDLK_RIGHT, Input::ACTION_A);
578 app.Buttons().MapKey(SDLK_DOWN, Input::ACTION_B);
579 app.Buttons().MapKey(SDLK_UP, Input::ACTION_X);
580 app.Buttons().MapKey(SDLK_LEFT, Input::ACTION_Y);
581 app.Buttons().MapKey(SDLK_RETURN, Input::START);
582 app.Buttons().MapKey(SDLK_SPACE, Input::SELECT);
583 app.Buttons().MapKey(SDLK_RSHIFT, Input::SHOULDER_RIGHT);
584 app.Buttons().MapKey(SDLK_LSHIFT, Input::SHOULDER_LEFT);
588 } catch (Parser::Error &e) {
589 cerr << "parsing exception in file " << e.File() << " on line " << e.Line() << ": " << e.what() << endl;
591 } catch (exception &e) {
592 cerr << "exception in main(): " << e.what() << endl;