X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmain.cpp;h=69b4e870b40aadbec2c059130ff1b39f74fb9b9a;hb=9429393ba3d875a12049dc9efeb4720fd9583e23;hp=0a69788469f171c3ecfa70bf2c2923ea7bfc4fdd;hpb=d1e76d7a2834c8441a11c70ff1dea66fee6be6c6;p=l2e.git diff --git a/src/main.cpp b/src/main.cpp index 0a69788..69b4e87 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; @@ -100,8 +86,8 @@ using std::string; using std::vector; int main(int argc, char **argv) { - const int width = 800; - const int height = 480; + const int width = 512; + const int height = 448; const float walkSpeed = 128.0f; @@ -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); @@ -200,6 +191,7 @@ int main(int argc, char **argv) { gameState.party[1] = &gameState.heroes[1]; gameState.party[2] = &gameState.heroes[2]; gameState.party[3] = &gameState.heroes[3]; + gameState.partySize = 4; GameConfig gameConfig; gameConfig.state = &gameState; @@ -280,6 +272,74 @@ 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.statusFont = gameConfig.battleResources->normalFont; + + graphics::Sprite statusLabels(IMG_Load("test-data/status-labels.png"), 32, 16); + menuResources.statusLabels = &statusLabels; + + graphics::Frame statusFrame(IMG_Load("test-data/status-frame.png"), 32, 32, 32, 32); + menuResources.statusFrame = &statusFrame; + + graphics::Sprite menuFontSprite(IMG_Load("test-data/menu-font.png"), 16, 16); + graphics::Font menuFont(&menuFontSprite, 0, -2); + + menuResources.normalFont = &menuFont; + + graphics::Sprite menuCursor(IMG_Load("test-data/menu-cursor.png"), 32, 16); + + graphics::MenuProperties mainMenuProperties; + mainMenuProperties.cols = 2; + mainMenuProperties.rows = 4; + mainMenuProperties.charsPerEntry = 8; + mainMenuProperties.rowGap = 8; + mainMenuProperties.colGap = 32; + mainMenuProperties.cursor = &menuCursor; + mainMenuProperties.font = &menuFont; + mainMenuProperties.wrapX = true; + mainMenuProperties.wrapY = true; + menuResources.mainMenuProperties = &mainMenuProperties; + + menuResources.mainMenuItemText = "ITEM"; + menuResources.mainMenuSpellText = "SPELL"; + menuResources.mainMenuCapsuleText = "CAPSULE"; + menuResources.mainMenuEquipmentText = "EQUIP"; + menuResources.mainMenuStatusText = "STATUS"; + menuResources.mainMenuChangeText = "CHANGE"; + menuResources.mainMenuConfigText = "CONFIG"; + menuResources.mainMenuScenarioText = "SCENARIO"; + + menuResources.mainMenuTimeText = "TIME"; + menuResources.mainMenuGoldText = "GOLD"; + + graphics::Sprite heroCursor(IMG_Load("test-data/hero-cursor.png"), 64, 16); + menuResources.heroCursor = &heroCursor; + menuResources.heroCursorBlinkTime = 532; + + menuResources.noEquipmentText = "No equip"; + + graphics::Sprite shoulderNav(IMG_Load("test-data/shoulder-nav.png"), 160, 16); + menuResources.shoulderNav = &shoulderNav; + + menuResources.atpLabel = "ATP"; + menuResources.dfpLabel = "DFP"; + menuResources.strLabel = "STR"; + menuResources.aglLabel = "AGL"; + menuResources.intLabel = "INT"; + menuResources.gutLabel = "GUT"; + menuResources.mgrLabel = "MGR"; + + menuResources.ipLabel = "IP"; + menuResources.experienceLabel = "NOW EXP"; + menuResources.nextLevelLabel = "NEXT LEVEL"; + InitScreen screen(width, height); app::State *state(0);