Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 28, 2011, 5:10:01 PM (13 years ago)
Author:
dafrick
Message:

Merging tutoriallevel3 branch into presentation branch.

Location:
code/branches/presentation
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation

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

    r8627 r8637  
    3838#include <CEGUIDefaultLogger.h>
    3939#include <CEGUIExceptions.h>
     40#include <CEGUIFontManager.h>
    4041#include <CEGUIInputEvent.h>
    4142#include <CEGUIMouseCursor.h>
     
    4445#include <CEGUIWindow.h>
    4546#include <CEGUIWindowManager.h>
     47#include <CEGUIXMLAttributes.h>
    4648#include <elements/CEGUIListbox.h>
    4749#include <elements/CEGUIListboxItem.h>
     
    729731    }
    730732
     733    /**
     734    @brief
     735        Adds a new freetype font to the CEGUI system.
     736    @param name
     737        The name of the new font.
     738    @param size
     739        The font size of the new font in pixels.
     740        @param fontName
     741        The filename of the font.
     742    */
     743    /*static*/ void GUIManager::addFontHelper(const std::string& name, int size, const std::string& fontName)
     744    {
     745        if(CEGUI::FontManager::getSingleton().isFontPresent(name)) // If a font with that name already exists.
     746            return;
     747
     748        CEGUI::Font* font = NULL;
     749        CEGUI::XMLAttributes xmlAttributes;
     750
     751        // Attributes specified within CEGUIFont
     752        xmlAttributes.add("Name", name);
     753        xmlAttributes.add("Filename", fontName);
     754        xmlAttributes.add("ResourceGroup", "");
     755        xmlAttributes.add("AutoScaled", "true");
     756        xmlAttributes.add("NativeHorzRes", "800");
     757        xmlAttributes.add("NativeVertRes", "600");
     758
     759        // Attributes specified within CEGUIXMLAttributes
     760        xmlAttributes.add("Size", multi_cast<std::string>(size));
     761        xmlAttributes.add("AntiAlias", "true");
     762
     763        font = CEGUI::FontManager::getSingleton().createFont("FreeType", xmlAttributes);
     764        if(font != NULL)
     765            font->load();
     766    }
     767
    731768}
Note: See TracChangeset for help on using the changeset viewer.