From 343713021629697bb22e41c64016c03e2d01ce61 Mon Sep 17 00:00:00 2001 From: Rtch90 <ritchie.cunningham@protonmail.com> Date: Sun, 18 Dec 2011 21:37:57 +0000 Subject: [PATCH] [Cleanup] Just a tad bit of cleaning, not been productive today. --- src/libUnuk/Button.cpp | 12 +++++++++++- src/libUnuk/Button.h | 2 ++ src/libUnuk/IngameMenu.cpp | 10 +++++----- src/libUnuk/MainMenu.h | 3 ++- src/libUnuk/MapEntities.h | 6 ++++++ src/libUnuk/Text.h | 3 ++- src/libUnuk/TextureManager.h | 15 ++++++++------- 7 files changed, 36 insertions(+), 15 deletions(-) diff --git a/src/libUnuk/Button.cpp b/src/libUnuk/Button.cpp index f486ae1..3147212 100644 --- a/src/libUnuk/Button.cpp +++ b/src/libUnuk/Button.cpp @@ -71,11 +71,21 @@ bool Button::CheckMouseOver(void) { } void Button::Render(void) { + button.Draw(); + _text.Render(); +} + +void Button::Render(int xArg, int yArg) { + button.Draw(xArg, yArg); + _text.Render(xArg, yArg); +} + +void Button::RenderLiteral(void) { button.DrawLiteral(); _text.RenderLiteral(); } -void Button::Render(int xArg, int yArg) { +void Button::RenderLiteral(int xArg, int yArg) { button.DrawLiteral(xArg, yArg); _text.RenderLiteral(xArg, yArg); } diff --git a/src/libUnuk/Button.h b/src/libUnuk/Button.h index 752b929..9b83098 100644 --- a/src/libUnuk/Button.h +++ b/src/libUnuk/Button.h @@ -33,6 +33,8 @@ public: void Render(void); void Render(int xArg, int yArg); + void RenderLiteral(void); + void RenderLiteral(int xArg, int yArg); private: SDL_Color _mouseOutColour; diff --git a/src/libUnuk/IngameMenu.cpp b/src/libUnuk/IngameMenu.cpp index f7e887e..bd71a9d 100644 --- a/src/libUnuk/IngameMenu.cpp +++ b/src/libUnuk/IngameMenu.cpp @@ -7,31 +7,31 @@ IngameMenu::IngameMenu(void) { btnResume.SetOverRGB(255, 255, 255); btnResume.SetTextRGB(0, 0, 0); btnResume.SetText("Resume Game"); - btnResume.SetXY((SCREEN_WIDTH / 2) - (btnResume.GetWidth() / 2), 50); + btnResume.SetXY(SCREEN_WIDTH / 2 - btnResume.GetWidth() / 2, 50); btnSaveGame.SetOutRGB(200, 200, 200); btnSaveGame.SetOverRGB(255, 255, 255); btnSaveGame.SetTextRGB(0, 0, 0); btnSaveGame.SetText("SaveGame"); - btnSaveGame.SetXY((SCREEN_WIDTH / 2) - (btnSaveGame.GetWidth() / 2), 100); + btnSaveGame.SetXY(SCREEN_WIDTH / 2 - btnSaveGame.GetWidth() / 2, 100); btnLoadGame.SetOutRGB(200, 200, 200); btnLoadGame.SetOverRGB(255, 255, 255); btnLoadGame.SetTextRGB(0, 0, 0); btnLoadGame.SetText("LoadGame"); - btnLoadGame.SetXY((SCREEN_WIDTH / 2) - (btnLoadGame.GetWidth() / 2), 150); + btnLoadGame.SetXY(SCREEN_WIDTH / 2 - btnLoadGame.GetWidth() / 2, 150); btnOptions.SetOutRGB(200, 200, 200); btnOptions.SetOverRGB(255, 255, 255); btnOptions.SetTextRGB(0, 0, 0); btnOptions.SetText("Options"); - btnOptions.SetXY((SCREEN_WIDTH / 2) - (btnOptions.GetWidth() / 2), 200); + btnOptions.SetXY(SCREEN_WIDTH / 2 - btnOptions.GetWidth() / 2, 200); btnExitToMenu.SetOutRGB(200, 200, 200); btnExitToMenu.SetOverRGB(255, 255, 255); btnExitToMenu.SetTextRGB(0, 0, 0); btnExitToMenu.SetText("Exit To Main Menu"); - btnExitToMenu.SetXY((SCREEN_WIDTH / 2) - (btnExitToMenu.GetWidth() / 2), 250); + btnExitToMenu.SetXY(SCREEN_WIDTH / 2 - btnExitToMenu.GetWidth() / 2, 250); } IngameMenu::~IngameMenu(void) { diff --git a/src/libUnuk/MainMenu.h b/src/libUnuk/MainMenu.h index a097622..44209e3 100644 --- a/src/libUnuk/MainMenu.h +++ b/src/libUnuk/MainMenu.h @@ -21,9 +21,10 @@ public: ~MainMenu(void); mainMenuNavVal_t Run(void); - void Render(void); private: + void Render(void); + Map _background; Text lblMenu; diff --git a/src/libUnuk/MapEntities.h b/src/libUnuk/MapEntities.h index f84ad52..8440d70 100644 --- a/src/libUnuk/MapEntities.h +++ b/src/libUnuk/MapEntities.h @@ -1,3 +1,9 @@ +/* + * Version of MapElement, that will check whether the SDL_Surface it + * owns is NULL or not and draws. + * + */ + #ifndef _MAPENTITIES_H_ #define _MAPENTITIES_H_ diff --git a/src/libUnuk/Text.h b/src/libUnuk/Text.h index 1247a91..6a87dfa 100644 --- a/src/libUnuk/Text.h +++ b/src/libUnuk/Text.h @@ -25,7 +25,6 @@ public: int GetX(void) { return x; } int GetY(void) { return y; } - string GetText(void) { return _textContents; } SDL_Color GetColour(void) { return _textColour; } void SetXY(int xArg, int yArg); @@ -35,6 +34,8 @@ public: int SetTextShaded(string textArg, textSizes_t size, SDL_Color, SDL_Color); int SetTextShaded(string textArg, textSizes_t size, Uint8 rF, Uint8 gF, Uint8 bF, Uint8 rB, Uint8 gB, Uint8 bB); + string GetText(void) { return _textContents; } + void Render(void); void Render(int xArg, int yArg); void RenderLiteral(void); diff --git a/src/libUnuk/TextureManager.h b/src/libUnuk/TextureManager.h index b2bbd94..e1261a2 100644 --- a/src/libUnuk/TextureManager.h +++ b/src/libUnuk/TextureManager.h @@ -1,3 +1,11 @@ +/* + * The Texture Manager will keep a small "Database" + * of the name of the texture that is loaded and the + * actual texture so we can query it with the filename + * and it will return the teture if it is already in memory + * or load the tture if it is not. + */ + #ifndef _TEXTUREMANAGER_H_ #define _TEXTUREMANAGER_H_ #include <SDL/SDL.h> @@ -6,13 +14,6 @@ #include "ImageLoader.h" using namespace std; -/* - * The Texture Manager will keep a small "Database" - * of the name of the texture that is loaded and the - * actual texture so we can query it with the filename - * and it will return the teture if it is already in memory - * or load the tture if it is not. - */ class TextureManager { public: TextureManager(void);