#include "gui.h" #include "video.h" #include #include using namespace CEGUI; CEGUI::Window *GUI::root = NULL; void GUI::init() { OpenGLRenderer::bootstrapSystem(); DefaultResourceProvider* rp = static_cast (System::getSingleton().getResourceProvider()); rp->setResourceGroupDirectory("schemes", "GUI/"); rp->setResourceGroupDirectory("imagesets", "GUI/"); rp->setResourceGroupDirectory("fonts", "fonts/"); rp->setResourceGroupDirectory("layouts", "GUI/layouts/"); rp->setResourceGroupDirectory("looknfeels", "GUI/"); Imageset::setDefaultResourceGroup("imagesets"); Font::setDefaultResourceGroup("fonts"); Scheme::setDefaultResourceGroup("schemes"); WidgetLookManager::setDefaultResourceGroup("looknfeels"); WindowManager::setDefaultResourceGroup("layouts"); SchemeManager::getSingleton().create( "VanillaSkin.scheme" ); FontManager::getSingleton().create("VeraMono.font"); System::getSingleton().setDefaultFont( "VeraMono" ); System::getSingleton().setDefaultMouseCursor( "Vanilla-Images", "MouseArrow" ); WindowManager& wmgr(WindowManager::getSingleton()); root = wmgr.createWindow("DefaultWindow", "root"); System::getSingleton().setGUISheet(root); } void GUI::render() { /* Disable depth testing to avoid cursor bugginess. */ glDisable(GL_DEPTH_TEST); System::getSingleton().renderGUI(); glEnable(GL_DEPTH_TEST); } /* RaiseWindow */ /* default values */ float RaiseWindow::radius = 5; float RaiseWindow::focus = .8; float RaiseWindow::strength = .3; RaiseWindow::RaiseWindow() { WindowManager& wmgr(WindowManager::getSingleton()); wnd = static_cast(wmgr.loadWindowLayout("raisewnd.layout")); root->addChildWindow(wnd); radius_sb = static_cast(wmgr.getWindow("radius_sb")); radius_sb_lbl = wmgr.getWindow("radius_sb_lbl"); focus_sb = static_cast(wmgr.getWindow("focus_sb")); focus_sb_lbl = wmgr.getWindow("focus_sb_lbl"); strength_sb = static_cast(wmgr.getWindow("strength_sb")); strength_sb_lbl = wmgr.getWindow("strength_sb_lbl"); /* load default/last used values */ radius_sb->setScrollPosition(radius); focus_sb->setScrollPosition(focus); strength_sb->setScrollPosition(strength); } RaiseWindow::~RaiseWindow() { /* store current values */ radius = get_radius(); focus = get_focus(); strength = get_strength(); WindowManager& wmgr(WindowManager::getSingleton()); wmgr.destroyWindow(wnd); wmgr.cleanDeadPool(); } void RaiseWindow::render() { radius_sb_lbl->setText((boost::format("%.2f") % radius_sb->getScrollPosition()).str().c_str()); focus_sb_lbl->setText((boost::format("%.2f") % focus_sb->getScrollPosition()).str().c_str()); strength_sb_lbl->setText((boost::format("%.2f") % strength_sb->getScrollPosition()).str().c_str()); GUI::render(); } float RaiseWindow::get_radius() { return radius_sb->getScrollPosition(); } float RaiseWindow::get_focus() { return focus_sb->getScrollPosition(); } float RaiseWindow::get_strength() { return strength_sb->getScrollPosition(); }