diff options
author | Björn Steinbrink <B.Steinbrink@gmx.de> | 2005-08-04 22:02:33 +0000 |
---|---|---|
committer | Björn Steinbrink <B.Steinbrink@gmx.de> | 2005-08-04 22:02:33 +0000 |
commit | 9d544432e02295a078129e2314ee940cca023ae8 (patch) | |
tree | 89a821887bd56c53a604a0727f8f874b43ca052d | |
parent | 9eed8feb838c31368dba6cd9716f67d800bf6e3b (diff) | |
download | mana-9d544432e02295a078129e2314ee940cca023ae8.tar.gz mana-9d544432e02295a078129e2314ee940cca023ae8.tar.bz2 mana-9d544432e02295a078129e2314ee940cca023ae8.tar.xz mana-9d544432e02295a078129e2314ee940cca023ae8.zip |
Made the paths to some graphics being determined dynamically.
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | src/gui/gui.cpp | 52 |
2 files changed, 12 insertions, 42 deletions
@@ -6,6 +6,8 @@ path. * src/gui/browserbox.cpp: Make use of then new resource manager method to determine the real path of a file. + * src/gui/gui.cpp: Dynamically determine the path to graphic files instead + of using the try-catch fallback method. 2005-08-03 Andrej Sinicyn <andrej4000@gmail.com> diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 996eb5b1..033ed3df 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -96,50 +96,32 @@ Gui::Gui(Graphics *graphics): Window::setWindowContainer(guiTop); setTop(guiTop); + ResourceManager *resman = ResourceManager::getInstance(); + // Set global font try { mGuiFont = new gcn::ImageFont( - TMW_DATADIR "data/graphics/gui/sansserif8.png", + resman->getRealPath("graphics/gui/sansserif8.png"), " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[" "\\]^_`abcdefghijklmnopqrstuvwxyz{|}~|" ); } catch (gcn::Exception e) { - try { - mGuiFont = new gcn::ImageFont( - "data/graphics/gui/sansserif8.png", - " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVW" - "XYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~|" - ); - } - catch (gcn::Exception e) - { - logger->error("Unable to load sansserif8.png!"); - } + logger->error("Unable to load sansserif8.png!"); } // Set speech font try { speechFont = new gcn::ImageFont( - TMW_DATADIR "data/graphics/gui/rpgfont_wider.png", + resman->getRealPath("graphics/gui/rpgfont_wider.png"), " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" "0123456789.,!?-+/():;%&`'*#=[]\"<>{}^~|_@&\\" ); } catch (gcn::Exception e) { - try { - speechFont = new gcn::ImageFont( - "data/graphics/gui/rpgfont_wider.png", - " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" - "0123456789.,!?-+/():;%&`'*#=[]\"<>{}^~|_@&\\" - ); - } - catch (gcn::Exception e) - { - logger->error("Unable to load rpgfont_wider.png!"); - } + logger->error("Unable to load rpgfont_wider.png!"); } gcn::Widget::setGlobalFont(mGuiFont); @@ -147,32 +129,18 @@ Gui::Gui(Graphics *graphics): // Load hits' colourful fonts try { hitRedFont = new gcn::ImageFont( - TMW_DATADIR "data/graphics/gui/hits_red.png", + resman->getRealPath("graphics/gui/hits_red.png"), "0123456789"); hitBlueFont = new gcn::ImageFont( - TMW_DATADIR "data/graphics/gui/hits_blue.png", + resman->getRealPath("graphics/gui/hits_blue.png"), "0123456789"); hitYellowFont = new gcn::ImageFont( - TMW_DATADIR "data/graphics/gui/hits_yellow.png", + resman->getRealPath("graphics/gui/hits_yellow.png"), "mis"); } catch (gcn::Exception e) { - try { - hitRedFont = new gcn::ImageFont( - "data/graphics/gui/hits_red.png", - "0123456789"); - hitBlueFont = new gcn::ImageFont( - "data/graphics/gui/hits_blue.png", - "0123456789"); - hitYellowFont = new gcn::ImageFont( - "data/graphics/gui/hits_yellow.png", - "mis"); - } - catch (gcn::Exception e) - { - logger->error("Unable to load colored hits' fonts!"); - } + logger->error("Unable to load colored hits' fonts!"); } // Initialize mouse cursor and listen for changes to the option |