Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 1, 2011, 2:43:33 PM (14 years ago)
Author:
dafrick
Message:

Merging tutoriallevel branch into tutoriallevel2 branch.

Location:
code/branches/tutoriallevel2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/tutoriallevel2

  • code/branches/tutoriallevel2/src/libraries/core/GUIManager.cc

    r8351 r8371  
    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>
     
    649651    }
    650652
     653    /**
     654    @brief
     655        Adds a new freetype font to the CEGUI system.
     656    @param name
     657        The name of the new font.
     658    @param size
     659        The font size of the new font in pixels.
     660        @param fontName
     661        The filename of the font.
     662    */
     663    /*static*/ void GUIManager::addFontHelper(const std::string& name, int size, const std::string& fontName)
     664    {
     665        if(CEGUI::FontManager::getSingleton().isFontPresent(name)) // If a font with that name already exists.
     666            return;
     667
     668        CEGUI::Font* font = NULL;
     669        CEGUI::XMLAttributes xmlAttributes;
     670
     671        // Attributes specified within CEGUIFont
     672        xmlAttributes.add("Name", name);
     673        xmlAttributes.add("Filename", fontName);
     674        xmlAttributes.add("ResourceGroup", "");
     675        xmlAttributes.add("AutoScaled", "true");
     676        xmlAttributes.add("NativeHorzRes", "800");
     677        xmlAttributes.add("NativeVertRes", "600");
     678
     679        // Attributes specified within CEGUIXMLAttributes
     680        xmlAttributes.add("Size", multi_cast<std::string>(size));
     681        xmlAttributes.add("AntiAlias", "true");
     682
     683        font = CEGUI::FontManager::getSingleton().createFont("FreeType", xmlAttributes);
     684        if(font != NULL)
     685            font->load();
     686    }
     687
    651688}
Note: See TracChangeset for help on using the changeset viewer.