Image Buttons
Posted: Sun Nov 02, 2008 06:51
Hi,
I am having trouble implementing image buttons.
I read the tutorial on http://www.cegui.org.uk/wiki/index.php/ ... ageButtons to figure out how to make image buttons
this is my code:
I followed the steps as of the tutorial listed above to create the imageset file, and layout file but im getting a runtime error:
Is this because the compiler cannot find the imageset, or layout file. Or is there something else I am doing wrong
Here is the imageset and layout file if this would help you answer me
layout file:
Thanks in advance
I am having trouble implementing image buttons.
I read the tutorial on http://www.cegui.org.uk/wiki/index.php/ ... ageButtons to figure out how to make image buttons
this is my code:
Code: Select all
CEGUI::OgreCEGUIRenderer* mGUIRenderer = new CEGUI::OgreCEGUIRenderer(mWindow,Ogre::RENDER_QUEUE_OVERLAY,false,3000,mSceneManager);
CEGUI::System* mGUISystem = new CEGUI::System(mGUIRenderer);
CEGUI::SchemeManager::getSingleton().loadScheme((CEGUI::utf8*)"TaharezLookSkin.scheme");
mGUISystem->setDefaultMouseCursor((CEGUI::utf8*)"TaharezLook", (CEGUI::utf8*)"MouseArrow");
CEGUI::MouseCursor::getSingleton().setImage(CEGUI::System::getSingleton().getDefaultMouseCursor());
//initialising ninjabutton
CEGUI::ImagesetManager::getSingleton().createImageset( "NinjaButton.imageset" );
CEGUI::Imageset *m_pImageSet = CEGUI::ImagesetManager::getSingleton().getImageset( "NinjaButton" );
CEGUI::WindowManager *win = CEGUI::WindowManager::getSingletonPtr();
CEGUI::Window *sheet = win->createWindow("DefaultGUISheet", "CEGUIDemo/Sheet");
CEGUI::Window *start = win->createWindow("TaharezLook/Button", "CEGUIDemo/StartButton");
start->setText("Start Game");
start->setSize(CEGUI::UVector2(CEGUI::UDim(0.15, 0), CEGUI::UDim(0.1, 0)));
start->setPosition(CEGUI::UVector2(CEGUI::UDim(0.8, 0), CEGUI::UDim(0.8, 0)));
CEGUI::Window *pane = win->createWindow("TaharezLook/ScrollablePane", "CEGUIDemo/Pane");
pane->setSize(CEGUI::UVector2(CEGUI::UDim(0.2, 0), CEGUI::UDim(1, 0)));
CEGUI::Window *popup2 = win->createWindow("TaharezLook/FrameWindow","CEGUIDemo/Popup2");
popup2->setText("information about Ninja");
popup2->setSize(CEGUI::UVector2(CEGUI::UDim(0.5, 0), CEGUI::UDim(0.5, 0)));
popup2->setPosition(CEGUI::UVector2(CEGUI::UDim(0.3, 0), CEGUI::UDim(0.3, 0)));
popup2->setVisible(false);
CEGUI::Window *popupText2 = win->createWindow("TaharezLook/StaticText","CEGUIDemo/PopupText2");
popupText2->setText("This window contains information about ninjas");
popupText2->setSize(CEGUI::UVector2(CEGUI::UDim(1, 0), CEGUI::UDim(1, 0)));
CEGUI::Window *w = CEGUI::WindowManager::getSingleton().loadWindowLayout( "NinjaButton.layout" );
w->setPosition( CEGUI::UVector2( CEGUI::UDim(0.05,0), CEGUI::UDim(0,0) ) );
sheet->addChildWindow(pane);
sheet->addChildWindow(start);
sheet->addChildWindow(popup2);
popup2->addChildWindow(popupText2);
pane->addChildWindow(w);
mGUISystem->setGUISheet(sheet);
I followed the steps as of the tutorial listed above to create the imageset file, and layout file but im getting a runtime error:
Code: Select all
C++ exception: CEGUI::RendererException at memory location 0x002ac0e8..
Is this because the compiler cannot find the imageset, or layout file. Or is there something else I am doing wrong
Here is the imageset and layout file if this would help you answer me
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<Imageset Name="NinjaButton" imagefile="NinjaButton.tga">
<Image Name="btnNormal" XPos="2" YPos="3" Width="94" Height"59" />
<Image Name="btnHover" XPos="2" YPos="66" Width="94" Height"59" />
<Image Name="btnPushed" XPos=100" YPos="3" Width="94" Height"59" />
<Image Name="btnDisabl" XPos="2" YPos="3" Width="94" Height"59" />
</Imageset>
layout file:
Code: Select all
<?xml version="1.0" encoding="UTF-8" ?> <GUILayout> <Window Type="TaharezLook/ImageButton" Name="NinjaButton">
<Property Name="UnifiedPosition" Value="{{0,0},{0,0}}" />
<Property Name="UnifiedSize" Value="{{0,64},{0,20}}" />
<!-- Here we choose what images to take. set:THEButton means they are stored -->
<!-- in the imageset named THEButton and image:btnNormal specifies wich image it is. -->
<Property Name="NormalImage" Value="set:NinjaButton image:btnNormal" /> <Property Name="HoverImage" Value="set:NinjaButton image:btnHover" /> <Property Name="PushedImage" Value="set:NinjaButton image:btnPushed" /> <Property Name="DisabledImage" Value="set:NinjaButton image:btnDisabl" />
</GUILayout>
Thanks in advance