X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmain.cpp;h=9a68807f5aeac2de0bc75d304a22a7c3b706ccce;hb=167fe3525cd1c29cbe1a23e3b14e2a1f2774835c;hp=29c08a5fbda46a2ea20acd511af27761c0db3add;hpb=b6502719f0f02bdb4fc39aa66fa4a369ea583036;p=l2e.git diff --git a/src/main.cpp b/src/main.cpp index 29c08a5..9a68807 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -16,6 +16,7 @@ #include "graphics/Font.h" #include "graphics/Frame.h" #include "graphics/Gauge.h" +#include "graphics/Menu.h" #include "graphics/Sprite.h" #include "sdl/InitImage.h" #include "sdl/InitScreen.h" @@ -36,6 +37,7 @@ using geometry::Point; using graphics::Font; using graphics::Frame; using graphics::Gauge; +using graphics::Menu; using graphics::Sprite; using sdl::InitImage; using sdl::InitScreen; @@ -154,6 +156,39 @@ int main(int argc, char **argv) { Frame selectFrame(selectFrameImg, 16, 16); battleRes.selectFrame = &selectFrame; + SDL_Surface *normalFontImg(IMG_Load("test-data/normal-font.png")); + Sprite normalFontSprite(normalFontImg, 16, 16); + Font normalFont(&normalFontSprite); + normalFont.MapRange('A', 'M', 0, 1); + normalFont.MapRange('N', 'Z', 0, 2); + normalFont.MapRange('a', 'm', 0, 3); + normalFont.MapRange('n', 'z', 0, 4); + normalFont.MapChar(':', 10, 0); + normalFont.MapChar('!', 10, 0); + normalFont.MapChar('?', 10, 0); + // TODO: add '.' character + battleRes.normalFont = &normalFont; + + SDL_Surface *disabledFontImg(IMG_Load("test-data/disabled-font.png")); + Sprite disabledFontSprite(disabledFontImg, 16, 16); + Font disabledFont(&disabledFontSprite); + disabledFont.MapRange('A', 'M', 0, 1); + disabledFont.MapRange('N', 'Z', 0, 2); + disabledFont.MapRange('a', 'm', 0, 3); + disabledFont.MapRange('n', 'z', 0, 4); + disabledFont.MapChar(':', 10, 0); + disabledFont.MapChar('!', 10, 0); + disabledFont.MapChar('?', 10, 0); + // TODO: add '.' character + battleRes.disabledFont = &disabledFont; + + SDL_Surface *handCursorImg(IMG_Load("test-data/cursor-hand.png")); + Sprite handCursorSprite(handCursorImg, 32, 32); + battleRes.menuCursor = &handCursorSprite; + + battleRes.spellMenuHeadline = "Please choose a spell."; + battleRes.spellMenuPrototype = Menu(&normalFont, &disabledFont, &handCursorSprite, 12, 6, 8, 2, 32); + BattleState *battleState(new BattleState(bg, monstersLayout, heroesLayout, &battleRes)); battleState->AddMonster(monster); battleState->AddMonster(monster);