]> git.localhorst.tv Git - l2e.git/commitdiff
added frames for status menu
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Sun, 21 Oct 2012 18:01:09 +0000 (20:01 +0200)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Sun, 21 Oct 2012 18:01:09 +0000 (20:01 +0200)
src/main.cpp
src/menu/PartyMenu.cpp
src/menu/PartyMenu.h
src/menu/Resources.h
test-data/status-frame.png [new file with mode: 0644]

index b06b5c7533b1e463460461bafe613af016acf743..075ce1e0bb5861e534bfedb722768a3ea18f502a 100644 (file)
@@ -86,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;
 
@@ -284,6 +284,9 @@ int main(int argc, char **argv) {
                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;
+
                InitScreen screen(width, height);
 
                app::State *state(0);
index f230358b1de4c1e1c6fdd20ab61c6efb51ffb0ca..4949bfaa73453a546062bf121de197f287794077 100644 (file)
@@ -14,6 +14,7 @@
 #include "../common/GameState.h"
 #include "../geometry/Vector.h"
 #include "../graphics/Font.h"
+#include "../graphics/Frame.h"
 #include "../graphics/Texture.h"
 
 using app::Input;
@@ -73,7 +74,9 @@ void PartyMenu::UpdateWorld(float deltaT) {
 
 void PartyMenu::Render(SDL_Surface *screen) {
        Res().menubg->Render(screen, Vector<int>(), Vector<int>(screen->w, screen->h));
-       RenderHeros(screen, Vector<int>());
+       RenderHeros(screen, Vector<int>(Res().normalFont->CharWidth(), 2 * Res().normalFont->CharHeight()));
+       RenderMenu(screen, Vector<int>(8 * Res().normalFont->CharWidth(), 13 * Res().normalFont->CharHeight() + Res().normalFont->CharHeight() / 8));
+       RenderInfo(screen, Vector<int>(14 * Res().normalFont->CharWidth(), 21 * Res().normalFont->CharHeight() + Res().normalFont->CharHeight() / 8));
 }
 
 void PartyMenu::RenderHeros(SDL_Surface *screen, const geometry::Vector<int> &offset) const {
@@ -82,6 +85,14 @@ void PartyMenu::RenderHeros(SDL_Surface *screen, const geometry::Vector<int> &of
        }
 }
 
+void PartyMenu::RenderMenu(SDL_Surface *screen, const geometry::Vector<int> &offset) const {
+       Res().statusFrame->Draw(screen, offset, 23 * Res().normalFont->CharWidth(), 8 * Res().normalFont->CharHeight());
+}
+
+void PartyMenu::RenderInfo(SDL_Surface *screen, const geometry::Vector<int> &offset) const {
+       Res().statusFrame->Draw(screen, offset, 17 * Res().normalFont->CharWidth(), 5 * Res().normalFont->CharHeight());
+}
+
 
 Resources &PartyMenu::Res() {
        return *game->menuResources;
index 2172bfccc536e40bb339a052322857d21267f630..aabc2060bf55616968c843a0ff21eb24abf6eb44 100644 (file)
@@ -41,6 +41,8 @@ private:
        virtual void OnResize(int width, int height);
 
        void RenderHeros(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
+       void RenderMenu(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
+       void RenderInfo(SDL_Surface *screen, const geometry::Vector<int> &offset) const;
 
 private:
        HeroStatus status[4];
index bc6f2041a3b8779b4674a8a0c48668a169681e25..c65a7cb478af85d9b7f12d1367fe2b70cfd3602b 100644 (file)
@@ -20,6 +20,8 @@ struct Resources {
 
        graphics::Sprite *statusLabels;
 
+       graphics::Frame *statusFrame;
+
        Resources();
 
 };
diff --git a/test-data/status-frame.png b/test-data/status-frame.png
new file mode 100644 (file)
index 0000000..c6ea569
Binary files /dev/null and b/test-data/status-frame.png differ