diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-01-14 13:50:25 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-01-14 13:50:25 +0000 |
commit | 976b4da70227ab97607c51be05a20f4ecfca9325 (patch) | |
tree | d77bfb869b6337f1747b34e8f053f3acddbc4b54 /src | |
parent | 5a1007fa3e827c03bb86db71cb26dfd4c485f28d (diff) | |
download | mana-976b4da70227ab97607c51be05a20f4ecfca9325.tar.gz mana-976b4da70227ab97607c51be05a20f4ecfca9325.tar.bz2 mana-976b4da70227ab97607c51be05a20f4ecfca9325.tar.xz mana-976b4da70227ab97607c51be05a20f4ecfca9325.zip |
Removed 9 cases of load_bitmap.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/gui.cpp | 26 | ||||
-rw-r--r-- | src/gui/gui.h | 14 | ||||
-rw-r--r-- | src/gui/radiobutton.cpp | 29 | ||||
-rw-r--r-- | src/gui/radiobutton.h | 10 | ||||
-rw-r--r-- | src/gui/window.cpp | 6 | ||||
-rw-r--r-- | src/main.cpp | 2 | ||||
-rw-r--r-- | src/resources/resourcemanager.cpp | 6 | ||||
-rw-r--r-- | src/resources/resourcemanager.h | 4 |
8 files changed, 37 insertions, 60 deletions
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 1ca5dc8f..14e76efd 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -446,24 +446,6 @@ void loadBarSkin() { blit(temp2, gui_skin.bar.bg.grid[5], 13, 0, 0, 0, 3, 11); } -void loadRadioSkin() { - gui_skin.radiobutton.normal = load_bitmap("data/Skin/radioout.bmp", NULL); - gui_skin.radiobutton.checked = load_bitmap("data/Skin/radioin.bmp", NULL); - gui_skin.radiobutton.disabled = load_bitmap("data/Skin/radioout.bmp", NULL); - gui_skin.radiobutton.disabled_checked = load_bitmap("data/Skin/radioin.bmp", NULL); -} - -void loadPlusSkin() { - //BITMAP *temp1 = load_bitmap("data/bar.bmp", NULL); - //BITMAP *temp2 = load_bitmap("data/bar_filled.bmp", NULL); - gui_skin.plus.bg.grid[0] = load_bitmap("data/plus.bmp", NULL); - gui_skin.plus.bg.grid[1] = load_bitmap("data/plus_sel.bmp", NULL); - gui_skin.plus.bg.grid[2] = load_bitmap("data/plus_dis.bmp", NULL); - //blit(temp1, gui_skin.bar.bg.grid[0], 0, 0, 0, 0, 3, 11); - //blit(temp1, gui_skin.bar.bg.grid[1], 4, 0, 0, 0, 1, 11); - //blit(temp1, gui_skin.bar.bg.grid[2], 13, 0, 0, 0, 3, 11); -} - void loadDialogSkin() { char **tokens; int tokenCount; @@ -542,12 +524,10 @@ int gui_load_skin(const char* skinname) { loadButtonSkin(); loadSliderSkin(); loadCheckboxSkin(); - loadRadioSkin(); loadTextboxSkin(); loadListboxSkin(); loadDialogSkin(); loadBarSkin(); - loadPlusSkin(); pop_config_state(); set_mouse_sprite((BITMAP *)gui_gfx[7].dat); @@ -584,12 +564,6 @@ void gui_shutdown(void) { destroy_bitmap(gui_skin.checkbox.disabled); destroy_bitmap(gui_skin.checkbox.disabled_checked); - /* Radiobutton */ - destroy_bitmap(gui_skin.radiobutton.normal); - destroy_bitmap(gui_skin.radiobutton.checked); - destroy_bitmap(gui_skin.radiobutton.disabled); - destroy_bitmap(gui_skin.radiobutton.disabled_checked); - for (a = 0; a < GUI_BMP_COUNT; a++) { destroy_bitmap(gui__repository[a]); } diff --git a/src/gui/gui.h b/src/gui/gui.h index f734e6a1..197d0c97 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -118,14 +118,6 @@ typedef struct { } LexCheckbox; typedef struct { - BITMAP *normal; - BITMAP *checked; - BITMAP *disabled; - BITMAP *disabled_checked; - int textcolor[2]; -} LexRadiobutton; - -typedef struct { LexSkinnedRect bg; int textcolor[2]; } LexTextbox; @@ -145,19 +137,13 @@ typedef struct { } LexBar; typedef struct { - LexSkinnedRect bg; -} LexPlus; - -typedef struct { LexButton button; LexSlider slider; LexCheckbox checkbox; - LexRadiobutton radiobutton; LexTextbox textbox; LexListbox listbox; LexDialog dialog; LexBar bar; - LexPlus plus; } LexSkin; extern LexSkin gui_skin; diff --git a/src/gui/radiobutton.cpp b/src/gui/radiobutton.cpp index f3aab388..97c93954 100644 --- a/src/gui/radiobutton.cpp +++ b/src/gui/radiobutton.cpp @@ -22,32 +22,41 @@ */ #include "radiobutton.h" +#include "../resources/resourcemanager.h" -RadioButton::RadioButton(const std::string& caption, const std::string& group, bool marked): - gcn::RadioButton(caption,group, marked) +RadioButton::RadioButton(const std::string& caption, const std::string& group, + bool marked): + gcn::RadioButton(caption, group, marked) { + ResourceManager *resman = ResourceManager::getInstance(); + radioNormal = resman->getImage("Skin/radioout.bmp"); + radioChecked = resman->getImage("Skin/radioin.bmp"); + radioDisabled = resman->getImage("Skin/radioout.bmp"); + radioDisabledChecked = resman->getImage("Skin/radioin.bmp"); } -void RadioButton::drawBox(gcn::Graphics* graphics) { - BITMAP *box = NULL; +void RadioButton::drawBox(gcn::Graphics* graphics) +{ + Image *box = NULL; int x, y; getAbsolutePosition(x, y); if (mMarked) { if (false /*disabled*/) { - box = gui_skin.radiobutton.disabled_checked; + box = radioDisabledChecked; } else { - box = gui_skin.radiobutton.checked; + box = radioChecked; } } else if (false /*disabled*/) { - box = gui_skin.radiobutton.disabled; + box = radioDisabled; } else { - box = gui_skin.radiobutton.normal; + box = radioNormal; } x += 2; y += 2; - if(box != NULL) - masked_blit(box, gui_bitmap, 0, 0, x, y, box->w, box->h); + if (box != NULL) { + box->draw(gui_bitmap, x, y); + } } diff --git a/src/gui/radiobutton.h b/src/gui/radiobutton.h index 778bee48..3365e013 100644 --- a/src/gui/radiobutton.h +++ b/src/gui/radiobutton.h @@ -25,6 +25,7 @@ #define _TMW_RADIOBUTTON_H #include "gui.h" +#include "../resources/image.h" /* * Guichan based RadioButton with custom look @@ -34,12 +35,19 @@ class RadioButton : public gcn::RadioButton { /* * Constructor. */ - RadioButton(const std::string& caption,const std::string& group, bool marked = false); + RadioButton(const std::string& caption,const std::string& group, + bool marked = false); /** * Draws the radiobutton, not the caption. */ void drawBox(gcn::Graphics* graphics); + + private: + Image *radioNormal; + Image *radioChecked; + Image *radioDisabled; + Image *radioDisabledChecked; }; #endif /* _TMW_RADIOBUTTON_H */ diff --git a/src/gui/window.cpp b/src/gui/window.cpp index d69dae77..9c08df9c 100644 --- a/src/gui/window.cpp +++ b/src/gui/window.cpp @@ -50,9 +50,9 @@ Window::Window(const std::string& text, bool modal, Window *parent): // Load dialog title bar image ResourceManager *resman = ResourceManager::getInstance(); - dLeft = resman->createImage("Skin/dialogLeft.bmp"); - dMid = resman->createImage("Skin/dialogMiddle.bmp"); - dRight = resman->createImage("Skin/dialogRight.bmp"); + dLeft = resman->getImage("Skin/dialogLeft.bmp"); + dMid = resman->getImage("Skin/dialogMiddle.bmp"); + dRight = resman->getImage("Skin/dialogRight.bmp"); // Register mouse listener addMouseListener(this); diff --git a/src/main.cpp b/src/main.cpp index 663c2589..b296e373 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -295,7 +295,7 @@ void init_engine() { ResourceManager *resman = ResourceManager::getInstance(); - login_wallpaper = resman->createImage("graphic/login.bmp"); + login_wallpaper = resman->getImage("graphic/login.bmp"); if (!login_wallpaper) error("Couldn't load login.bmp"); BITMAP *playerbitmap = load_bitmap("data/graphic/playerset.bmp", NULL); diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp index 1d65538f..3a7b3897 100644 --- a/src/resources/resourcemanager.cpp +++ b/src/resources/resourcemanager.cpp @@ -69,7 +69,7 @@ ResourceManager::~ResourceManager() #endif } -Resource* ResourceManager::create(const E_RESOURCE_TYPE &type, +Resource* ResourceManager::get(const E_RESOURCE_TYPE &type, const std::string &idPath) { // Check if the id exists, and return the value if it does. @@ -157,9 +157,9 @@ Resource* ResourceManager::create(const E_RESOURCE_TYPE &type, return resource; } -Image *ResourceManager::createImage(const std::string &idPath) +Image *ResourceManager::getImage(const std::string &idPath) { - return (Image*)create(IMAGE, idPath); + return (Image*)get(IMAGE, idPath); } ResourceManager* ResourceManager::getInstance() diff --git a/src/resources/resourcemanager.h b/src/resources/resourcemanager.h index f7b7ab2a..1b719b41 100644 --- a/src/resources/resourcemanager.h +++ b/src/resources/resourcemanager.h @@ -78,14 +78,14 @@ class ResourceManager * @return A valid resource or <code>NULL</code> if the resource could * not be loaded. */ - Resource *create( + Resource *get( const E_RESOURCE_TYPE &type, const std::string &idPath); /** * Convenience wrapper around ResourceManager::create. */ - Image *createImage(const std::string &idPath); + Image *getImage(const std::string &idPath); /** * Returns an instance of the class, creating one if it does not |