Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- main.orig.cpp 2015-11-07 14:41:29.554923576 +0100
- +++ main.cpp 2015-11-07 14:25:16.105257865 +0100
- @@ -11,8 +11,8 @@
- #include "SDL.h"
- -#include "CEGUI.h"
- -#include "RendererModules/OpenGL/CEGUIOpenGLRenderer.h"
- +#include "CEGUI/CEGUI.h"
- +#include "CEGUI/RendererModules/OpenGL/GLRenderer.h"
- #include <GL/gl.h>
- @@ -23,16 +23,6 @@
- using namespace CEGUI ;
- -// Change according to your installation path:
- -const std::string & CEGUIInstallBasePath =
- -"/home/wondersye/Projects/LOANI-latest/LOANI-installations/CEGUI-0.7.5" ;
- -
- -/*
- - const std::string & CEGUIInstallBasePath = "/usr" ;
- - */
- -
- -
- -
- // Input management: from SDL to CEGUI.
- void handle_mouse_down( Uint8 button )
- @@ -42,23 +32,23 @@
- {
- case SDL_BUTTON_LEFT:
- - CEGUI::System::getSingleton().injectMouseButtonDown( CEGUI::LeftButton ) ;
- + CEGUI::System::getSingleton().getDefaultGUIContext().injectMouseButtonDown( CEGUI::LeftButton ) ;
- break ;
- case SDL_BUTTON_MIDDLE:
- - CEGUI::System::getSingleton().injectMouseButtonDown( CEGUI::MiddleButton ) ;
- + CEGUI::System::getSingleton().getDefaultGUIContext().injectMouseButtonDown( CEGUI::MiddleButton ) ;
- break ;
- case SDL_BUTTON_RIGHT:
- - CEGUI::System::getSingleton().injectMouseButtonDown( CEGUI::RightButton) ;
- + CEGUI::System::getSingleton().getDefaultGUIContext().injectMouseButtonDown( CEGUI::RightButton) ;
- break ;
- case SDL_BUTTON_WHEELDOWN:
- - CEGUI::System::getSingleton().injectMouseWheelChange( -1 ) ;
- + CEGUI::System::getSingleton().getDefaultGUIContext().injectMouseWheelChange( -1 ) ;
- break ;
- case SDL_BUTTON_WHEELUP:
- - CEGUI::System::getSingleton().injectMouseWheelChange( +1 ) ;
- + CEGUI::System::getSingleton().getDefaultGUIContext().injectMouseWheelChange( +1 ) ;
- break ;
- default:
- @@ -78,15 +68,15 @@
- {
- case SDL_BUTTON_LEFT:
- - CEGUI::System::getSingleton().injectMouseButtonUp( CEGUI::LeftButton ) ;
- + CEGUI::System::getSingleton().getDefaultGUIContext().injectMouseButtonUp( CEGUI::LeftButton ) ;
- break ;
- case SDL_BUTTON_MIDDLE:
- - CEGUI::System::getSingleton().injectMouseButtonUp( CEGUI::MiddleButton ) ;
- + CEGUI::System::getSingleton().getDefaultGUIContext().injectMouseButtonUp( CEGUI::MiddleButton ) ;
- break ;
- case SDL_BUTTON_RIGHT:
- - CEGUI::System::getSingleton().injectMouseButtonUp( CEGUI::RightButton ) ;
- + CEGUI::System::getSingleton().getDefaultGUIContext().injectMouseButtonUp( CEGUI::RightButton ) ;
- break ;
- case SDL_BUTTON_WHEELDOWN:
- @@ -123,7 +113,7 @@
- case SDL_MOUSEMOTION:
- // We inject the mouse position directly here:
- - CEGUI::System::getSingleton().injectMousePosition(
- + CEGUI::System::getSingleton().getDefaultGUIContext().injectMousePosition(
- static_cast<float>( e.motion.x ), static_cast<float>( e.motion.y ) ) ;
- break ;
- @@ -139,7 +129,7 @@
- case SDL_KEYDOWN:
- - CEGUI::System::getSingleton().injectKeyDown(e.key.keysym.scancode) ;
- + CEGUI::System::getSingleton().getDefaultGUIContext().injectKeyDown((CEGUI::Key::Scan)e.key.keysym.scancode) ;
- /*
- * Managing the character is more difficult, we have to use a translated
- @@ -149,13 +139,13 @@
- if ( (e.key.keysym.unicode & 0xFF80) == 0 )
- {
- - CEGUI::System::getSingleton().injectChar(
- + CEGUI::System::getSingleton().getDefaultGUIContext().injectChar(
- e.key.keysym.unicode & 0x7F ) ;
- }
- break ;
- case SDL_KEYUP:
- - CEGUI::System::getSingleton().injectKeyUp( e.key.keysym.scancode ) ;
- + CEGUI::System::getSingleton().getDefaultGUIContext().injectKeyUp( (CEGUI::Key::Scan)e.key.keysym.scancode ) ;
- break ;
- // A WM quit event occured:
- @@ -165,7 +155,7 @@
- case SDL_VIDEORESIZE:
- CEGUI::System::getSingleton().notifyDisplaySizeChanged(
- - CEGUI::Size( e.resize.w, e.resize.h ) ) ;
- + CEGUI::Size<float>( e.resize.w, e.resize.h ) ) ;
- break ;
- }
- @@ -185,6 +175,8 @@
- // Inject the time that passed since the last call:
- CEGUI::System::getSingleton().injectTimePulse( static_cast<float>(
- current_time_pulse - last_time_pulse ) ) ;
- + CEGUI::System::getSingleton().getDefaultGUIContext().injectTimePulse( static_cast<float>(
- + current_time_pulse - last_time_pulse ) ) ;
- // Records the new time as the last time:
- last_time_pulse = current_time_pulse ;
- @@ -200,7 +192,7 @@
- glClear( GL_COLOR_BUFFER_BIT ) ;
- // Renders the GUI:
- - CEGUI::System::getSingleton().renderGUI() ;
- + CEGUI::System::getSingleton().renderAllGUIContexts() ;
- // Updates the screen:
- SDL_GL_SwapBuffers() ;
- @@ -273,8 +265,7 @@
- * static_cast<CEGUI::DefaultResourceProvider*>
- ( CEGUI::System::getSingleton().getResourceProvider() ) ;
- - const string CEGUIInstallSharePath = CEGUIInstallBasePath
- - + "/share/CEGUI/" ;
- + const string CEGUIInstallSharePath = "/home/beyer/tmp/cegui-0.8.4/datafiles/" ;
- // For each resource type, sets a corresponding resource group directory:
- @@ -306,7 +297,7 @@
- CEGUIInstallSharePath + "animations/" ) ;
- // Sets the default resource groups to be used:
- - CEGUI::Imageset::setDefaultResourceGroup( "imagesets" ) ;
- + CEGUI::ImageManager::setImagesetDefaultResourceGroup( "imagesets" ) ;
- CEGUI::Font::setDefaultResourceGroup( "fonts" ) ;
- CEGUI::Scheme::setDefaultResourceGroup( "schemes" ) ;
- CEGUI::WidgetLookManager::setDefaultResourceGroup( "looknfeels" ) ;
- @@ -331,9 +322,9 @@
- set_CEGUI_paths() ;
- - SchemeManager::getSingleton().create( "TaharezLook.scheme" ) ;
- + SchemeManager::getSingleton().createFromFile( "TaharezLook.scheme" ) ;
- - System::getSingleton().setDefaultMouseCursor( "TaharezLook", "MouseArrow" ) ;
- + System::getSingleton().getDefaultGUIContext().getMouseCursor().setDefaultImage("TaharezLook/MouseArrow");
- return WindowManager::getSingleton() ;
- @@ -349,18 +340,18 @@
- DefaultWindow & rootWin = * static_cast<DefaultWindow*>(
- winManager.createWindow( "DefaultWindow", "Root" ) ) ;
- - System::getSingleton().setGUISheet( &rootWin ) ;
- + CEGUI::System::getSingleton().getDefaultGUIContext().setRootWindow( &rootWin ) ;
- FrameWindow & myWin = * static_cast<FrameWindow*>( winManager.createWindow(
- "TaharezLook/FrameWindow", "Demo Window" ) ) ;
- - rootWin.addChildWindow( &myWin ) ;
- + rootWin.addChild( &myWin ) ;
- myWin.setPosition( UVector2( cegui_reldim(0.25f), cegui_reldim(0.25f) ) ) ;
- - myWin.setSize( UVector2( cegui_reldim(0.5f), cegui_reldim(0.5f) ) ) ;
- + myWin.setSize( USize( cegui_reldim(0.5f), cegui_reldim(0.5f) ) ) ;
- - myWin.setMaxSize( UVector2( cegui_reldim(1.0f), cegui_reldim(1.0f) ) ) ;
- - myWin.setMinSize( UVector2( cegui_reldim(0.1f), cegui_reldim(0.1f) ) ) ;
- + myWin.setMaxSize( USize( cegui_reldim(1.0f), cegui_reldim(1.0f) ) ) ;
- + myWin.setMinSize( USize( cegui_reldim(0.1f), cegui_reldim(0.1f) ) ) ;
- myWin.setText( "Hello World! This is a minimal SDL+OpenGL+CEGUI test." ) ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement