diff options
-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 |