On my old computer, I had a project that used CEGUI, and CEGUI was working just fine.
On my new computer (same hardware, OS updated with clean reinstall) all I get is a small square in the window colour in the middle of my opengl window.
Code hasn't changed. CEGUI version may have increased.
OS is Gentoo, and CEGUI isn't throwing me error messages (at least, none that I can see).
Relevent bits of code (a lot of the initialisation stuff for TaharezLook came direct from a tutorial):
Code: Select all
#include <CEGUI/CEGUI.h>
#include <CEGUI/RendererModules/OpenGL/GL3Renderer.h>
class CEGUIHandler
{
public:
CEGUIHandler();
~CEGUIHandler();
CEGUI::Window* init(std::string base);
CEGUI::Window* get_base(std::string base);
CEGUI::Editbox* getActiveEditbox();
void set_mode(std::string base);
void hello_window(std::string base);
void menu(std::string base);
void model_viewer(std::string base);
private:
std::map<std::string, CEGUI::Window*> roots;
};
//****************** header/implementation file split *******************
#include <CEGUI/System.h>
CEGUIHandler::CEGUIHandler()
{
/*CEGUI::OpenGL3Renderer& myRenderer =*/ CEGUI::OpenGL3Renderer::bootstrapSystem();
//CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();
// initialise the required dirs for the DefaultResourceProvider
CEGUI::DefaultResourceProvider* rp = static_cast<CEGUI::DefaultResourceProvider*>
(CEGUI::System::getSingleton().getResourceProvider());
rp->setResourceGroupDirectory("schemes", "/usr/share/cegui-0/schemes/");
rp->setResourceGroupDirectory("imagesets", "/usr/share/cegui-0/imagesets/");
rp->setResourceGroupDirectory("fonts", "/usr/share/cegui-0/fonts/");
rp->setResourceGroupDirectory("layouts", "/usr/share/cegui-0/layouts/");
rp->setResourceGroupDirectory("looknfeels", "/usr/share/cegui-0/looknfeel/");
rp->setResourceGroupDirectory("lua_scripts", "/usr/share/cegui-0/lua_scripts/");
// This is only really needed if you are using Xerces and need to
// specify the schemas location
rp->setResourceGroupDirectory("schemas", "/usr/share/cegui-0/xml_schemas/");
// set the default resource groups to be used
CEGUI::ImageManager::setImagesetDefaultResourceGroup("imagesets");
CEGUI::Font::setDefaultResourceGroup("fonts");
CEGUI::Scheme::setDefaultResourceGroup("schemes");
CEGUI::WidgetLookManager::setDefaultResourceGroup("looknfeels");
CEGUI::WindowManager::setDefaultResourceGroup("layouts");
CEGUI::ScriptModule::setDefaultResourceGroup("lua_scripts");
// setup default group for validation schemas
CEGUI::XMLParser* parser = CEGUI::System::getSingleton().getXMLParser();
if (parser->isPropertyPresent("SchemaDefaultResourceGroup"))
parser->setProperty("SchemaDefaultResourceGroup", "schemas");
// create (load) the TaharezLook scheme file
// (this auto-loads the TaharezLook looknfeel and imageset files)
CEGUI::SchemeManager::getSingleton().createFromFile( "TaharezLook.scheme" );
// create (load) a font.
// The first font loaded automatically becomes the default font, but note
// that the scheme might have already loaded a font, so there may already
// be a default set - if we want the "DejaVuSans-10" font to definitely
// be the default, we should set the default explicitly afterwards.
CEGUI::FontManager::getSingleton().createFromFile( "DejaVuSans-10.font" );
CEGUI::System::getSingleton().getDefaultGUIContext().getMouseCursor().setDefaultImage( "TaharezLook/MouseArrow" );
CEGUI::System::getSingleton().getDefaultGUIContext().setDefaultTooltipType( "TaharezLook/Tooltip" );
}
CEGUI::Window* CEGUIHandler::init(std::string base)
{
CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();
CEGUI::Window* myRoot = wmgr.createWindow( "DefaultWindow", "root" );
myRoot->setMousePassThroughEnabled(true);
CEGUI::System::getSingleton().getDefaultGUIContext().setRootWindow( myRoot );
myRoot->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.0f, 0.0f ), CEGUI::UDim( 0.0f, 0.0f ) ) );
myRoot->setSize( CEGUI::USize( CEGUI::UDim( 1.0f, 0.0f ), CEGUI::UDim( 1.0f, 0.0f ) ) );
roots[base] = myRoot;
return myRoot;
}
void CEGUIHandler::set_mode(std::string base)
{
CEGUI::System::getSingleton().getDefaultGUIContext().setRootWindow( roots[base] );
}
CEGUI::Window* CEGUIHandler::get_base(std::string base)
{
if (roots.find(base) != roots.end())
return roots[base];
else
return 0;
}
void CEGUIHandler::menu(std::string base)
{
CEGUI::Window* myRoot = roots[base];
CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();
CEGUI::FrameWindow* fWnd = static_cast<CEGUI::FrameWindow*>(wmgr.createWindow( "TaharezLook/FrameWindow", "MenuWindow" ));
myRoot->addChild( fWnd );
fWnd->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.25f, 0.0f ), CEGUI::UDim( 0.25f, 0.0f ) ) );
fWnd->setSize( CEGUI::USize( CEGUI::UDim( 0.5f, 0.0f ), CEGUI::UDim( 0.5f, 0.0f ) ) );
fWnd->setText( "Main Menu" );
CEGUI::Window* viewer_button = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/Button","ViewerButton");
viewer_button->setPosition(CEGUI::UVector2(CEGUI::UDim(0.25,0),CEGUI::UDim(0.25,0)));
viewer_button->setSize(CEGUI::USize(CEGUI::UDim(0,100),CEGUI::UDim(0,25)));
viewer_button->setText("Model Viewer");
fWnd->addChild(viewer_button);
CEGUI::Window* demo_button = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/Button","DemoButton");
demo_button->setPosition(CEGUI::UVector2(CEGUI::UDim(0.25,0),CEGUI::UDim(0.50,0)));
demo_button->setSize(CEGUI::USize(CEGUI::UDim(0,50),CEGUI::UDim(0,25)));
demo_button->setText("Demo");
fWnd->addChild(demo_button);
CEGUI::Window* exit_button = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/Button","ExitButton");
exit_button->setPosition(CEGUI::UVector2(CEGUI::UDim(0.25,0),CEGUI::UDim(0.75,0)));
exit_button->setSize(CEGUI::USize(CEGUI::UDim(0,50),CEGUI::UDim(0,25)));
exit_button->setText("Exit");
fWnd->addChild(exit_button);
}
I've got this all sequestered away in one class because it doesn't/didn't play nicely with the XWindows initialisation stuff, which is also sequestered away in it's own class. I'll probably split out the "make a new set of CEGUI bits" code at some point, into a selection of classes, but that's not really important if I can't get CEGUI windows to show up properly at all.
What's changed?/what have I messed up?/What other information do I need to fix this?