Example #1
0
/***********************************************************
initalize the box
***********************************************************/
void ChooseNumberBox::Initialize(CEGUI::Window* Root)
{
	try
	{
		_myBox = CEGUI::WindowManager::getSingleton().loadWindowLayout( "choosenumberbox.layout" );
		Root->addChildWindow(_myBox);


		CEGUI::FrameWindow * frw = static_cast<CEGUI::FrameWindow *> (
			CEGUI::WindowManager::getSingleton().getWindow("ChooseNumberBoxFrame"));
		frw->subscribeEvent (
			CEGUI::FrameWindow::EventCloseClicked,
			CEGUI::Event::Subscriber (&ChooseNumberBox::HandleCancel, this));


		static_cast<CEGUI::PushButton *> (
			CEGUI::WindowManager::getSingleton().getWindow("ChooseNumberBoxFrame/bOk"))->subscribeEvent (
			CEGUI::PushButton::EventClicked,
			CEGUI::Event::Subscriber (&ChooseNumberBox::HandleOk, this));

		static_cast<CEGUI::PushButton *> (
			CEGUI::WindowManager::getSingleton().getWindow("ChooseNumberBoxFrame/bCancel"))->subscribeEvent (
			CEGUI::PushButton::EventClicked,
			CEGUI::Event::Subscriber (&ChooseNumberBox::HandleCancel, this));

		_myBox->hide();
	}
	catch(CEGUI::Exception &ex)
	{
		LogHandler::getInstance()->LogToFile(std::string("Exception init ChooseNumberBox: ") + ex.getMessage().c_str());
	}
}
void
CFileSystemDialogImp::OnPostLayoutLoad( void )
{GUCE_TRACE;

    GUCEF::GUI::CFileSystemDialog::OnPostLayoutLoad();
    
    // Try and link the icon imageset
    CEGUI::ImagesetManager* imgSetManager = CEGUI::ImagesetManager::getSingletonPtr();
    if ( imgSetManager->isImagesetPresent( "Icons" ) )
    {
        m_iconsImageSet = imgSetManager->getImageset( "Icons" );
    }

    // Hook up the event handlers
    CEGUI::FrameWindow* window = static_cast< CEGUI::FrameWindow* >( GetWindow()->GetImplementationPtr() );
    window->subscribeEvent( CEGUI::FrameWindow::EventCloseClicked                                ,
                            CEGUI::Event::Subscriber( &CFileSystemDialogImp::OnCancelButtonClick , 
                                                      this                                       ) );    

    CEGUI::MultiColumnList* fsViewWidget = static_cast< CEGUI::MultiColumnList* >( GetFileSystemGridView()->GetImplementationPtr() );
    fsViewWidget->subscribeEvent( CEGUI::MultiColumnList::EventSelectionChanged                   ,
                                  CEGUI::Event::Subscriber( &CFileSystemDialogImp::OnItemSelected , 
                                                            this                                  ) );    
    fsViewWidget->subscribeEvent( CEGUI::MultiColumnList::EventMouseDoubleClick                     ,
                                  CEGUI::Event::Subscriber( &CFileSystemDialogImp::OnItemDblClicked , 
                                                            this                                    ) );  
    CEGUI::PushButton* okButton = static_cast< CEGUI::PushButton* >( GetOkButton()->GetImplementationPtr() );
    okButton->subscribeEvent( CEGUI::PushButton::EventClicked                                  ,
                              CEGUI::Event::Subscriber( &CFileSystemDialogImp::OnOkButtonClick , 
                                                        this                                   ) );
    CEGUI::PushButton* cancelButton = static_cast< CEGUI::PushButton* >( GetCancelButton()->GetImplementationPtr() );
    cancelButton->subscribeEvent( CEGUI::PushButton::EventClicked                                      ,
                                  CEGUI::Event::Subscriber( &CFileSystemDialogImp::OnCancelButtonClick , 
                                                            this                                       ) );
}
Example #3
0
void t_chessGui::initConnect()
{
   CEGUI::FrameWindow *connect = static_cast<CEGUI::FrameWindow *>(wmgr->loadWindowLayout("connect.layout"));

   myRoot->addChildWindow(connect);
   connect->subscribeEvent(CEGUI::FrameWindow::EventCloseClicked,CEGUI::Event::Subscriber(boost::bind(closeConnect,connect,_1)));

   CEGUI::MenuItem *connectItem = static_cast<CEGUI::MenuItem *>(wmgr->getWindow("Root/FrameWindow/Menubar/File/Open"));
   connectItem->subscribeEvent(CEGUI::MenuItem::EventClicked,CEGUI::Event::Subscriber(boost::bind(openConnect,connect,_1)));

   CEGUI::PushButton *newConnectItem = static_cast<CEGUI::PushButton *>(wmgr->getWindow("Lols2"));
   newConnectItem->subscribeEvent(CEGUI::MenuItem::EventClicked,CEGUI::Event::Subscriber(boost::bind(openConnect,connect,_1)));



   CEGUI::PushButton *cancelConnect = static_cast<CEGUI::PushButton *>(wmgr->getWindow("1Lols6"));
   cancelConnect->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(boost::bind(closeConnect,connect,_1)));


   CEGUI::Editbox *name = static_cast<CEGUI::Editbox *>(wmgr->getWindow("1Lols2"));
   CEGUI::Editbox *ip = static_cast<CEGUI::Editbox *>(wmgr->getWindow("1Lols7"));


   CEGUI::PushButton *startConnection = static_cast<CEGUI::PushButton *>(wmgr->getWindow("1Lols4"));
   startConnection->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(boost::bind(connectToServer,name,ip,boost::ref(sharedData),_1)));

   connect->hide();
}
Example #4
0
/***********************************************************
restore the correct size of the windows
***********************************************************/
void JournalBox::RestoreGUISizes()
{
	CEGUI::FrameWindow * frw = static_cast<CEGUI::FrameWindow *> (
		CEGUI::WindowManager::getSingleton().getWindow("JournalFrame"));

	frw->setPosition(CEGUI::UVector2(CEGUI::UDim(_savedPosX, 0), CEGUI::UDim(_savedPosY, 0)));
	frw->setWidth(CEGUI::UDim(_savedSizeX, 0));
	frw->setHeight(CEGUI::UDim(_savedSizeY, 0));
}
Example #5
0
/***********************************************************
save size of windows to be restored after resize of the application
***********************************************************/
void JournalBox::SaveGUISizes(int oldscreenX, int oldscreenY)
{
	CEGUI::FrameWindow * frw = static_cast<CEGUI::FrameWindow *> (
		CEGUI::WindowManager::getSingleton().getWindow("JournalFrame"));

	CEGUI::UVector2 vec = frw->getPosition();
	_savedPosX = vec.d_x.asRelative((float)oldscreenX);
	_savedPosY = vec.d_y.asRelative((float)oldscreenY);
	_savedSizeX = frw->getWidth().asRelative((float)oldscreenX);
	_savedSizeY = frw->getHeight().asRelative((float)oldscreenY);
}
Example #6
0
/*************************************************************************
    Selection EventHandler for the effects Combobox.
*************************************************************************/
bool EffectsDemo::handleEffectsComboboxSelectionChanged(const CEGUI::EventArgs& args)
{
    const CEGUI::WindowEventArgs& winArgs(static_cast<const CEGUI::WindowEventArgs&>(args));

    CEGUI::Combobox* effectsCombobox = static_cast<CEGUI::Combobox*>(winArgs.window);
    CEGUI::ListboxItem* selectionItem = effectsCombobox->getSelectedItem();

    CEGUI::FrameWindow* effectsWindow = static_cast<CEGUI::FrameWindow*>(effectsCombobox->getParent());
    CEGUI::RenderingWindow* effectsWindowRenderingWnd = static_cast<CEGUI::RenderingWindow*>(effectsWindow->getRenderingSurface());

    if(selectionItem == d_listItemEffectElastic)
    {
        effectsWindowRenderingWnd->setRenderEffect(d_renderEffectElastic);
    }
    else if(selectionItem == d_listItemEffectWobblyNew)
    {
        effectsWindowRenderingWnd->setRenderEffect(d_renderEffectWobblyNew);
    }
    else if(selectionItem == d_listItemEffectWobblyOld)
    {
        effectsWindowRenderingWnd->setRenderEffect(d_renderEffectWobblyOld);
    }
    else
    {
        effectsWindowRenderingWnd->setRenderEffect(0);
    }


    return true;
}
Example #7
0
/***********************************************************
initalize the box
***********************************************************/
void LetterViewerBox::Initialize(CEGUI::Window* Root)
{
	try
	{
		_myBox = CEGUI::WindowManager::getSingleton().loadWindowLayout( "letterviewer.layout" );
		Root->addChildWindow(_myBox);

		static_cast<CEGUI::PushButton *> (
			CEGUI::WindowManager::getSingleton().getWindow("LetterViewerGoB"))->subscribeEvent (
			CEGUI::PushButton::EventClicked,
			CEGUI::Event::Subscriber (&LetterViewerBox::HandleOK, this));

		static_cast<CEGUI::PushButton *> (
			CEGUI::WindowManager::getSingleton().getWindow("LetterViewerDestroyB"))->subscribeEvent (
			CEGUI::PushButton::EventClicked,
			CEGUI::Event::Subscriber (&LetterViewerBox::HandleCancel, this));

		CEGUI::FrameWindow * frw = static_cast<CEGUI::FrameWindow *> (
			CEGUI::WindowManager::getSingleton().getWindow("LetterViewerWIndowFrame"));
		frw->subscribeEvent (
			CEGUI::FrameWindow::EventCloseClicked,
			CEGUI::Event::Subscriber (&LetterViewerBox::HandleOK, this));

		_myBox->hide();

		InventoryHandler::getInstance()->SetLetterViewer(this);


		float PosX, PosY, SizeX, SizeY, OPosX, OPosY, OSizeX, OSizeY;
		ConfigurationManager::GetInstance()->GetFloat("Gui.LetterViewerFrame.PosX", PosX);
		ConfigurationManager::GetInstance()->GetFloat("Gui.LetterViewerFrame.PosY", PosY);
		ConfigurationManager::GetInstance()->GetFloat("Gui.LetterViewerFrame.SizeX", SizeX);
		ConfigurationManager::GetInstance()->GetFloat("Gui.LetterViewerFrame.SizeY", SizeY);
		ConfigurationManager::GetInstance()->GetFloat("Gui.LetterViewerFrame.OffsetPosX", OPosX);
		ConfigurationManager::GetInstance()->GetFloat("Gui.LetterViewerFrame.OffsetPosY", OPosY);
		ConfigurationManager::GetInstance()->GetFloat("Gui.LetterViewerFrame.OffsetSizeX", OSizeX);
		ConfigurationManager::GetInstance()->GetFloat("Gui.LetterViewerFrame.OffsetSizeY", OSizeY);
		frw->setPosition(CEGUI::UVector2(CEGUI::UDim(PosX, OPosX), CEGUI::UDim(PosY, OPosY)));
		frw->setWidth(CEGUI::UDim(SizeX, OSizeX));
		frw->setHeight(CEGUI::UDim(SizeY, OSizeY));
	}
	catch(CEGUI::Exception &ex)
	{
		LogHandler::getInstance()->LogToFile(std::string("Exception init LetterEditorBox: ") + ex.getMessage().c_str());
	}
}
Example #8
0
/***********************************************************
add a tab to the chat
***********************************************************/
void ChatBox::AddTab(const std::string & tabName)
{
    CEGUI::TabControl *tc = static_cast<CEGUI::TabControl *>(CEGUI::WindowManager::getSingleton().getWindow ("Chat/TabControl"));

	CEGUI::FrameWindow* fWnd = static_cast<CEGUI::FrameWindow *>(CEGUI::WindowManager::getSingleton().createWindow( "DefaultGUISheet", "Chat/Tab_"+tabName ));
	fWnd->setProperty("Text", (const unsigned char *)tabName.c_str());


	CEGUI::Listbox* txt = static_cast<CEGUI::Listbox *>(CEGUI::WindowManager::getSingleton().createWindow( "TaharezLook/Listbox", "Chat/Tab_"+tabName+"/editMulti" ));
	txt->setProperty("UnifiedMaxSize", "{{1,0},{1,0}}");
	txt->setProperty("UnifiedAreaRect", "{{0,0},{0,1},{1,0},{1,0}}");
	txt->setProperty("ForceVertScrollbar", "True");
	fWnd->addChildWindow(txt);
	tc->addTab (fWnd);

   //txt->subscribeEvent(CEGUI::Editbox::EventKeyDown, CEGUI::Event::Subscriber (&ChatBox::HandleEnterKey, this));
}
Example #9
0
void GUIManager::setHandlers ()
{
  CEGUI::WindowManager & wm = CEGUI::WindowManager::getSingleton();

  CEGUI::FrameWindow *dsFrame = static_cast<CEGUI::FrameWindow *>(
      wm.getWindow("Sheet/DatasetFrame"));
  dsFrame->hide();
  // Handle behavior of options-button
  CEGUI::PushButton *button = static_cast<CEGUI::PushButton *>(
      wm.getWindow("Sheet/Options"));
  button->subscribeEvent(CEGUI::PushButton::EventClicked,
      CEGUI::Event::Subscriber(&GUIManager::handleOptionsVisibility, this));
  button = dsFrame->getCloseButton();
  button->subscribeEvent(CEGUI::PushButton::EventClicked,
      CEGUI::Event::Subscriber(&GUIManager::handleOptionsVisibility, this));
  // Connect activate buttons on tabs
  auto connectFrames = [=](CEGUI::Window *tab) {
    CEGUI::PushButton *button =
      static_cast<CEGUI::PushButton *>(tab->getChild(3));
    button->subscribeEvent(CEGUI::PushButton::EventClicked,
        CEGUI::Event::Subscriber(&GUIManager::handleDSActivation, this));
    button = static_cast<CEGUI::PushButton *>(tab->getChild(4));
    button->subscribeEvent(CEGUI::PushButton::EventClicked,
        CEGUI::Event::Subscriber(&GUIManager::handleDSDeactivation, this));
    CEGUI::Scrollbar *sb = static_cast<CEGUI::Scrollbar *>(tab->getChild(2));
    sb->subscribeEvent(CEGUI::Scrollbar::EventScrollPositionChanged,
        CEGUI::Event::Subscriber(&GUIManager::handleScrollbarChanged, this));
    CEGUI::Listbox *lb = static_cast<CEGUI::Listbox *>(tab->getChild(0));
    lb->subscribeEvent(CEGUI::Listbox::EventSelectionChanged,
        CEGUI::Event::Subscriber(&GUIManager::handleDSSelection, this));
  };
  CEGUI::Window *tab =  wm.getWindow("Sheet/DatasetFrame/TabControl/HTab");
  connectFrames(tab);
  tab = wm.getWindow("Sheet/DatasetFrame/TabControl/PTab");
  connectFrames(tab);
  tab = wm.getWindow("Sheet/DatasetFrame/TabControl/CTab");
  connectFrames(tab);
  CEGUI::Scrollbar *sb = static_cast<CEGUI::Scrollbar *>(
      wm.getWindow("Sheet/DimensionSlider"));
  sb->subscribeEvent(CEGUI::Scrollbar::EventScrollPositionChanged,
      CEGUI::Event::Subscriber(&GUIManager::handleBigScrollbarChanged, this));
}
Example #10
0
GameDesktop::GameDesktop(sf::RenderWindow &screen)
  : screen_(screen),
    renderer_(CEGUI::OpenGLRenderer::bootstrapSystem())
{
  // Set up default resource groups
  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/");

  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");

  // Set up the GUI
  CEGUI::SchemeManager::getSingleton().createFromFile("WindowsLook.scheme");
  CEGUI::FontManager::getSingleton().createFromFile("DejaVuSans-10.font");

  CEGUI::System::getSingleton().getDefaultGUIContext().getMouseCursor().setDefaultImage("WindowsLook/MouseArrow");

  CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();
  CEGUI::Window *root = wmgr.createWindow("DefaultWindow", "root");
  root->setProperty("MousePassThroughEnabled", "True");
  CEGUI::System::getSingleton().getDefaultGUIContext().setRootWindow(root);

  CEGUI::FrameWindow *fw = static_cast<CEGUI::FrameWindow*>(wmgr.createWindow("WindowsLook/FrameWindow", "testWindow"));

  root->addChild(fw);
  fw->setText("Hello World!");

  // Initialize SFML-to-CEGUI key mapping
  initializeKeyMap();
  screen_.setView(view_);
}
Example #11
0
void t_chessGui::initServer()
{
   CEGUI::FrameWindow *server = static_cast<CEGUI::FrameWindow *>(wmgr->loadWindowLayout("server.layout"));
   myRoot->addChildWindow(server);
   server->subscribeEvent(CEGUI::FrameWindow::EventCloseClicked,CEGUI::Event::Subscriber(boost::bind(closeServer,server,_1)));


   CEGUI::MenuItem *serverItem = static_cast<CEGUI::MenuItem *>(wmgr->getWindow("Root/FrameWindow/Menubar/File/New"));
   serverItem->subscribeEvent(CEGUI::MenuItem::EventClicked,CEGUI::Event::Subscriber(boost::bind(openServer,server,_1)));


   CEGUI::MultiColumnList *testing = static_cast<CEGUI::MultiColumnList *>(wmgr->getWindow("Lols3"));
   testing->addColumn("Names",0,CEGUI::UDim(.25,0));
   testing->addColumn("Action",1,CEGUI::UDim(.25,0));
   testing->addColumn("Wins",2,CEGUI::UDim(.25,0));
   testing->addColumn("Losses",3,CEGUI::UDim(.25,0));

   testing->addRow();
   testing->addRow();

   testing->setItem(new CEGUI::ListboxTextItem("What, wow,"),0u,0u);

   server->hide();
}
Example #12
0
/***********************************************************
initalize the box
***********************************************************/
void TeleportBox::Initialize(CEGUI::Window* Root)
{
	try
	{
		_myBox = CEGUI::WindowManager::getSingleton().loadWindowLayout( "TeleportBox.layout" );
		Root->addChildWindow(_myBox);


		static_cast<CEGUI::PushButton *> (
			CEGUI::WindowManager::getSingleton().getWindow("TeleportCancelButton"))->subscribeEvent (
			CEGUI::PushButton::EventClicked,
			CEGUI::Event::Subscriber (&TeleportBox::HandleClose, this));

		static_cast<CEGUI::PushButton *> (
			CEGUI::WindowManager::getSingleton().getWindow("TeleporGoButton"))->subscribeEvent (
			CEGUI::PushButton::EventClicked,
			CEGUI::Event::Subscriber (&TeleportBox::HandleGoButton, this));


		CEGUI::FrameWindow * frw = static_cast<CEGUI::FrameWindow *> (
			CEGUI::WindowManager::getSingleton().getWindow("TeleportFrame"));
		frw->subscribeEvent (
			CEGUI::FrameWindow::EventCloseClicked,
			CEGUI::Event::Subscriber (&TeleportBox::HandleClose, this));

		float PosX, PosY, SizeX, SizeY, OPosX, OPosY, OSizeX, OSizeY;
		bool Visible;
		ConfigurationManager::GetInstance()->GetFloat("Gui.Teleportbox.PosX", PosX);
		ConfigurationManager::GetInstance()->GetFloat("Gui.Teleportbox.PosY", PosY);
		ConfigurationManager::GetInstance()->GetFloat("Gui.Teleportbox.SizeX", SizeX);
		ConfigurationManager::GetInstance()->GetFloat("Gui.Teleportbox.SizeY", SizeY);
		ConfigurationManager::GetInstance()->GetFloat("Gui.Teleportbox.OffsetPosX", OPosX);
		ConfigurationManager::GetInstance()->GetFloat("Gui.Teleportbox.OffsetPosY", OPosY);
		ConfigurationManager::GetInstance()->GetFloat("Gui.Teleportbox.OffsetSizeX", OSizeX);
		ConfigurationManager::GetInstance()->GetFloat("Gui.Teleportbox.OffsetSizeY", OSizeY);
		ConfigurationManager::GetInstance()->GetBool("Gui.Teleportbox.Visible", Visible);
		frw->setPosition(CEGUI::UVector2(CEGUI::UDim(PosX, OPosX), CEGUI::UDim(PosY, OPosY)));
		frw->setWidth(CEGUI::UDim(SizeX, OSizeX));
		frw->setHeight(CEGUI::UDim(SizeY, OSizeY));

		if(Visible)
			frw->show();
		else
			frw->hide();
	}
	catch(CEGUI::Exception &ex)
	{
		LogHandler::getInstance()->LogToFile(std::string("Exception init teleport box: ") + ex.getMessage().c_str());
	}
}
Example #13
0
/***********************************************************
destructor
***********************************************************/
LetterViewerBox::~LetterViewerBox()
{
	{
		CEGUI::FrameWindow * frw = static_cast<CEGUI::FrameWindow *> (
			CEGUI::WindowManager::getSingleton().getWindow("LetterViewerWIndowFrame"));

		CEGUI::UVector2 vec = frw->getPosition();
		ConfigurationManager::GetInstance()->SetFloat("Gui.LetterViewerFrame.PosX", vec.d_x.d_scale);
		ConfigurationManager::GetInstance()->SetFloat("Gui.LetterViewerFrame.PosY", vec.d_y.d_scale);
		ConfigurationManager::GetInstance()->SetFloat("Gui.LetterViewerFrame.SizeX", frw->getWidth().d_scale);
		ConfigurationManager::GetInstance()->SetFloat("Gui.LetterViewerFrame.SizeY", frw->getHeight().d_scale);
		ConfigurationManager::GetInstance()->SetFloat("Gui.LetterViewerFrame.OffsetPosX", vec.d_x.d_offset);
		ConfigurationManager::GetInstance()->SetFloat("Gui.LetterViewerFrame.OffsetPosY", vec.d_y.d_offset);
		ConfigurationManager::GetInstance()->SetFloat("Gui.LetterViewerFrame.OffsetSizeX", frw->getWidth().d_offset);
		ConfigurationManager::GetInstance()->SetFloat("Gui.LetterViewerFrame.OffsetSizeY", frw->getHeight().d_offset);
	}
}
Example #14
0
/***********************************************************
destructor
***********************************************************/
CommunityBox::~CommunityBox()
{
	try
	{
		CEGUI::FrameWindow * frw = static_cast<CEGUI::FrameWindow *> (
			CEGUI::WindowManager::getSingleton().getWindow("CommunityFrame"));

		CEGUI::UVector2 vec = frw->getPosition();
		ConfigurationManager::GetInstance()->SetFloat("Gui.Communitybox.PosX", vec.d_x.d_scale);
		ConfigurationManager::GetInstance()->SetFloat("Gui.Communitybox.PosY", vec.d_y.d_scale);
		ConfigurationManager::GetInstance()->SetFloat("Gui.Communitybox.SizeX", frw->getWidth().d_scale);
		ConfigurationManager::GetInstance()->SetFloat("Gui.Communitybox.SizeY", frw->getHeight().d_scale);
		ConfigurationManager::GetInstance()->SetFloat("Gui.Communitybox.OffsetPosX", vec.d_x.d_offset);
		ConfigurationManager::GetInstance()->SetFloat("Gui.Communitybox.OffsetPosY", vec.d_y.d_offset);
		ConfigurationManager::GetInstance()->SetFloat("Gui.Communitybox.OffsetSizeX", frw->getWidth().d_offset);
		ConfigurationManager::GetInstance()->SetFloat("Gui.Communitybox.OffsetSizeY", frw->getHeight().d_offset);
		ConfigurationManager::GetInstance()->SetBool("Gui.Communitybox.Visible", frw->isVisible());
	}
	catch(CEGUI::Exception &ex)
	{
		LogHandler::getInstance()->LogToFile(std::string("Exception destructor community box: ") + ex.getMessage().c_str());
	}
}
Example #15
0
    void run()
    {

        quit = false;

        CL_DisplayWindowDescription window_desc;
        window_desc.set_size(CL_Size(sizex, sizey), true);
        window_desc.set_title("Chess");
        window_desc.set_allow_resize(true);
        CL_DisplayWindow window(window_desc);

        CL_Slot slot_quit = window.sig_window_close().connect(this, &SpritesExample::on_window_close);
        window.func_window_resize().set(this, &SpritesExample::resize);

        CL_GraphicContext gc = window.get_gc();
        CL_InputDevice keyboard = window.get_ic().get_keyboard();

        CL_ResourceManager resources("resources.xml");

        CL_Image lol(gc,"Board",&resources);

        CEGUI::OpenGLRenderer & myRenderer = CEGUI::OpenGLRenderer::bootstrapSystem();

        CEGUI::WindowManager& winMgr = CEGUI::WindowManager::getSingleton();

        CEGUI::DefaultWindow* root = (CEGUI::DefaultWindow*)winMgr.createWindow("DefaultWindow", "Root");

        CEGUI::SchemeManager::getSingleton().create("TaharezLook.scheme");
        CEGUI::System::getSingleton().setDefaultMouseCursor("TaharezLook", "MouseArrow");

        CEGUI::FrameWindow* wnd = (CEGUI::FrameWindow*)winMgr.createWindow("TaharezLook/FrameWindow", "Demo Window");

        root->addChildWindow(wnd);

        wnd->setPosition(CEGUI::UVector2(cegui_reldim(0.25f), cegui_reldim( 0.25f)));
        wnd->setSize(CEGUI::UVector2(cegui_reldim(0.5f), cegui_reldim( 0.5f)));

        // now we set the maximum and minum sizes for the new window.  These are
        // specified using relative co-ordinates, but the important thing to note
        // is that these settings are aways relative to the display rather than the
        // parent window.
        //
        // here we set a maximum size for the FrameWindow which is equal to the size
        // of the display, and a minimum size of one tenth of the display.
        wnd->setMaxSize(CEGUI::UVector2(cegui_reldim(1.0f), cegui_reldim( 1.0f)));
        wnd->setMinSize(CEGUI::UVector2(cegui_reldim(0.1f), cegui_reldim( 0.1f)));

        // As a final step in the initialisation of our sample window, we set the window's
        // text to "Hello World!", so that this text will appear as the caption in the
        // FrameWindow's titlebar.
        wnd->setText("Hello World!");
        CEGUI::System::getSingleton().renderGUI();
        window.flip();

        while (!quit)
        {
            if(keyboard.get_keycode(CL_KEY_ESCAPE) == true)
                quit = true;


            CL_Colorf red(155/255.0f, 60/255.0f, 68/255.0f);
            //CL_Draw::fill(gc, CL_Rectf(0, sizey, sizex, 0), red);
            //lol.draw(gc,CL_Rectf(0,sizey,sizex,0));
            //CEGUI::System::getSingleton().renderGUI();

            //window.flip();
            CL_KeepAlive::process();
            CL_System::sleep(10);
        }
    }
Example #16
0
/***********************************************************
initalize the box
***********************************************************/
void CommunityBox::Initialize(CEGUI::Window* Root)
{
	try
	{
		_myBox = CEGUI::WindowManager::getSingleton().loadWindowLayout( "community.layout" );
		Root->addChildWindow(_myBox);

		CEGUI::FrameWindow * frw = static_cast<CEGUI::FrameWindow *> (
			CEGUI::WindowManager::getSingleton().getWindow("CommunityFrame"));
		frw->subscribeEvent (
			CEGUI::FrameWindow::EventCloseClicked,
			CEGUI::Event::Subscriber (&CommunityBox::HandleClose, this));

		float PosX, PosY, SizeX, SizeY, OPosX, OPosY, OSizeX, OSizeY;
		bool Visible;
		ConfigurationManager::GetInstance()->GetFloat("Gui.Communitybox.PosX", PosX);
		ConfigurationManager::GetInstance()->GetFloat("Gui.Communitybox.PosY", PosY);
		ConfigurationManager::GetInstance()->GetFloat("Gui.Communitybox.SizeX", SizeX);
		ConfigurationManager::GetInstance()->GetFloat("Gui.Communitybox.SizeY", SizeY);
		ConfigurationManager::GetInstance()->GetFloat("Gui.Communitybox.OffsetPosX", OPosX);
		ConfigurationManager::GetInstance()->GetFloat("Gui.Communitybox.OffsetPosY", OPosY);
		ConfigurationManager::GetInstance()->GetFloat("Gui.Communitybox.OffsetSizeX", OSizeX);
		ConfigurationManager::GetInstance()->GetFloat("Gui.Communitybox.OffsetSizeY", OSizeY);
		ConfigurationManager::GetInstance()->GetBool("Gui.Communitybox.Visible", Visible);
		frw->setPosition(CEGUI::UVector2(CEGUI::UDim(PosX, OPosX), CEGUI::UDim(PosY, OPosY)));
		frw->setWidth(CEGUI::UDim(SizeX, OSizeX));
		frw->setHeight(CEGUI::UDim(SizeY, OSizeY));

		static_cast<CEGUI::PushButton *> (
			CEGUI::WindowManager::getSingleton().getWindow("CommunityFrame/friendAdd"))->subscribeEvent (
			CEGUI::PushButton::EventClicked,
			CEGUI::Event::Subscriber (&CommunityBox::HandleAddFriend, this));

		static_cast<CEGUI::PushButton *> (
			CEGUI::WindowManager::getSingleton().getWindow("CommunityFrame/friendRemove"))->subscribeEvent (
			CEGUI::PushButton::EventClicked,
			CEGUI::Event::Subscriber (&CommunityBox::HandleRemoveFriend, this));

		static_cast<CEGUI::PushButton *> (
			CEGUI::WindowManager::getSingleton().getWindow("CommunityFrame/friendRefresh"))->subscribeEvent (
			CEGUI::PushButton::EventClicked,
			CEGUI::Event::Subscriber (&CommunityBox::HandleRefreshFriend, this));




		_myChooseName = CEGUI::WindowManager::getSingleton().loadWindowLayout( "AddFriendName.layout" );
		_myChooseName->setProperty("AlwaysOnTop", "True");
		Root->addChildWindow(_myChooseName);
		_myChooseName->hide();

		{
			CEGUI::FrameWindow * fw = static_cast<CEGUI::FrameWindow *>(_myChooseName);
			fw->subscribeEvent (	CEGUI::FrameWindow::EventCloseClicked,
									CEGUI::Event::Subscriber (&CommunityBox::HandleCPCancel, this) );

			static_cast<CEGUI::PushButton *> (
				CEGUI::WindowManager::getSingleton().getWindow("Chat/AddFriendName/bOk"))->subscribeEvent (
				CEGUI::PushButton::EventClicked,
				CEGUI::Event::Subscriber (&CommunityBox::HandleCPOk, this));

			static_cast<CEGUI::PushButton *> (
				CEGUI::WindowManager::getSingleton().getWindow("Chat/AddFriendName/bCancel"))->subscribeEvent (
				CEGUI::PushButton::EventClicked,
				CEGUI::Event::Subscriber (&CommunityBox::HandleCPCancel, this));
		}


		static_cast<CEGUI::Listbox *> (
			CEGUI::WindowManager::getSingleton().getWindow("Community/friendlist"))->subscribeEvent (
			CEGUI::Listbox::EventMouseDoubleClick,
			CEGUI::Event::Subscriber (&CommunityBox::HandleListdblClick, this));


		static_cast<CEGUI::Listbox *> (
			CEGUI::WindowManager::getSingleton().getWindow("Community/onlinelist"))->subscribeEvent (
			CEGUI::Listbox::EventMouseDoubleClick,
			CEGUI::Event::Subscriber (&CommunityBox::HandleConnecteddblClick, this));
		
		if(Visible)
			frw->show();
		else
			frw->hide();

	}
	catch(CEGUI::Exception &ex)
	{
		LogHandler::getInstance()->LogToFile(std::string("Exception init community box: ") + ex.getMessage().c_str());
	}
}
Example #17
0
/***********************************************************
initalize the box
***********************************************************/
void JournalBox::Initialize(CEGUI::Window* Root)
{
	try
	{
		_myBox = CEGUI::WindowManager::getSingleton().loadWindowLayout( "questbook.layout",
								"", "", &MyPropertyCallback);
		Root->addChildWindow(_myBox);


		CEGUI::FrameWindow * frw = static_cast<CEGUI::FrameWindow *> (
			CEGUI::WindowManager::getSingleton().getWindow("JournalFrame"));
		frw->subscribeEvent (
			CEGUI::FrameWindow::EventCloseClicked,
			CEGUI::Event::Subscriber (&JournalBox::HandleClose, this));

		CEGUI::Tree * tree = static_cast<CEGUI::Tree *> (
			CEGUI::WindowManager::getSingleton().getWindow("Root/JournalWin/tab/questtab/Tree"));

		tree->subscribeEvent(CEGUI::Listbox::EventSelectionChanged,
							CEGUI::Event::Subscriber (&JournalBox::HandleQuestTreeSelected, this));


		CEGUI::Tree * tree2 = static_cast<CEGUI::Tree *> (
			CEGUI::WindowManager::getSingleton().getWindow("Root/JournalWin/tab/questdonetab/Tree"));

		tree2->subscribeEvent(CEGUI::Listbox::EventSelectionChanged,
							CEGUI::Event::Subscriber (&JournalBox::HandleQuestDoneTreeSelected, this));


		float PosX = ConfigurationManager::GetInstance()->GetValue("Gui.JournalBox.PosX", 0.65f);
		float PosY = ConfigurationManager::GetInstance()->GetValue("Gui.JournalBox.PosY", 0.56f);
		float SizeX = ConfigurationManager::GetInstance()->GetValue("Gui.JournalBox.SizeX", 0.35f);
		float SizeY = ConfigurationManager::GetInstance()->GetValue("Gui.JournalBox.SizeY", 0.34f);
		bool Visible = ConfigurationManager::GetInstance()->GetValue("Gui.JournalBox.Visible", false);
		frw->setPosition(CEGUI::UVector2(CEGUI::UDim(PosX, 0), CEGUI::UDim(PosY, 0)));
		frw->setWidth(CEGUI::UDim(SizeX, 0));
		frw->setHeight(CEGUI::UDim(SizeY, 0));

		if(Visible)
			frw->show();
		else
			frw->hide();


		// get quest topic tree which should be opened
		std::string treeqopen = ConfigurationManager::GetInstance()->GetValue<std::string>("Gui.JournalBox.QuestTreeOpen", "");
		std::string treedqopen = ConfigurationManager::GetInstance()->GetValue<std::string>("Gui.JournalBox.QuestDoneTreeOpen", "");

		_selected_tree_quests = ConfigurationManager::GetInstance()->GetValue<std::string>("Gui.JournalBox.QuestTreeSelected", "");
		_selected_tree_done_quests = ConfigurationManager::GetInstance()->GetValue<std::string>("Gui.JournalBox.QuestDoneTreeSelected", "");

		StringHelper::Tokenize(treeqopen, _open_tree_quests, "##");
		StringHelper::Tokenize(treedqopen, _open_tree_done_quests, "##");


		static_cast<CEGUI::TabControl *> (
			CEGUI::WindowManager::getSingleton().getWindow("Root/JournalWin/tab"))->setSelectedTab("Root/JournalWin/tab/questtab");
	}
	catch(CEGUI::Exception &ex)
	{
		LogHandler::getInstance()->LogToFile(std::string("Exception init InventoryBox: ") + ex.getMessage().c_str());
	}
}
Example #18
0
/***********************************************************
initalize the box
***********************************************************/
void ContainerBox::Initialize(CEGUI::Window* Root)
{
	try
	{
		_myBox = CEGUI::WindowManager::getSingleton().loadWindowLayout( "container.layout" );
		Root->addChildWindow(_myBox);


		CEGUI::FrameWindow * frw = static_cast<CEGUI::FrameWindow *> (
			CEGUI::WindowManager::getSingleton().getWindow("ContainerFrame"));
		frw->subscribeEvent (
			CEGUI::FrameWindow::EventCloseClicked,
			CEGUI::Event::Subscriber (&ContainerBox::HandleCancel, this));


		static_cast<CEGUI::PushButton *> (
			CEGUI::WindowManager::getSingleton().getWindow("ContainerFrame/OK"))->subscribeEvent (
			CEGUI::PushButton::EventClicked,
			CEGUI::Event::Subscriber (&ContainerBox::HandleOk, this));

		static_cast<CEGUI::PushButton *> (
			CEGUI::WindowManager::getSingleton().getWindow("ContainerFrame/TakeAll"))->subscribeEvent (
			CEGUI::PushButton::EventClicked,
			CEGUI::Event::Subscriber (&ContainerBox::HandleTakeAll, this));

		static_cast<CEGUI::PushButton *> (
			CEGUI::WindowManager::getSingleton().getWindow("ContainerFrame/Cancel"))->subscribeEvent (
			CEGUI::PushButton::EventClicked,
			CEGUI::Event::Subscriber (&ContainerBox::HandleCancel, this));


		CEGUI::Window*	pane = CEGUI::WindowManager::getSingleton().getWindow("ContainerFrame/ConScrollable");
		CEGUI::Window*	tmpwindow;
		for(int i=0; i<_NB_BOX_CONTAINER_; ++i)
		{
			int x = i / 3;
			int y = i % 3;

			tmpwindow = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/StaticText");
			tmpwindow->setArea(CEGUI::UDim(0,5+((float)_boxsize+2)*y), CEGUI::UDim(0,5+((float)_boxsize+2)*x), 
								CEGUI::UDim(0, (float)_boxsize), CEGUI::UDim(0, (float)_boxsize));
			pane->addChildWindow(tmpwindow);

			tmpwindow->subscribeEvent(
						CEGUI::Window::EventDragDropItemDropped,
						CEGUI::Event::Subscriber(&ContainerBox::handle_ItemDroppedInContainer, this));

			tmpwindow->setID(i);
			_cont_boxes.push_back(tmpwindow);
		}



		frw->show();
		_myBox->hide();

		frw->subscribeEvent(CEGUI::Window::EventKeyDown,
			CEGUI::Event::Subscriber (&ContainerBox::HandleEnterKey, this));
	}
	catch(CEGUI::Exception &ex)
	{
		LogHandler::getInstance()->LogToFile(std::string("Exception init ContainerBox: ") + ex.getMessage().c_str());
	}
}
Example #19
0
/***********************************************************
init function
***********************************************************/
void LoginGUI::Initialize(const std::string &clientversion)
{
	try
	{
		_root = CEGUI::WindowManager::getSingleton().loadWindowLayout( "LoginWindow.layout" );

		static_cast<CEGUI::PushButton *> (
			CEGUI::WindowManager::getSingleton().getWindow("ConnectB"))->subscribeEvent (
			CEGUI::PushButton::EventClicked,
			CEGUI::Event::Subscriber (&LoginGUI::HandleConnect, this));

		static_cast<CEGUI::PushButton *> (
			CEGUI::WindowManager::getSingleton().getWindow("CancelB"))->subscribeEvent (
			CEGUI::PushButton::EventClicked,
			CEGUI::Event::Subscriber (&LoginGUI::HandleCancel, this));

		static_cast<CEGUI::PushButton *> (
			CEGUI::WindowManager::getSingleton().getWindow("LoginWindowPlayerFrame/plus"))->subscribeEvent (
			CEGUI::PushButton::EventClicked,
			CEGUI::Event::Subscriber (&LoginGUI::Handlebplus, this));

		static_cast<CEGUI::PushButton *> (
			CEGUI::WindowManager::getSingleton().getWindow("LoginWindowPlayerFrame/minus"))->subscribeEvent (
			CEGUI::PushButton::EventClicked,
			CEGUI::Event::Subscriber (&LoginGUI::Handlebminus, this));

		static_cast<CEGUI::PushButton *> (
			CEGUI::WindowManager::getSingleton().getWindow("LoginWindowPlayerFrame/cplus"))->subscribeEvent (
			CEGUI::PushButton::EventClicked,
			CEGUI::Event::Subscriber (&LoginGUI::Handlecplus, this));

		static_cast<CEGUI::PushButton *> (
			CEGUI::WindowManager::getSingleton().getWindow("LoginWindowPlayerFrame/cminus"))->subscribeEvent (
			CEGUI::PushButton::EventClicked,
			CEGUI::Event::Subscriber (&LoginGUI::Handlecminus, this));

		CEGUI::WindowManager::getSingleton().getWindow("LBaNetLogo")->disable();
		CEGUI::WindowManager::getSingleton().getWindow("LBaNetLogoCenter")->disable();

		CEGUI::Editbox * pt = static_cast<CEGUI::Editbox *> (
				CEGUI::WindowManager::getSingleton().getWindow("PasswordText"));
		if(pt)
			pt->setTextMasked(true);

		std::string name;
		ConfigurationManager::GetInstance()->GetString("Player.Name", name);
		CEGUI::Editbox * lt = static_cast<CEGUI::Editbox *> (
				CEGUI::WindowManager::getSingleton().getWindow("LoginText"));
		lt->setText(name);

		CEGUI::WindowManager::getSingleton().getWindow("DisplayLoginErrorFrame")->hide();

		static_cast<CEGUI::FrameWindow *>(
			CEGUI::WindowManager::getSingleton().getWindow("LoginWindowPlayerFrame"))->setDragMovingEnabled(false);

		static_cast<CEGUI::FrameWindow *>(
			CEGUI::WindowManager::getSingleton().getWindow("LoginWindowPlayerFrame"))->setRollupEnabled(false);

		static_cast<CEGUI::FrameWindow *>(
			CEGUI::WindowManager::getSingleton().getWindow("LoginWIndowFrame"))->setDragMovingEnabled(false);

		static_cast<CEGUI::FrameWindow *>(
			CEGUI::WindowManager::getSingleton().getWindow("LoginWIndowFrame"))->setRollupEnabled(false);


		static_cast<CEGUI::PushButton *> (CEGUI::WindowManager::getSingleton().getWindow("DisplayLoginErrorFrame/bok"))->subscribeEvent (
			CEGUI::PushButton::EventClicked,
			CEGUI::Event::Subscriber (&LoginGUI::HandleCloseTextClicked, this));

		CEGUI::FrameWindow * frw = static_cast<CEGUI::FrameWindow *> (
			CEGUI::WindowManager::getSingleton().getWindow("DisplayLoginErrorFrame"));
		frw->subscribeEvent (CEGUI::FrameWindow::EventCloseClicked,
			CEGUI::Event::Subscriber (&LoginGUI::HandleCloseTextClicked, this));

		CEGUI::WindowManager::getSingleton().getWindow("ClientVersionText")->setText(clientversion);


		CEGUI::WindowManager::getSingleton().getWindow("PasswordText")->subscribeEvent(CEGUI::Window::EventKeyDown,
			CEGUI::Event::Subscriber (&LoginGUI::HandleEnterKey, this));
	}
	catch(CEGUI::Exception &ex)
	{
		LogHandler::getInstance()->LogToFile(std::string("Exception init login gui: ") + ex.getMessage().c_str());
		_root = NULL;
	}
}
Example #20
0
/***********************************************************
initalize the box
***********************************************************/
void ChatBox::Initialize(CEGUI::Window* Root)
{
	try
	{
		_myChat = CEGUI::WindowManager::getSingleton().loadWindowLayout( "chatbox.layout" );
		Root->addChildWindow(_myChat);
		//tc->setProperty( "InheritsAlpha", "false" );

		AddTab("All");
		AddTab("World");
		AddTab("Map");
		AddTab("IRC");

		static_cast<CEGUI::PushButton *> (
			CEGUI::WindowManager::getSingleton().getWindow("Chat/bChannel"))->subscribeEvent (
			CEGUI::PushButton::EventClicked,
			CEGUI::Event::Subscriber (&ChatBox::HandleBChannel, this));

		static_cast<CEGUI::PushButton *> (
			CEGUI::WindowManager::getSingleton().getWindow("Chat/bSend"))->subscribeEvent (
			CEGUI::PushButton::EventClicked,
			CEGUI::Event::Subscriber (&ChatBox::HandleSend, this));

		static_cast<CEGUI::Editbox *> (
			CEGUI::WindowManager::getSingleton().getWindow("Chat/edit"))->subscribeEvent (
			CEGUI::Editbox::EventKeyDown,
			CEGUI::Event::Subscriber (&ChatBox::HandleEnterKey, this));

		static_cast<CEGUI::Editbox *> (
			CEGUI::WindowManager::getSingleton().getWindow("Chat/edit"))->subscribeEvent (
			CEGUI::Editbox::EventKeyUp,
			CEGUI::Event::Subscriber (&ChatBox::HandleReleaseKey, this));

		_lb = static_cast<CEGUI::Listbox *>
			(CEGUI::WindowManager::getSingleton().createWindow( "TaharezLook/Listbox", "Chat/listchannel" ));

		_lb->subscribeEvent(CEGUI::Listbox::EventSelectionChanged,
							CEGUI::Event::Subscriber (&ChatBox::HandleLbSelected, this));


		_lb->setProperty("Text", "Channels");
		_lb->setProperty("UnifiedMaxSize", "{{1,0},{1,0}}");
		_lb->setProperty("UnifiedAreaRect", "{{0,10},{1,-160},{0,120},{1,-40}}");
		_lb->setProperty("AlwaysOnTop", "True");

		_myChat->addChildWindow(_lb);
		_lb->hide();

		_myChannels = CEGUI::WindowManager::getSingleton().loadWindowLayout( "choosechannel.layout" );
		_myChannels->setProperty("AlwaysOnTop", "True");
		Root->addChildWindow(_myChannels);
		_myChannels->hide();

		_myChooseName = CEGUI::WindowManager::getSingleton().loadWindowLayout( "choosePlayerName.layout" );
		_myChooseName->setProperty("AlwaysOnTop", "True");
		Root->addChildWindow(_myChooseName);
		_myChooseName->hide();


		{
			CEGUI::FrameWindow * fw = static_cast<CEGUI::FrameWindow *>(_myChannels);
			fw->subscribeEvent (	CEGUI::FrameWindow::EventCloseClicked,
									CEGUI::Event::Subscriber (&ChatBox::HandleCCCancel, this) );

			static_cast<CEGUI::PushButton *> (
				CEGUI::WindowManager::getSingleton().getWindow("Chat/chooseChannel/bOk"))->subscribeEvent (
				CEGUI::PushButton::EventClicked,
				CEGUI::Event::Subscriber (&ChatBox::HandleCCOk, this));

			static_cast<CEGUI::PushButton *> (
				CEGUI::WindowManager::getSingleton().getWindow("Chat/chooseChannel/bCancel"))->subscribeEvent (
				CEGUI::PushButton::EventClicked,
				CEGUI::Event::Subscriber (&ChatBox::HandleCCCancel, this));
		}


		{
			CEGUI::FrameWindow * fw = static_cast<CEGUI::FrameWindow *>(_myChooseName);
			fw->subscribeEvent (	CEGUI::FrameWindow::EventCloseClicked,
									CEGUI::Event::Subscriber (&ChatBox::HandleCPCancel, this) );

			static_cast<CEGUI::PushButton *> (
				CEGUI::WindowManager::getSingleton().getWindow("Chat/choosePlayerName/bOk"))->subscribeEvent (
				CEGUI::PushButton::EventClicked,
				CEGUI::Event::Subscriber (&ChatBox::HandleCPOk, this));

			static_cast<CEGUI::PushButton *> (
				CEGUI::WindowManager::getSingleton().getWindow("Chat/choosePlayerName/bCancel"))->subscribeEvent (
				CEGUI::PushButton::EventClicked,
				CEGUI::Event::Subscriber (&ChatBox::HandleCPCancel, this));
		}


		CEGUI::FrameWindow * frw = static_cast<CEGUI::FrameWindow *> (
			CEGUI::WindowManager::getSingleton().getWindow("ChatFrame"));
		frw->subscribeEvent (CEGUI::FrameWindow::EventCloseClicked,
			CEGUI::Event::Subscriber (&ChatBox::HandleCloseChatbox, this));

		float PosX, PosY, SizeX, SizeY, OPosX, OPosY, OSizeX, OSizeY;
		bool Visible;
		ConfigurationManager::GetInstance()->GetFloat("Gui.Chatbox.PosX", PosX);
		ConfigurationManager::GetInstance()->GetFloat("Gui.Chatbox.PosY", PosY);
		ConfigurationManager::GetInstance()->GetFloat("Gui.Chatbox.SizeX", SizeX);
		ConfigurationManager::GetInstance()->GetFloat("Gui.Chatbox.SizeY", SizeY);
		ConfigurationManager::GetInstance()->GetFloat("Gui.Chatbox.OffsetPosX", OPosX);
		ConfigurationManager::GetInstance()->GetFloat("Gui.Chatbox.OffsetPosY", OPosY);
		ConfigurationManager::GetInstance()->GetFloat("Gui.Chatbox.OffsetSizeX", OSizeX);
		ConfigurationManager::GetInstance()->GetFloat("Gui.Chatbox.OffsetSizeY", OSizeY);
		ConfigurationManager::GetInstance()->GetBool("Gui.Chatbox.Visible", Visible);
		frw->setPosition(CEGUI::UVector2(CEGUI::UDim(PosX, OPosX), CEGUI::UDim(PosY, OPosY)));
		frw->setWidth(CEGUI::UDim(SizeX, OSizeX));
		frw->setHeight(CEGUI::UDim(SizeY, OSizeY));

		if(Visible)
			frw->show();
		else
			frw->hide();
	}
	catch(CEGUI::Exception &ex)
	{
		LogHandler::getInstance()->LogToFile(std::string("Exception init chatbox: ") + ex.getMessage().c_str());
	}
}
Example #21
0
/***********************************************************
destructor
***********************************************************/
JournalBox::~JournalBox()
{
	try
	{
		CEGUI::FrameWindow * frw = static_cast<CEGUI::FrameWindow *> (
			CEGUI::WindowManager::getSingleton().getWindow("JournalFrame"));

		int resX, resY; 
		bool fullscreen;
		OsgHandler::getInstance()->GetScreenAttributes(resX, resY, fullscreen);

		CEGUI::UVector2 vec = frw->getPosition();
		ConfigurationManager::GetInstance()->SetValue("Gui.JournalBox.PosX", vec.d_x.asRelative((float)resX));
		ConfigurationManager::GetInstance()->SetValue("Gui.JournalBox.PosY", vec.d_y.asRelative((float)resY));
		ConfigurationManager::GetInstance()->SetValue("Gui.JournalBox.SizeX", frw->getWidth().asRelative((float)resX));
		ConfigurationManager::GetInstance()->SetValue("Gui.JournalBox.SizeY", frw->getHeight().asRelative((float)resY));
		ConfigurationManager::GetInstance()->SetValue("Gui.JournalBox.Visible", frw->isVisible());

		{
			std::string qtreedown;
			std::string selected;
			std::map<std::string, CEGUI::TreeItem *>::iterator itm =	_mapquestarea.begin();
			std::map<std::string, CEGUI::TreeItem *>::iterator endm =	_mapquestarea.end();
			for(; itm != endm; ++itm)
			{
				if(itm->second->getIsOpen())
				{
					qtreedown += "##" + itm->first;
				}

				std::vector<CEGUI::TreeItem*> items = itm->second->getItemList();
				for(size_t i=0; i<items.size(); ++i)
				{
					if(items[i]->isSelected())
						selected = items[i]->getText().c_str();
				}
			}

			ConfigurationManager::GetInstance()->SetValue("Gui.JournalBox.QuestTreeOpen", qtreedown);
			ConfigurationManager::GetInstance()->SetValue("Gui.JournalBox.QuestTreeSelected", selected);
		}

		{
			std::string qtreedown;
			std::string selected;
			std::map<std::string, CEGUI::TreeItem *>::iterator itm =	_mapquestdonearea.begin();
			std::map<std::string, CEGUI::TreeItem *>::iterator endm =	_mapquestdonearea.end();
			for(; itm != endm; ++itm)
			{
				if(itm->second->getIsOpen())
				{
					qtreedown += "##" + itm->first;
				}

				std::vector<CEGUI::TreeItem*> items = itm->second->getItemList();
				for(size_t i=0; i<items.size(); ++i)
				{
					if(items[i]->isSelected())
						selected = items[i]->getText().c_str();
				}
			}

			ConfigurationManager::GetInstance()->SetValue("Gui.JournalBox.QuestDoneTreeOpen", qtreedown);
			ConfigurationManager::GetInstance()->SetValue("Gui.JournalBox.QuestDoneTreeSelected", selected);
		}


	}
	catch(CEGUI::Exception &ex)
	{
		LogHandler::getInstance()->LogToFile(std::string("Exception destructor Inventorybox: ") + ex.getMessage().c_str());
	}
}
Example #22
0
/***********************************************************
initialize the GUI
***********************************************************/
void GameGUI::Initialize()
{
	try
	{
		_root = CEGUI::WindowManager::getSingleton().loadWindowLayout( "GameGuiRoot.layout" );
		_cb.Initialize(_root);
		_comb.Initialize(_root);
		_telb.Initialize(_root);
		_invb.Initialize(_root);
		_shortb.Initialize(_root);
		_containerb.Initialize(_root);
		_lettereditb.Initialize(_root);
		_letterviewb.Initialize(_root);
		_dialogb.Initialize(_root);
		_journalb.Initialize(_root);
		CGMessageBox::getInstance()->Initialize(_root);
		ChooseNumberBox::getInstance()->Initialize(_root);

		#ifdef _LBANET_SET_EDITOR_
		if(_editb)
			_editb->Initialize(_root);
		#endif

		CEGUI::WindowManager::getSingleton().getWindow("HeadInterfaceBG")->disable();
		CEGUI::WindowManager::getSingleton().getWindow("MenuCharInterfaceBG")->disable();

		static_cast<CEGUI::PushButton *> (CEGUI::WindowManager::getSingleton().getWindow("btnchaticon"))->subscribeEvent (
			CEGUI::PushButton::EventClicked,
			CEGUI::Event::Subscriber (&GameGUI::HandleChatIconClicked, this));

		static_cast<CEGUI::PushButton *> (CEGUI::WindowManager::getSingleton().getWindow("btncomicon"))->subscribeEvent (
			CEGUI::PushButton::EventClicked,
			CEGUI::Event::Subscriber (&GameGUI::HandleComIconClicked, this));

		static_cast<CEGUI::PushButton *> (CEGUI::WindowManager::getSingleton().getWindow("btnteleporticon"))->subscribeEvent (
			CEGUI::PushButton::EventClicked,
			CEGUI::Event::Subscriber (&GameGUI::HandleTeleIconClicked, this));

		static_cast<CEGUI::PushButton *> (CEGUI::WindowManager::getSingleton().getWindow("btnquit"))->subscribeEvent (
			CEGUI::PushButton::EventClicked,
			CEGUI::Event::Subscriber (&GameGUI::HandleQuitIconClicked, this));

		static_cast<CEGUI::PushButton *> (CEGUI::WindowManager::getSingleton().getWindow("btnsound"))->subscribeEvent (
			CEGUI::PushButton::EventClicked,
			CEGUI::Event::Subscriber (&GameGUI::HandleSoundIconClicked, this));

		static_cast<CEGUI::PushButton *> (CEGUI::WindowManager::getSingleton().getWindow("btnchangeworld"))->subscribeEvent (
			CEGUI::PushButton::EventClicked,
			CEGUI::Event::Subscriber (&GameGUI::HandleChangeWorldIconClicked, this));

		static_cast<CEGUI::PushButton *> (CEGUI::WindowManager::getSingleton().getWindow("btnoption"))->subscribeEvent (
			CEGUI::PushButton::EventClicked,
			CEGUI::Event::Subscriber (&GameGUI::HandleOptionIconClicked, this));

		static_cast<CEGUI::PushButton *> (CEGUI::WindowManager::getSingleton().getWindow("DisplayGameTextFrame/bok"))->subscribeEvent (
			CEGUI::PushButton::EventClicked,
			CEGUI::Event::Subscriber (&GameGUI::HandleCloseTextClicked, this));

		static_cast<CEGUI::PushButton *> (CEGUI::WindowManager::getSingleton().getWindow("btntunic"))->subscribeEvent (
			CEGUI::PushButton::EventClicked,
			CEGUI::Event::Subscriber (&GameGUI::HandleInventoryClicked, this));

		static_cast<CEGUI::PushButton *> (CEGUI::WindowManager::getSingleton().getWindow("btnweapon"))->subscribeEvent (
			CEGUI::PushButton::EventClicked,
			CEGUI::Event::Subscriber (&GameGUI::HandleShortcutClicked, this));

		static_cast<CEGUI::PushButton *> (CEGUI::WindowManager::getSingleton().getWindow("btnquest"))->subscribeEvent (
			CEGUI::PushButton::EventClicked,
			CEGUI::Event::Subscriber (&GameGUI::HandleJournalClicked, this));

		

		
		CEGUI::FrameWindow * frw = static_cast<CEGUI::FrameWindow *> (
			CEGUI::WindowManager::getSingleton().getWindow("DisplayGameTextFrame"));
		frw->subscribeEvent (CEGUI::FrameWindow::EventCloseClicked,
			CEGUI::Event::Subscriber (&GameGUI::HandleCloseTextClicked, this));


		CEGUI::WindowManager::getSingleton().getWindow("DisplayGameTextFrame")->hide();
	}
	catch(CEGUI::Exception &ex)
	{
		LogHandler::getInstance()->LogToFile(std::string("Exception init login gui: ") + ex.getMessage().c_str());
		_root = NULL;
	}

	RefreshSOundButton();
}
Example #23
0
/*************************************************************************
Sample specific initialisation goes here.
*************************************************************************/
bool EffectsDemo::initialise(CEGUI::GUIContext* guiContext)
{
    using namespace CEGUI;

    d_usedFiles = CEGUI::String(__FILE__);
    d_guiContext = guiContext;

    // Register our effects with the system
    RenderEffectManager::getSingleton().addEffect<ElasticWindowEffect>(s_effectNameElastic);
    RenderEffectManager::getSingleton().addEffect<WobblyWindowEffect>(s_effectNameWobblyNew);
    RenderEffectManager::getSingleton().addEffect<OldWobblyWindowEffect>(s_effectNameWobblyOld);

    // Now we make a Falagard mapping for a frame window that uses this effect.
    // We create a type "Vanilla/WobblyFrameWindow".  Note that it would be
    // more usual for this mapping to be specified in the scheme xml file,
    // though here we are doing in manually to save from needing either multiple
    // versions of the schemes or from having demo specific definitions in
    // the schemes.
    WindowFactoryManager::getSingleton().addFalagardWindowMapping(
        "Vanilla/WobblyFrameWindow",    // type to create
        "CEGUI/FrameWindow",            // 'base' widget type
        "Vanilla/FrameWindow",          // WidgetLook to use.
        "Core/FrameWindow",             // WindowRenderer to use.
        s_effectNameWobblyNew);         // effect to use.

    // Since we want to be able to load the EffectsDemo.layout in the editor
    // tools (where the above mapping is not available), we now alias the
    // new window type onto the original TaharezLook/FrameWindow.  This has
    // the effect that - after the alias is added - any time a window of
    // type "TaharezLook/FrameWindow" is requested, the system will create a
    // "TaharezLook/WobblyFrameWindow" instead.

    WindowFactoryManager::getSingleton().addWindowTypeAlias(
        "Vanilla/FrameWindow",  // alias name - can shadow existing types
        "Vanilla/WobblyFrameWindow"); // target type to create.

    // we will use of the WindowManager.
    WindowManager& winMgr = WindowManager::getSingleton();

    // load scheme and set up defaults
    SchemeManager::getSingleton().createFromFile("TaharezLook.scheme");
    SchemeManager::getSingleton().createFromFile("VanillaSkin.scheme");
    guiContext->getMouseCursor().setDefaultImage("TaharezLook/MouseArrow");

    // load font and setup default if not loaded via scheme
    Font& defaultFont = FontManager::getSingleton().createFromFile("DejaVuSans-12.font");
    // Set default font for the gui context
    guiContext->setDefaultFont(&defaultFont);

    // load an image to use as a background
    if( !ImageManager::getSingleton().isDefined("SpaceBackgroundImage") )
        ImageManager::getSingleton().addFromImageFile("SpaceBackgroundImage", "SpaceBackground.jpg");

    if( !ImageManager::getSingleton().isDefined("AliasingTestImage") )
        ImageManager::getSingleton().addFromImageFile("AliasingTestImage", "Aliasing.jpg");

    // here we will use a StaticImage as the root, then we can use it to place a background image
    Window* background = winMgr.createWindow("TaharezLook/StaticImage", "background_wnd");
    // set position and size
    background->setPosition(UVector2(cegui_reldim(0), cegui_reldim( 0)));
    background->setSize(USize(cegui_reldim(1), cegui_reldim( 1)));
    // disable frame and standard background
    background->setProperty("FrameEnabled", "false");
    background->setProperty("BackgroundEnabled", "false");
    // set the background image
    background->setProperty("Image", "SpaceBackgroundImage");
    // set the background window as the root window for our GUIContext
    guiContext->setRootWindow(background);

    // load the windows for the EffectsDemo from the layout file.
    Window* sheet = winMgr.loadLayoutFromFile("EffectsDemo.layout");
 
    // Get the combobox created from within the layout
    CEGUI::Combobox* effectsCombobox = static_cast<CEGUI::Combobox*>(sheet->getChild("EffectsFrameWindow/EffectsCombobox"));

    // attach this to the 'real' root
    background->addChild(sheet);
    //Initialise the render effects
    initialiseEffects(effectsCombobox->getParent());

    // Initialise the items and subscribe the event for the combobox
    initialiseEffectsCombobox(effectsCombobox);
    
    // We can switch the automatic effects mapping off now
    WindowFactoryManager::getSingleton().removeWindowTypeAlias(
        "Vanilla/FrameWindow",  // alias name - can shadow existing types
        "Vanilla/WobblyFrameWindow"); // target type to create.




    // We create a mapping for the elastic windows effect too,
    // and we will apply it to a window we create from code
    WindowFactoryManager::getSingleton().addFalagardWindowMapping(
        "Vanilla/ElasticFrameWindow",   // type to create
        "CEGUI/FrameWindow",            // 'base' widget type
        "Vanilla/FrameWindow",          // WidgetLook to use.
        "Core/FrameWindow",             // WindowRenderer to use.
        s_effectNameElastic);    // effect to use.

    // We will create another window using the effects-mapping we created before, this time directly from code
    CEGUI::FrameWindow* aliasingFrameWnd = static_cast<CEGUI::FrameWindow*>(
        WindowManager::getSingleton().createWindow("Vanilla/ElasticFrameWindow", "AliasingTestWindow") );

    // Add it to the layout root
    sheet->addChild(aliasingFrameWnd);

    // We will add an image to it using a StaticImage window
    Window* aliasingWnd = WindowManager::getSingleton().createWindow("Vanilla/StaticImage", "AliasingTestImage");
    aliasingFrameWnd->addChild(aliasingWnd);
    aliasingFrameWnd->setPosition(CEGUI::UVector2(cegui_reldim(0.05f), cegui_reldim(0.15f)));
    aliasingFrameWnd->setSize(CEGUI::USize(cegui_reldim(0.2f), cegui_reldim(0.28f)));
    aliasingFrameWnd->setSizingEnabled(true);
    aliasingFrameWnd->setCloseButtonEnabled(false);
    aliasingFrameWnd->setTitleBarEnabled(true);
    aliasingFrameWnd->setText("Elastic Window - Aliasing Testimage");

    // Image window setup
    aliasingWnd->setSize(CEGUI::USize(cegui_reldim(1.0f), cegui_reldim(1.0f)));
    aliasingWnd->setProperty("FrameEnabled", "false");
    aliasingWnd->setProperty("BackgroundEnabled", "false");
    aliasingWnd->setProperty("Image", "AliasingTestImage");

    // success!
    return true;
}