[SOLVED]Image Button?
Posted: Sun Sep 04, 2011 13:37
Hi, this code works but when I try to split the image/texture up nothing shows. It compiles and runs but without image/button.
Perhaps I am using outdated tutorials, where is the best resource showing how to create an image button from code?
Or if you can see something wrong with the commented code let me know, thamks.
Code: Select all
//-- The following commented lines do not work,
//-- It compiles and runs but no image/button shows
// Texture* texturePtr = &System::getSingleton().getRenderer()->createTexture("Control_Buttons.png", "imagesets"); // default resource group
// Imageset* ButtonsImageset = &ImagesetManager::getSingleton().create("Buttons", *texturePtr);
// ButtonsImageset->defineImage("ButtonUp", Point(0.0f,0.0f), Size( 1.0f, 1.0f ), Point(0.0f,0.0f));
// ButtonsImageset->defineImage("ButtonDown", Point(0.0f,0.0f), Size( 1.0f, 1.0f ), Point(0.0f,0.0f));
//-- This does work for full_image, but how do I split it up if the above code is wrong?
CEGUI::Imageset* ButtonsImageset = &CEGUI::ImagesetManager::getSingleton().createFromImageFile("Buttons","Control_Buttons.png");
PushButton* playButton = (PushButton*)CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/ImageButton", "playButton");
this->rootWindow->addChildWindow( playButton );
playButton->setPosition( UVector2( UDim( 0.0f, 0.0f ), UDim( 0.0f, 0.0f ) ) );
playButton->setSize( UVector2( UDim( 0.5f, 0.0f ), UDim( 0.5f, 0.0f ) ) );
playButton->setProperty( "NormalImage", "set:Buttons image:full_image" );
playButton->setProperty( "HoverImage", "set:Buttons image:full_image" );
playButton->setProperty( "PushedImage", "set:Buttons image:ButtonDown" );
playButton->setProperty( "DisabledImage", "set:Buttons image:ButtonDown" );
Perhaps I am using outdated tutorials, where is the best resource showing how to create an image button from code?
Or if you can see something wrong with the commented code let me know, thamks.