Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 14, 2011, 11:02:58 PM (14 years ago)
Author:
dafrick
Message:

Some extension of NotificationQueue, font size and color can now be specified.

Location:
code/branches/tutoriallevel/src/libraries/core
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/tutoriallevel/src/libraries/core/GUIManager.cc

    r7811 r7894  
    3737#include <CEGUIDefaultLogger.h>
    3838#include <CEGUIExceptions.h>
     39#include <CEGUIFontManager.h>
    3940#include <CEGUIInputEvent.h>
    4041#include <CEGUIMouseCursor.h>
     
    4344#include <CEGUIWindow.h>
    4445#include <CEGUIWindowManager.h>
     46#include <CEGUIXMLAttributes.h>
    4547#include <elements/CEGUIListbox.h>
    4648#include <elements/CEGUIListboxItem.h>
     
    498500    }
    499501
     502    /**
     503    @brief
     504        Adds a new freetype font to the CEGUI system.
     505    @param name
     506        The name of the new font.
     507    @param size
     508        The font size of the new font in pixels.
     509        @param fontName
     510        The filename of the font.
     511    */
     512    /*static*/ void GUIManager::addFontHelper(const std::string& name, int size, const std::string& fontName)
     513    {
     514        if(CEGUI::FontManager::getSingleton().isFontPresent(name)) // If a font with that name already exists.
     515            return;
     516
     517        CEGUI::Font* font = NULL;
     518        CEGUI::XMLAttributes xmlAttributes;
     519
     520        // Attributes specified within CEGUIFont
     521        xmlAttributes.add("Name", name);
     522        xmlAttributes.add("Filename", fontName);
     523        xmlAttributes.add("ResourceGroup", "");
     524        xmlAttributes.add("AutoScaled", "true");
     525        xmlAttributes.add("NativeHorzRes", "800");
     526        xmlAttributes.add("NativeVertRes", "600");
     527
     528        // Attributes specified within CEGUIXMLAttributes
     529        xmlAttributes.add("Size", multi_cast<std::string>(size));
     530        xmlAttributes.add("AntiAlias", "true");
     531
     532        font = CEGUI::FontManager::getSingleton().createFont("FreeType", xmlAttributes);
     533        if(font != NULL)
     534            font->load();
     535    }
     536
    500537}
  • code/branches/tutoriallevel/src/libraries/core/GUIManager.h

    r7801 r7894  
    109109
    110110        // TODO: Temporary hack because the tolua exported CEGUI method does not seem to work
    111         static void subscribeEventHelper(CEGUI::Window* window, const std::string& event, const std::string& function); //tolua_export
    112         static void setTooltipTextHelper(CEGUI::ListboxItem* item, const std::string& toooltip); //tolua_export
    113         static void setItemTooltipsEnabledHelper(CEGUI::Listbox* listbox, bool enabled); //tolua_export
     111        static void subscribeEventHelper(CEGUI::Window* window, const std::string& event, const std::string& function); // tolua_export
     112        static void setTooltipTextHelper(CEGUI::ListboxItem* item, const std::string& toooltip); // tolua_export
     113        static void setItemTooltipsEnabledHelper(CEGUI::Listbox* listbox, bool enabled); // tolua_export
     114        static void addFontHelper(const std::string& name, int size, const std::string& fontName); // tolua_export
    114115
    115116        static GUIManager& getInstance() { return Singleton<GUIManager>::getInstance(); } // tolua_export
Note: See TracChangeset for help on using the changeset viewer.