Advertisement
Guest User

Untitled

a guest
Nov 7th, 2015
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 7.65 KB | None | 0 0
  1. --- main.orig.cpp   2015-11-07 14:41:29.554923576 +0100
  2. +++ main.cpp    2015-11-07 14:25:16.105257865 +0100
  3. @@ -11,8 +11,8 @@
  4.  
  5.  #include "SDL.h"
  6.  
  7. -#include "CEGUI.h"
  8. -#include "RendererModules/OpenGL/CEGUIOpenGLRenderer.h"
  9. +#include "CEGUI/CEGUI.h"
  10. +#include "CEGUI/RendererModules/OpenGL/GLRenderer.h"
  11.  
  12.  #include <GL/gl.h>
  13.  
  14. @@ -23,16 +23,6 @@
  15.  using namespace CEGUI ;
  16.  
  17.  
  18. -// Change according to your installation path:
  19. -const std::string & CEGUIInstallBasePath =
  20. -"/home/wondersye/Projects/LOANI-latest/LOANI-installations/CEGUI-0.7.5" ;
  21. -
  22. -/*
  23. -   const std::string & CEGUIInstallBasePath = "/usr" ;
  24. -   */
  25. -
  26. -
  27. -
  28.  // Input management: from SDL to CEGUI.
  29.  
  30.  void handle_mouse_down( Uint8 button )
  31. @@ -42,23 +32,23 @@
  32.      {
  33.  
  34.          case SDL_BUTTON_LEFT:
  35. -            CEGUI::System::getSingleton().injectMouseButtonDown( CEGUI::LeftButton ) ;
  36. +            CEGUI::System::getSingleton().getDefaultGUIContext().injectMouseButtonDown( CEGUI::LeftButton ) ;
  37.              break ;
  38.  
  39.          case SDL_BUTTON_MIDDLE:
  40. -            CEGUI::System::getSingleton().injectMouseButtonDown( CEGUI::MiddleButton ) ;
  41. +            CEGUI::System::getSingleton().getDefaultGUIContext().injectMouseButtonDown( CEGUI::MiddleButton ) ;
  42.              break ;
  43.  
  44.          case SDL_BUTTON_RIGHT:
  45. -            CEGUI::System::getSingleton().injectMouseButtonDown( CEGUI::RightButton) ;
  46. +            CEGUI::System::getSingleton().getDefaultGUIContext().injectMouseButtonDown( CEGUI::RightButton) ;
  47.              break ;
  48.  
  49.          case SDL_BUTTON_WHEELDOWN:
  50. -            CEGUI::System::getSingleton().injectMouseWheelChange( -1 ) ;
  51. +            CEGUI::System::getSingleton().getDefaultGUIContext().injectMouseWheelChange( -1 ) ;
  52.              break ;
  53.  
  54.          case SDL_BUTTON_WHEELUP:
  55. -            CEGUI::System::getSingleton().injectMouseWheelChange( +1 ) ;
  56. +            CEGUI::System::getSingleton().getDefaultGUIContext().injectMouseWheelChange( +1 ) ;
  57.              break ;
  58.  
  59.          default:
  60. @@ -78,15 +68,15 @@
  61.      {
  62.  
  63.          case SDL_BUTTON_LEFT:
  64. -            CEGUI::System::getSingleton().injectMouseButtonUp( CEGUI::LeftButton ) ;
  65. +            CEGUI::System::getSingleton().getDefaultGUIContext().injectMouseButtonUp( CEGUI::LeftButton ) ;
  66.              break ;
  67.  
  68.          case SDL_BUTTON_MIDDLE:
  69. -            CEGUI::System::getSingleton().injectMouseButtonUp( CEGUI::MiddleButton ) ;
  70. +            CEGUI::System::getSingleton().getDefaultGUIContext().injectMouseButtonUp( CEGUI::MiddleButton ) ;
  71.              break ;
  72.  
  73.          case SDL_BUTTON_RIGHT:
  74. -            CEGUI::System::getSingleton().injectMouseButtonUp( CEGUI::RightButton ) ;
  75. +            CEGUI::System::getSingleton().getDefaultGUIContext().injectMouseButtonUp( CEGUI::RightButton ) ;
  76.              break ;
  77.  
  78.          case SDL_BUTTON_WHEELDOWN:
  79. @@ -123,7 +113,7 @@
  80.  
  81.              case SDL_MOUSEMOTION:
  82.                  // We inject the mouse position directly here:
  83. -                CEGUI::System::getSingleton().injectMousePosition(
  84. +                CEGUI::System::getSingleton().getDefaultGUIContext().injectMousePosition(
  85.                          static_cast<float>( e.motion.x ), static_cast<float>( e.motion.y ) ) ;
  86.                  break ;
  87.  
  88. @@ -139,7 +129,7 @@
  89.  
  90.              case SDL_KEYDOWN:
  91.  
  92. -                CEGUI::System::getSingleton().injectKeyDown(e.key.keysym.scancode) ;
  93. +                CEGUI::System::getSingleton().getDefaultGUIContext().injectKeyDown((CEGUI::Key::Scan)e.key.keysym.scancode) ;
  94.  
  95.                  /*
  96.                   * Managing the character is more difficult, we have to use a translated
  97. @@ -149,13 +139,13 @@
  98.  
  99.              if ( (e.key.keysym.unicode & 0xFF80) == 0 )
  100.              {
  101. -                CEGUI::System::getSingleton().injectChar(
  102. +                CEGUI::System::getSingleton().getDefaultGUIContext().injectChar(
  103.                          e.key.keysym.unicode & 0x7F ) ;
  104.              }
  105.              break ;
  106.  
  107.              case SDL_KEYUP:
  108. -            CEGUI::System::getSingleton().injectKeyUp( e.key.keysym.scancode ) ;
  109. +            CEGUI::System::getSingleton().getDefaultGUIContext().injectKeyUp( (CEGUI::Key::Scan)e.key.keysym.scancode ) ;
  110.              break ;
  111.  
  112.              // A WM quit event occured:
  113. @@ -165,7 +155,7 @@
  114.  
  115.              case SDL_VIDEORESIZE:
  116.              CEGUI::System::getSingleton().notifyDisplaySizeChanged(
  117. -                    CEGUI::Size( e.resize.w, e.resize.h ) ) ;
  118. +                    CEGUI::Size<float>( e.resize.w, e.resize.h ) ) ;
  119.              break ;
  120.  
  121.          }
  122. @@ -185,6 +175,8 @@
  123.      // Inject the time that passed since the last call:
  124.      CEGUI::System::getSingleton().injectTimePulse( static_cast<float>(
  125.                  current_time_pulse - last_time_pulse ) ) ;
  126. +    CEGUI::System::getSingleton().getDefaultGUIContext().injectTimePulse( static_cast<float>(
  127. +                current_time_pulse - last_time_pulse ) ) ;
  128.  
  129.      // Records the new time as the last time:
  130.      last_time_pulse = current_time_pulse ;
  131. @@ -200,7 +192,7 @@
  132.      glClear( GL_COLOR_BUFFER_BIT ) ;
  133.  
  134.      // Renders the GUI:
  135. -    CEGUI::System::getSingleton().renderGUI() ;
  136. +    CEGUI::System::getSingleton().renderAllGUIContexts() ;
  137.  
  138.      // Updates the screen:
  139.      SDL_GL_SwapBuffers() ;
  140. @@ -273,8 +265,7 @@
  141.          * static_cast<CEGUI::DefaultResourceProvider*>
  142.          ( CEGUI::System::getSingleton().getResourceProvider() ) ;
  143.  
  144. -    const string CEGUIInstallSharePath = CEGUIInstallBasePath
  145. -        + "/share/CEGUI/" ;
  146. +    const string CEGUIInstallSharePath = "/home/beyer/tmp/cegui-0.8.4/datafiles/" ;
  147.  
  148.      // For each resource type, sets a corresponding resource group directory:
  149.  
  150. @@ -306,7 +297,7 @@
  151.              CEGUIInstallSharePath + "animations/" ) ;
  152.  
  153.      // Sets the default resource groups to be used:
  154. -    CEGUI::Imageset::setDefaultResourceGroup( "imagesets" ) ;
  155. +    CEGUI::ImageManager::setImagesetDefaultResourceGroup( "imagesets" ) ;
  156.      CEGUI::Font::setDefaultResourceGroup( "fonts" ) ;
  157.      CEGUI::Scheme::setDefaultResourceGroup( "schemes" ) ;
  158.      CEGUI::WidgetLookManager::setDefaultResourceGroup( "looknfeels" ) ;
  159. @@ -331,9 +322,9 @@
  160.  
  161.      set_CEGUI_paths() ;
  162.  
  163. -    SchemeManager::getSingleton().create( "TaharezLook.scheme" ) ;
  164. +    SchemeManager::getSingleton().createFromFile( "TaharezLook.scheme" ) ;
  165.  
  166. -    System::getSingleton().setDefaultMouseCursor( "TaharezLook", "MouseArrow" ) ;
  167. +    System::getSingleton().getDefaultGUIContext().getMouseCursor().setDefaultImage("TaharezLook/MouseArrow");
  168.  
  169.      return WindowManager::getSingleton() ;
  170.  
  171. @@ -349,18 +340,18 @@
  172.      DefaultWindow & rootWin = * static_cast<DefaultWindow*>(
  173.              winManager.createWindow( "DefaultWindow", "Root" ) ) ;
  174.  
  175. -    System::getSingleton().setGUISheet( &rootWin ) ;
  176. +    CEGUI::System::getSingleton().getDefaultGUIContext().setRootWindow( &rootWin ) ;
  177.  
  178.      FrameWindow & myWin = * static_cast<FrameWindow*>( winManager.createWindow(
  179.                  "TaharezLook/FrameWindow", "Demo Window" ) ) ;
  180.  
  181. -    rootWin.addChildWindow( &myWin ) ;
  182. +    rootWin.addChild( &myWin ) ;
  183.  
  184.      myWin.setPosition( UVector2( cegui_reldim(0.25f), cegui_reldim(0.25f) ) ) ;
  185. -    myWin.setSize( UVector2( cegui_reldim(0.5f), cegui_reldim(0.5f) ) ) ;
  186. +    myWin.setSize( USize( cegui_reldim(0.5f), cegui_reldim(0.5f) ) ) ;
  187.  
  188. -    myWin.setMaxSize( UVector2( cegui_reldim(1.0f), cegui_reldim(1.0f) ) ) ;
  189. -    myWin.setMinSize( UVector2( cegui_reldim(0.1f), cegui_reldim(0.1f) ) ) ;
  190. +    myWin.setMaxSize( USize( cegui_reldim(1.0f), cegui_reldim(1.0f) ) ) ;
  191. +    myWin.setMinSize( USize( cegui_reldim(0.1f), cegui_reldim(0.1f) ) ) ;
  192.  
  193.      myWin.setText( "Hello World! This is a minimal SDL+OpenGL+CEGUI test." ) ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement