Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 12, 2011, 12:31:23 AM (13 years ago)
Author:
dafrick
Message:

Merging tutoriallevel2 branch into tutoriallevel3 branch.

Location:
code/branches/tutoriallevel3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/tutoriallevel3

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

    r8439 r8453  
    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>
     
    663665    }
    664666
     667    /**
     668    @brief
     669        Adds a new freetype font to the CEGUI system.
     670    @param name
     671        The name of the new font.
     672    @param size
     673        The font size of the new font in pixels.
     674        @param fontName
     675        The filename of the font.
     676    */
     677    /*static*/ void GUIManager::addFontHelper(const std::string& name, int size, const std::string& fontName)
     678    {
     679        if(CEGUI::FontManager::getSingleton().isFontPresent(name)) // If a font with that name already exists.
     680            return;
     681
     682        CEGUI::Font* font = NULL;
     683        CEGUI::XMLAttributes xmlAttributes;
     684
     685        // Attributes specified within CEGUIFont
     686        xmlAttributes.add("Name", name);
     687        xmlAttributes.add("Filename", fontName);
     688        xmlAttributes.add("ResourceGroup", "");
     689        xmlAttributes.add("AutoScaled", "true");
     690        xmlAttributes.add("NativeHorzRes", "800");
     691        xmlAttributes.add("NativeVertRes", "600");
     692
     693        // Attributes specified within CEGUIXMLAttributes
     694        xmlAttributes.add("Size", multi_cast<std::string>(size));
     695        xmlAttributes.add("AntiAlias", "true");
     696
     697        font = CEGUI::FontManager::getSingleton().createFont("FreeType", xmlAttributes);
     698        if(font != NULL)
     699            font->load();
     700    }
     701
    665702}
Note: See TracChangeset for help on using the changeset viewer.