From 31883e0019783f10553ddcc122a49728934bd832 Mon Sep 17 00:00:00 2001 From: Daniel Karbach Date: Fri, 31 Aug 2012 21:00:48 +0200 Subject: [PATCH] moved some sprites to test.l2s --- src/main.cpp | 56 ++++++------------------------------ test-data/test.l2s | 72 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 47 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 90f08d5..1c87e33 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -103,18 +103,10 @@ int main(int argc, char **argv) { battle::Resources battleRes; - SDL_Surface *swapCursorImg(IMG_Load("test-data/swap-cursor.png")); - Sprite swapCursorSprite(swapCursorImg, 32, 32); - battleRes.swapCursor = &swapCursorSprite; - SDL_Surface *attackIconsImg(IMG_Load("test-data/attack-type-icons.png")); - Sprite attackIconsSprite(attackIconsImg, 32, 32); - battleRes.attackIcons = &attackIconsSprite; - SDL_Surface *attackChoiceIconsImg(IMG_Load("test-data/attack-choice-icons.png")); - Sprite attackChoiceIconsSprite(attackChoiceIconsImg, 16, 16); - battleRes.attackChoiceIcons = &attackChoiceIconsSprite; - SDL_Surface *moveIconsImg(IMG_Load("test-data/move-icons.png")); - Sprite moveIconsSprite(moveIconsImg, 32, 32); - battleRes.moveIcons = &moveIconsSprite; + battleRes.swapCursor = intp.GetSprite("swapCursor"); + battleRes.attackIcons = intp.GetSprite("attackIcons"); + battleRes.attackChoiceIcons = intp.GetSprite("attackChoiceIcons"); + battleRes.moveIcons = intp.GetSprite("moveIcons"); SDL_Surface *titleFrameImg(IMG_Load("test-data/title-frame.png")); Frame titleFrame(titleFrameImg, 16, 16); @@ -125,41 +117,11 @@ int main(int argc, char **argv) { Font largeFont(&largeFontSprite, 0, -2); battleRes.titleFont = &largeFont; - 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); - battleRes.bigNumberSprite = &bigNumbersSprite; - SDL_Surface *bigGreenNumbersImg(IMG_Load("test-data/big-green-numbers.png")); - Sprite bigGreenNumbersSprite(bigGreenNumbersImg, 16, 32); - battleRes.greenNumberSprite = &bigGreenNumbersSprite; - - SDL_Surface *heroTagImg(IMG_Load("test-data/hero-tag-sprites.png")); - Sprite heroTagSprite(heroTagImg, 32, 16); - battleRes.heroTagLabels = &heroTagSprite; + battleRes.numberAnimationPrototype = intp.GetAnimation("numberAnimationPrototype"); + battleRes.bigNumberSprite = intp.GetSprite("bigNumbers"); + battleRes.greenNumberSprite = intp.GetSprite("bigGreenNumbers"); + + battleRes.heroTagLabels = intp.GetSprite("heroTagLabels"); battleRes.levelLabelCol = 0; battleRes.levelLabelRow = 0; battleRes.healthLabelCol = 0; diff --git a/test-data/test.l2s b/test-data/test.l2s index b4ff641..36c119a 100644 --- a/test-data/test.l2s +++ b/test-data/test.l2s @@ -331,3 +331,75 @@ export Hero dekar { framecount: 4 } } + +export Sprite swapCursor { + image: "test-data/swap-cursor.png", + size: <32,32> +} +export Sprite attackIcons { + image: "test-data/attack-type-icons.png", + size: <32,32> +} +export Sprite attackChoiceIcons { + image: "test-data/attack-choice-icons.png", + size: <16,16> +} +export Sprite moveIcons { + image: "test-data/move-icons.png", + size: <32,32> +} + +export ComplexAnimation numberAnimationPrototype { + frametime: frameTime, + repeat: false, + frames: [ + { column: 0, row: 0, disposition: < 0, 0> }, + { column: 0, row: 0, disposition: < 0,-26> }, + { column: 0, row: 0, disposition: < 0,-42> }, + { column: 0, row: 0, disposition: < 0,-48> }, + { column: 0, row: 0, disposition: < 0,-42> }, + { column: 0, row: 0, disposition: < 0,-26> }, + { column: 0, row: 0, disposition: < 0, 0> }, + { column: 0, row: 0, disposition: < 0,-12> }, + { column: 0, row: 0, disposition: < 0,-20> }, + { column: 0, row: 0, disposition: < 0,-24> }, + { column: 0, row: 0, disposition: < 0,-20> }, + { column: 0, row: 0, disposition: < 0,-12> }, + { column: 0, row: 0, disposition: < 0, 0> }, + { column: 0, row: 0, disposition: < 0, -6> }, + { column: 0, row: 0, disposition: < 0,-10> }, + { column: 0, row: 0, disposition: < 0,-12> }, + { column: 0, row: 0, disposition: < 0,-10> }, + { column: 0, row: 0, disposition: < 0, -6> }, + { column: 0, row: 0, disposition: < 0, 0> }, + { column: 0, row: 0, disposition: < 0, 0> }, + { column: 0, row: 0, disposition: < 0, 0> }, + { column: 0, row: 0, disposition: < 0, 0> }, + { column: 0, row: 0, disposition: < 0, 0> }, + { column: 0, row: 0, disposition: < 0, 0> }, + { column: 0, row: 0, disposition: < 0, 0> }, + { column: 0, row: 0, disposition: < 0, 0> }, + { column: 0, row: 0, disposition: < 0, 0> }, + { column: 0, row: 0, disposition: < 0, 0> }, + { column: 0, row: 0, disposition: < 0, 0> }, + { column: 0, row: 0, disposition: < 0, 0> }, + { column: 0, row: 0, disposition: < 0, 0> }, + { column: 0, row: 0, disposition: < 0, 0> }, + { column: 0, row: 0, disposition: < 0,-36> }, + { column: 0, row: 0, disposition: < 0,-32> }, + { column: 0, row: 0, disposition: < 0,-18> } + ] +} +export Sprite bigNumbers { + image: "test-data/big-numbers.png", + size: <16,32> +} +export Sprite bigGreenNumbers { + image: "test-data/big-green-numbers.png", + size: <16,32> +} + +export Sprite heroTagLabels { + image: "test-data/hero-tag-sprites.png", + size: <32,16> +} -- 2.39.2