X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmain.cpp;h=b06b5c7533b1e463460461bafe613af016acf743;hb=57a75f13e98f4b5d311c2d3b9d9ff637120c5ee2;hp=40b38f1bb98dd6d3d3f71844cc428e66150aaff1;hpb=7c43158af1abf38fa896a442cb3c6d8a5bc630e7;p=l2e.git diff --git a/src/main.cpp b/src/main.cpp index 40b38f1..b06b5c7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -30,6 +30,7 @@ #include "graphics/Menu.h" #include "graphics/SimpleAnimation.h" #include "graphics/Sprite.h" +#include "graphics/Texture.h" #include "loader/Caster.h" #include "loader/Interpreter.h" #include "loader/ParsedSource.h" @@ -41,6 +42,7 @@ #include "map/MapState.h" #include "map/Tile.h" #include "map/Trigger.h" +#include "menu/Resources.h" #include "sdl/InitImage.h" #include "sdl/InitScreen.h" #include "sdl/InitSDL.h" @@ -62,32 +64,16 @@ using battle::Monster; using battle::PartyLayout; using common::GameConfig; using common::GameState; -using common::Hero; -using common::Ikari; -using common::Inventory; -using common::Item; -using common::Script; using common::Spell; -using common::Stats; using geometry::Vector; -using graphics::ComplexAnimation; -using graphics::Font; -using graphics::Frame; -using graphics::Gauge; -using graphics::Menu; -using graphics::SimpleAnimation; -using graphics::Sprite; +using graphics::Texture; using loader::Caster; using loader::Interpreter; using loader::ParsedSource; using loader::Parser; using loader::TypeDescription; -using map::Area; using map::Entity; -using map::Map; using map::MapState; -using map::Tile; -using map::Trigger; using sdl::InitImage; using sdl::InitScreen; using sdl::InitSDL; @@ -113,28 +99,33 @@ int main(int argc, char **argv) { InitSDL sdl; InitImage image(IMG_INIT_PNG); - Area::CreateTypeDescription(); - battle::Resources::CreateTypeDescription(); - ComplexAnimation::CreateTypeDescription(); - Font::CreateTypeDescription(); - Frame::CreateTypeDescription(); - Gauge::CreateTypeDescription(); - Hero::CreateTypeDescription(); - Ikari::CreateTypeDescription(); Interpreter::CreateTypeDescriptions(); - Item::CreateTypeDescription(); - Map::CreateTypeDescription(); - graphics::MenuProperties::CreateTypeDescription(); - Monster::CreateTypeDescription(); - PartyLayout::CreateTypeDescription(); - SimpleAnimation::CreateTypeDescription(); - Spell::CreateTypeDescription(); - Sprite::CreateTypeDescription(); - Stats::CreateTypeDescription(); + + battle::Resources::CreateTypeDescription(); + battle::Monster::CreateTypeDescription(); + battle::PartyLayout::CreateTypeDescription(); + + common::Hero::CreateTypeDescription(); + common::Ikari::CreateTypeDescription(); + common::Item::CreateTypeDescription(); + common::Stats::CreateTypeDescription(); + common::Spell::CreateTypeDescription(); common::TargetingMode::CreateTypeDescription(); - Tile::CreateTypeDescription(); - Trigger::CreateTypeDescription(); - Entity::CreateTypeDescription(); + + graphics::Animation::CreateTypeDescription(); + graphics::ComplexAnimation::CreateTypeDescription(); + graphics::Font::CreateTypeDescription(); + graphics::Frame::CreateTypeDescription(); + graphics::Gauge::CreateTypeDescription(); + graphics::MenuProperties::CreateTypeDescription(); + graphics::SimpleAnimation::CreateTypeDescription(); + graphics::Sprite::CreateTypeDescription(); + + map::Area::CreateTypeDescription(); + map::Entity::CreateTypeDescription(); + map::Map::CreateTypeDescription(); + map::Tile::CreateTypeDescription(); + map::Trigger::CreateTypeDescription(); Arguments args; args.Read(argc, argv); @@ -189,12 +180,6 @@ int main(int argc, char **argv) { Caster caster(intp); - { - Map *map1(caster.GetMap("map1")); - Map *map2(caster.GetMap("map2")); - std::cout << map1 << ' ' << map2 << std::endl; - } - GameState gameState; gameState.heroes[0] = *caster.GetHero("maxim"); @@ -286,6 +271,19 @@ int main(int argc, char **argv) { gameState.heroes[3].MapEntity().SetFlags(Entity::FLAG_NONBLOCKING); gameState.heroes[2].MapEntity().AddFollower(&gameState.heroes[3].MapEntity()); + menu::Resources menuResources; + gameConfig.menuResources = &menuResources; + + Texture menubg; + menubg.SetSurface(IMG_Load("test-data/menubg.png")); + menubg.SetSize(Vector(64, 64)); + menuResources.menubg = &menubg; + + menuResources.normalFont = gameConfig.battleResources->normalFont; + + graphics::Sprite statusLabels(IMG_Load("test-data/status-labels.png"), 32, 16); + menuResources.statusLabels = &statusLabels; + InitScreen screen(width, height); app::State *state(0); @@ -310,7 +308,7 @@ int main(int argc, char **argv) { state = mapState; } - Application app(&screen, state); + Application app(screen, state); app.Buttons().MapKey(SDLK_w, Input::PAD_UP); app.Buttons().MapKey(SDLK_d, Input::PAD_RIGHT); app.Buttons().MapKey(SDLK_s, Input::PAD_DOWN);