]> git.localhorst.tv Git - l2e.git/blobdiff - src/main.cpp
added experience display in status screen
[l2e.git] / src / main.cpp
index 40b38f1bb98dd6d3d3f71844cc428e66150aaff1..69b4e870b40aadbec2c059130ff1b39f74fb9b9a 100644 (file)
@@ -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);
@@ -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");
@@ -206,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;
@@ -286,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<int>(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);
@@ -310,7 +364,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);