Creating a simple GUI with CEGUI / OGRE

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

User avatar
NSXEagle
Just popping in
Just popping in
Posts: 14
Joined: Wed Jan 12, 2005 12:06
Location: Kokubunji-shi, Tokyo-to, Japan
Contact:

Creating a simple GUI with CEGUI / OGRE

Postby NSXEagle » Tue Jan 25, 2005 21:42

Hi!

It's me again and I have a problem. After I could solve this memory manager mess (you know - the OGRE vs. Xerces-C thing), I have now problems to create a simple GUI with CEGUI. AFAIK, it has something to do with font loading. Here is my sample .font file:

FontComic12.font

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<Font Name="Comic-12" Type="Dynamic" Filename="comic.ttf" Size="12" AutoScaled="true" NativeHorzRes="800" NativeVertRes="600" />


Here is my CEGUI initialization code:

Code: Select all

CEGUI::SchemeManager::getSingleton().loadScheme("TaharezLook.scheme");
CEGUI::System::getSingleton().setDefaultMouseCursor("TaharezLook","MouseArrow");
CEGUI::Window* sheet = CEGUI::WindowManager::getSingleton().createWindow("DefaultWindow","root_wnd");
CEGUI::Font* gfont = CEGUI::FontManager::getSingleton().createFont("FontComic12.font");
CEGUI::FrameWindow* frame = (CEGUI::FrameWindow*)CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/FrameWindow","Frame1");
frame->setPosition(CEGUI::Point(0.0f, 0.83f));
frame->setSize(CEGUI::Size(0.23f, 0.17f));
frame->setAlwaysOnTop(true);
frame->setFont(gfont);
frame->setText("Test Window 1");
sheet->addChildWindow(frame);
CEGUI::System::getSingleton().setGUISheet(sheet);


My program crashes during the creation of the FrameWindow (to be more specific, in the last line of the following code):

Code: Select all

void TLFrameWindow::layoutComponentWidgets()
{
ImagesetManager& ismgr = ImagesetManager::getSingleton();
// calculate and set size of title bar
Size titleSz;
titleSz.d_height = d_titlebar->getFont()->getLineSpacing() + TitlebarTextPadding;


I looked at the font object used for the creation and it seems that it is corrupt or simply not existing. Did I miss something about a default font?

User avatar
spannerman
Home away from home
Home away from home
Posts: 330
Joined: Wed Jan 12, 2005 12:06

Re: Creating a simple GUI with CEGUI / OGRE

Postby spannerman » Tue Jan 25, 2005 22:54

Hmm, make sure you are looking in the correct locations for your font file. See the createFont method with its additional parameters.

Also, it might just be that you arent setting a default font:

Code: Select all

System::getSingleton().setDefaultFont(gfont);

User avatar
NSXEagle
Just popping in
Just popping in
Posts: 14
Joined: Wed Jan 12, 2005 12:06
Location: Kokubunji-shi, Tokyo-to, Japan
Contact:

Re: Creating a simple GUI with CEGUI / OGRE

Postby NSXEagle » Tue Jan 25, 2005 23:00

Thank you very much! Everything is working fine now! *bows* :D


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 14 guests