From 15b018d9915412a341e2064760fc915fc5bdbade Mon Sep 17 00:00:00 2001 From: Daniel Karbach Date: Sun, 21 Oct 2012 20:01:09 +0200 Subject: [PATCH] added frames for status menu --- src/main.cpp | 7 +++++-- src/menu/PartyMenu.cpp | 13 ++++++++++++- src/menu/PartyMenu.h | 2 ++ src/menu/Resources.h | 2 ++ test-data/status-frame.png | Bin 0 -> 798 bytes 5 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 test-data/status-frame.png 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 0000000000000000000000000000000000000000..c6ea56925876c1d72a1286846a077a872bf5f003 GIT binary patch literal 798 zcmV+(1L6FMP)i)a1i@O}^xkzpAAex@WMBHeb|v;(F0(d!hY{i1 z71W^vn(6=x7!a)rLIDIb4nNnMArfKDe3b$yM-sj zJ-o+z=L(|(g6jagX5lfx^8ilN9`}52o?$?=D#$wxRA2Xwr{z2~IVa22dbU@U=~?Zi z?d|*Ox!!nc$ImxnL9yBIUVcPG4)2HYHH^mJ3zXjHYHg~pU$yO8jZc|y{5ZmZPz(Ue c00u0KUq`*Dy5r2th5!Hn07*qoM6N<$f-$gN&Hw-a literal 0 HcmV?d00001 -- 2.39.2