From: Daniel Karbach Date: Sun, 21 Oct 2012 18:01:09 +0000 (+0200) Subject: added frames for status menu X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=15b018d9915412a341e2064760fc915fc5bdbade;p=l2e.git added frames for status menu --- diff --git a/src/main.cpp b/src/main.cpp index b06b5c7..075ce1e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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); diff --git a/src/menu/PartyMenu.cpp b/src/menu/PartyMenu.cpp index f230358..4949bfa 100644 --- a/src/menu/PartyMenu.cpp +++ b/src/menu/PartyMenu.cpp @@ -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(), Vector(screen->w, screen->h)); - RenderHeros(screen, Vector()); + RenderHeros(screen, Vector(Res().normalFont->CharWidth(), 2 * Res().normalFont->CharHeight())); + RenderMenu(screen, Vector(8 * Res().normalFont->CharWidth(), 13 * Res().normalFont->CharHeight() + Res().normalFont->CharHeight() / 8)); + RenderInfo(screen, Vector(14 * Res().normalFont->CharWidth(), 21 * Res().normalFont->CharHeight() + Res().normalFont->CharHeight() / 8)); } void PartyMenu::RenderHeros(SDL_Surface *screen, const geometry::Vector &offset) const { @@ -82,6 +85,14 @@ void PartyMenu::RenderHeros(SDL_Surface *screen, const geometry::Vector &of } } +void PartyMenu::RenderMenu(SDL_Surface *screen, const geometry::Vector &offset) const { + Res().statusFrame->Draw(screen, offset, 23 * Res().normalFont->CharWidth(), 8 * Res().normalFont->CharHeight()); +} + +void PartyMenu::RenderInfo(SDL_Surface *screen, const geometry::Vector &offset) const { + Res().statusFrame->Draw(screen, offset, 17 * Res().normalFont->CharWidth(), 5 * Res().normalFont->CharHeight()); +} + Resources &PartyMenu::Res() { return *game->menuResources; diff --git a/src/menu/PartyMenu.h b/src/menu/PartyMenu.h index 2172bfc..aabc206 100644 --- a/src/menu/PartyMenu.h +++ b/src/menu/PartyMenu.h @@ -41,6 +41,8 @@ private: virtual void OnResize(int width, int height); void RenderHeros(SDL_Surface *screen, const geometry::Vector &offset) const; + void RenderMenu(SDL_Surface *screen, const geometry::Vector &offset) const; + void RenderInfo(SDL_Surface *screen, const geometry::Vector &offset) const; private: HeroStatus status[4]; diff --git a/src/menu/Resources.h b/src/menu/Resources.h index bc6f204..c65a7cb 100644 --- a/src/menu/Resources.h +++ b/src/menu/Resources.h @@ -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 index 0000000..c6ea569 Binary files /dev/null and b/test-data/status-frame.png differ