(solved) Text of TaharezLook/Button missing (not appearing)

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

schnorr
Just popping in
Just popping in
Posts: 14
Joined: Fri Jan 11, 2008 09:39

(solved) Text of TaharezLook/Button missing (not appearing)

Postby schnorr » Tue Jan 29, 2008 12:40

Hello,

I am using CEGUI in a Ogre application to make buttons, menus, etc.
I have a layout definition like this for a "quit" button:
<Window Type="TaharezLook/Button" Name="quit" >
<Property Name="Font" Value="Iconified-12" />
<Property Name="Text" Value="Exit" />
<Property Name="Alpha" Value="0.3" />
<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
<Property Name="ClippedByParent" Value="False" />
<Property Name="UnifiedAreaRect" Value="{{0.465,0},{0.508078,0},{0.715,0},{0.758078,0}}" />
</Window>

This is the code I use to load the layout into the Ogre application:
mRenderer = new CEGUI::OgreCEGUIRenderer(mWindow, Ogre::RENDER_QUEUE_OVERLAY, false, 3000, mSceneMgr);
mSystem = new CEGUI::System(mRenderer);
CEGUI::SchemeManager::getSingleton().loadScheme((CEGUI::utf8*)"TaharezLook.scheme");
mSystem->setDefaultMouseCursor((CEGUI::utf8*)"TaharezLook", (CEGUI::utf8*)"MouseArrow");
CEGUI::WindowManager *win = CEGUI::WindowManager::getSingletonPtr();
CEGUI::Window* myRoot = win->loadWindowLayout("app.layout");
CEGUI::System::getSingleton().setGUISheet(myRoot);

The Iconified-12 font is present in the resources.cfg file of the Ogre app. Its contents are:
<?xml version="1.0" ?>
<Font Name="Iconified-12" Filename="Iconiv2.ttf" Type="FreeType" Size="12" NativeHorzRes="800" NativeVertRes="600" AutoScaled="true"/>

The file Iconiv2.ttf is also present.

The problem is that the "Exit" text of the button (which was specified in the layout) does not appear inside the button when the app is executed.
Does anyone know what's causing this? I am using Linux, CEGUI 0.5.0 and Ogre 1.4.5.

Before I was creating the same button directly in the source code. And it worked, the button text appeared.

Thanks
Last edited by schnorr on Tue Jan 29, 2008 13:31, edited 1 time in total.

User avatar
scriptkid
Home away from home
Home away from home
Posts: 1178
Joined: Wed Jan 12, 2005 12:06
Location: The Hague, The Netherlands
Contact:

Postby scriptkid » Tue Jan 29, 2008 12:55

Before I was creating the same button directly in the source code. And it worked, the button text appeared.


Then your code probably created the font, while your current setup doesn't do that. Either your TaharezLook.scheme file should include the font, or your code should create it.

HTH :)
Check out my released snake game using Cegui!

schnorr
Just popping in
Just popping in
Posts: 14
Joined: Fri Jan 11, 2008 09:39

Postby schnorr » Tue Jan 29, 2008 13:15

So..

The only difference is that in the old code, I did:

Code: Select all

mSystem->setDefaultFont((CEGUI::utf8*)"bluehighway-12");

So, I removed this line in the code because it throws an exception and then segfault:
terminate called after throwing an instance of 'CEGUI::UnknownObjectException'
Aborted (core dumped)

Following your sugestion, I changed to use the Iconified-12 font:

Code: Select all

mSystem->setDefaultFont("Iconified-12");

The exception is still happening.... :cry:

Should I keep the setDefaultFont? If so, how to avoid the segfault?

Thanks again...

schnorr
Just popping in
Just popping in
Posts: 14
Joined: Fri Jan 11, 2008 09:39

Postby schnorr » Tue Jan 29, 2008 13:30

Hello,

I read the documentation a little bit more, specially
http://www.cegui.org.uk/wiki/index.php/The_Imbeciles_Guide_to_Loading_Data_Files_and_Initialisation

I added the following line of code and the text is showing up:

Code: Select all

CEGUI::FontManager::getSingleton().createFont("bluehighway-12.font");

I think this should also work with the iconified font.
I thought that during the layout parsing, the font was automatically "created".

Thanks

User avatar
scriptkid
Home away from home
Home away from home
Posts: 1178
Joined: Wed Jan 12, 2005 12:06
Location: The Hague, The Netherlands
Contact:

Postby scriptkid » Tue Jan 29, 2008 15:58

Hi,

fonts always need to be created first. A layout is just a data-driven way to create windows. So it needs the exact pre-setup like you would when creating your gui from code.
Check out my released snake game using Cegui!


Return to “Help”

Who is online

Users browsing this forum: No registered users and 29 guests