X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmain.cpp;h=71a29e58292b0f889661cd691db808d250226d19;hb=0f5f8a6eaa938f88fd3d1e92dec2462b30840e21;hp=14a6336f014df0d2028d3124f2699ca9a2af64b1;hpb=d4609ba1798d82cce128b5985d60cb212b760246;p=l2e.git diff --git a/src/main.cpp b/src/main.cpp index 14a6336..71a29e5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -30,6 +30,8 @@ #include "sdl/InitScreen.h" #include "sdl/InitSDL.h" +#include +#include #include #include #include @@ -70,6 +72,8 @@ int main(int argc, char **argv) { const int framerate = 33; +// std::srand(std::time(0)); + try { InitSDL sdl; InitImage image(IMG_INIT_PNG); @@ -99,9 +103,9 @@ int main(int argc, char **argv) { monster.SetStats(Stats(14, 6, 6, 6, 6, 6, 6)); monster.SetReward(3, 5); ComplexAnimation monsterAttackAnimation(&monsterSprite, 4 * framerate); - monsterAttackAnimation.AddFrame(0, 1, Vector(16, 0)); - monsterAttackAnimation.AddFrame(0, 0, Vector(16, 0)); - monsterAttackAnimation.AddFrame(0, 1, Vector(16, 0)); + monsterAttackAnimation.AddFrame(0, 1, Vector(0, 16)); + monsterAttackAnimation.AddFrame(0, 0, Vector(0, 16)); + monsterAttackAnimation.AddFrame(0, 1, Vector(0, 16)); monster.SetAttackAnimation(&monsterAttackAnimation); SDL_Surface *monsterMeleeImg(IMG_Load("test-data/attack-monster.png")); Sprite monsterMeleeSprite(monsterMeleeImg, 96, 64); @@ -263,29 +267,30 @@ int main(int argc, char **argv) { Font largeFont(&largeFontSprite, 0, -2); battleRes.titleFont = &largeFont; - battleRes.numberAnimationPrototype = ComplexAnimation(0, framerate); - battleRes.numberAnimationPrototype.AddFrame(0, 0); - battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector(0, -26)); - battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector(0, -42)); - battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector(0, -48)); - battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector(0, -42)); - battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector(0, -26)); - battleRes.numberAnimationPrototype.AddFrame(0, 0); - battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector(0, -12)); - battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector(0, -20)); - battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector(0, -24)); - battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector(0, -20)); - battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector(0, -12)); - battleRes.numberAnimationPrototype.AddFrame(0, 0); - battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector(0, -6)); - battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector(0, -10)); - battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector(0, -12)); - battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector(0, -10)); - battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector(0, -6)); - battleRes.numberAnimationPrototype.AddFrames(0, 0, Vector(), 14); - battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector(0, -36)); - battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector(0, -32)); - battleRes.numberAnimationPrototype.AddFrame(0, 0, Vector(0, -18)); + ComplexAnimation numberAnimationPrototype(0, framerate); + numberAnimationPrototype.AddFrame(0, 0); + numberAnimationPrototype.AddFrame(0, 0, Vector(0, -26)); + numberAnimationPrototype.AddFrame(0, 0, Vector(0, -42)); + numberAnimationPrototype.AddFrame(0, 0, Vector(0, -48)); + numberAnimationPrototype.AddFrame(0, 0, Vector(0, -42)); + numberAnimationPrototype.AddFrame(0, 0, Vector(0, -26)); + numberAnimationPrototype.AddFrame(0, 0); + numberAnimationPrototype.AddFrame(0, 0, Vector(0, -12)); + numberAnimationPrototype.AddFrame(0, 0, Vector(0, -20)); + numberAnimationPrototype.AddFrame(0, 0, Vector(0, -24)); + numberAnimationPrototype.AddFrame(0, 0, Vector(0, -20)); + numberAnimationPrototype.AddFrame(0, 0, Vector(0, -12)); + numberAnimationPrototype.AddFrame(0, 0); + numberAnimationPrototype.AddFrame(0, 0, Vector(0, -6)); + numberAnimationPrototype.AddFrame(0, 0, Vector(0, -10)); + numberAnimationPrototype.AddFrame(0, 0, Vector(0, -12)); + numberAnimationPrototype.AddFrame(0, 0, Vector(0, -10)); + numberAnimationPrototype.AddFrame(0, 0, Vector(0, -6)); + numberAnimationPrototype.AddFrames(0, 0, Vector(), 14); + numberAnimationPrototype.AddFrame(0, 0, Vector(0, -36)); + numberAnimationPrototype.AddFrame(0, 0, Vector(0, -32)); + numberAnimationPrototype.AddFrame(0, 0, Vector(0, -18)); + battleRes.numberAnimationPrototype = &numberAnimationPrototype; SDL_Surface *bigNumbersImg(IMG_Load("test-data/big-numbers.png")); Sprite bigNumbersSprite(bigNumbersImg, 16, 32); @@ -355,9 +360,7 @@ int main(int argc, char **argv) { Sprite magicTargetCursor(targetingIconsImg, 32, 32, 0, 32); Sprite itemTargetCursor(targetingIconsImg, 32, 32, 0, 64); battleRes.weaponTargetCursor = &weaponTargetCursor; - // TODO: add image for magic targeting cursor battleRes.magicTargetCursor = &magicTargetCursor; - // TODO: add image for item targeting cursor battleRes.itemTargetCursor = &itemTargetCursor; Spell resetSpell;