SMC CEGUI 0.8 patch

Diff code posted by Hans de Goede
created at 12 Nov 20:59

Edit | Back
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
diff -ur smc-1.9/src/audio/random_sound.cpp smc-1.9.new/src/audio/random_sound.cpp
--- smc-1.9/src/audio/random_sound.cpp  2009-04-24 19:55:24.000000000 +0200
+++ smc-1.9.new/src/audio/random_sound.cpp  2014-06-13 16:42:01.985063618 +0200
@@ -22,7 +22,7 @@
 #include "../core/math/utilities.h"
 #include "../core/i18n.h"
 // CEGUI
-#include "CEGUIXMLAttributes.h"
+#include <CEGUI/XMLAttributes.h>
 
 namespace SMC
 {
@@ -485,11 +485,11 @@
   editbox->subscribeEvent( CEGUI::Editbox::EventTextChanged, CEGUI::Event::Subscriber( &cRandom_Sound::Editor_Filename_Text_Changed, this ) );
 
   // continuous
-  CEGUI::Checkbox *checkbox = static_cast<CEGUI::Checkbox *>(wmgr.createWindow( "TaharezLook/Checkbox", "editor_sound_continuous" ));
+  CEGUI::ToggleButton *checkbox = static_cast<CEGUI::ToggleButton *>(wmgr.createWindow( "TaharezLook/ToggleButton", "editor_sound_continuous" ));
   Editor_Add( UTF8_("Continuous"), UTF8_("Check if the sound should be played continuously instead of randomly"), checkbox, 50 );
 
   checkbox->setSelected( m_continuous );
-  checkbox->subscribeEvent( CEGUI::Checkbox::EventCheckStateChanged, CEGUI::Event::Subscriber( &cRandom_Sound::Editor_Continuous_Changed, this ) );
+  checkbox->subscribeEvent( CEGUI::ToggleButton::EventSelectStateChanged, CEGUI::Event::Subscriber( &cRandom_Sound::Editor_Continuous_Changed, this ) );
 
   // delay min
   editbox = static_cast<CEGUI::Editbox *>(wmgr.createWindow( "TaharezLook/Editbox", "editor_sound_delay_min" ));
@@ -554,7 +554,7 @@
 bool cRandom_Sound :: Editor_Continuous_Changed( const CEGUI::EventArgs &event )
 {
   const CEGUI::WindowEventArgs &windowEventArgs = static_cast<const CEGUI::WindowEventArgs&>( event );
-  bool enabled = static_cast<CEGUI::Checkbox *>( windowEventArgs.window )->isSelected();
+  bool enabled = static_cast<CEGUI::ToggleButton *>( windowEventArgs.window )->isSelected();
 
   Set_Continuous( enabled );
 
diff -ur smc-1.9/src/core/editor.cpp smc-1.9.new/src/core/editor.cpp
--- smc-1.9/src/core/editor.cpp  2014-06-13 16:52:56.034173377 +0200
+++ smc-1.9.new/src/core/editor.cpp  2014-06-13 16:49:31.619139693 +0200
@@ -35,7 +35,7 @@
 #include "boost/filesystem/convenience.hpp"
 namespace fs = boost::filesystem;
 // CEGUI
-#include "CEGUIXMLParser.h"
+#include <CEGUI/XMLParser.h>
 
 namespace SMC
 {
@@ -82,8 +82,8 @@
 {
   // CEGUI settings
   list_text->setTextColours( Get_Massive_Type_Color( sprite_obj->m_massive_type ).Get_cegui_Color() );
-  list_text->setSelectionColours( CEGUI::colour( 0.33f, 0.33f, 0.33f ) );
-  list_text->setSelectionBrushImage( "TaharezLook", "ListboxSelectionBrush" );
+  list_text->setSelectionColours( CEGUI::Colour( 0.33f, 0.33f, 0.33f ) );
+  list_text->setSelectionBrushImage( "ListboxSelectionBrush" );
 
   // image dimension text
   // string size_text = int_to_string( static_cast<int>(image->w) ) + "x" + int_to_string( static_cast<int>(image->h) );
@@ -106,9 +106,9 @@
   */
 }
 
-CEGUI::Size cEditor_Item_Object :: getPixelSize( void ) const
+CEGUI::Sizef cEditor_Item_Object :: getPixelSize( void ) const
 {
-  CEGUI::Size tmp = list_text->getPixelSize();
+  CEGUI::Sizef tmp = list_text->getPixelSize();
 
   if( pPreferences->m_editor_show_item_images )
   {
@@ -118,7 +118,7 @@
   return tmp;
 }
 
-void cEditor_Item_Object :: draw( CEGUI::GeometryBuffer &buffer, const CEGUI::Rect &targetRect, float alpha, const CEGUI::Rect *clipper ) const
+void cEditor_Item_Object :: draw( CEGUI::GeometryBuffer &buffer, const CEGUI::Rectf &targetRect, float alpha, const CEGUI::Rectf *clipper ) const
 {
   // draw text
   list_text->draw( buffer, targetRect, alpha, clipper );
@@ -192,8 +192,8 @@
 
 void cEditor_Menu_Object :: Init( void )
 {
-  setSelectionColours( CEGUI::colour( 0.33f, 0.33f, 0.33f ) );
-  setSelectionBrushImage( "TaharezLook", "ListboxSelectionBrush" );
+  setSelectionColours( CEGUI::Colour( 0.33f, 0.33f, 0.33f ) );
+  setSelectionBrushImage( "ListboxSelectionBrush" );
 }
 
 /* *** *** *** *** *** *** *** cEditor *** *** *** *** *** *** *** *** *** *** */
@@ -225,7 +225,7 @@
   }
 
   // Create Editor CEGUI Window
-  editor_window = CEGUI::WindowManager::getSingleton().loadWindowLayout( "editor.layout" );
+  editor_window = CEGUI::WindowManager::getSingleton().loadWindowLayoutFromFile( "editor.layout" );
   pGuiSystem->getGUISheet()->addChildWindow( editor_window );
 
   // Get TabControl
@@ -937,7 +937,7 @@
   return 1;
 }
 
-void cEditor :: Add_Menu_Object( const std::string &name, std::string tags, CEGUI::colour normal_color /* = CEGUI::colour( 1, 1, 1 ) */ )
+void cEditor :: Add_Menu_Object( const std::string &name, std::string tags, CEGUI::Colour normal_color /* = CEGUI::Colour( 1, 1, 1 ) */ )
 {
   // Create Menu Object
   cEditor_Menu_Object *new_menu = new cEditor_Menu_Object( name );
@@ -958,7 +958,7 @@
     tags.erase( 0, 6 );
 
     // header color rect
-    new_menu->setTextColours( normal_color, normal_color, CEGUI::colour( 0.5f, 0.5f, 0.5f ), CEGUI::colour( 0.5f, 0.5f, 0.5f ) );
+    new_menu->setTextColours( normal_color, normal_color, CEGUI::Colour( 0.5f, 0.5f, 0.5f ), CEGUI::Colour( 0.5f, 0.5f, 0.5f ) );
     // not selectable
     new_menu->setDisabled( 1 );
     // set tooltip
diff -ur smc-1.9/src/core/editor.h smc-1.9.new/src/core/editor.h
--- smc-1.9/src/core/editor.h  2014-06-13 16:52:56.035173353 +0200
+++ smc-1.9.new/src/core/editor.h  2014-06-13 16:44:16.220802341 +0200
@@ -21,8 +21,8 @@
 #include "../gui/hud.h"
 #include "../video/img_settings.h"
 // CEGUI
-#include "CEGUIXMLHandler.h"
-#include "CEGUIXMLAttributes.h"
+#include <CEGUI/XMLHandler.h>
+#include <CEGUI/XMLAttributes.h>
 
 namespace SMC
 {
@@ -60,9 +60,9 @@
   \return
     Size object describing the size of the list box item in pixels.
   */
-  virtual  CEGUI::Size getPixelSize( void ) const;
+  virtual  CEGUI::Sizef getPixelSize( void ) const;
   // draw
-  void draw( CEGUI::GeometryBuffer &buffer, const CEGUI::Rect &targetRect, float alpha, const CEGUI::Rect *clipper ) const;
+  void draw( CEGUI::GeometryBuffer &buffer, const CEGUI::Rectf &targetRect, float alpha, const CEGUI::Rectf *clipper ) const;
   // draw image
   void Draw_Image( void );
 
@@ -145,7 +145,7 @@
   // ##### Main Menu
 
   // Add Menu Entry
-  void Add_Menu_Object( const std::string &name, std::string tags, CEGUI::colour normal_color = CEGUI::colour( 1, 1, 1 ) );
+  void Add_Menu_Object( const std::string &name, std::string tags, CEGUI::Colour normal_color = CEGUI::Colour( 1, 1, 1 ) );
   // Set Active Menu Entry
   virtual void Activate_Menu_Item( cEditor_Menu_Object *entry );
 
diff -ur smc-1.9/src/level/level.h smc-1.9.new/src/level/level.h
--- smc-1.9/src/level/level.h  2009-08-16 18:46:36.000000000 +0200
+++ smc-1.9.new/src/level/level.h  2014-06-10 16:56:11.589927166 +0200
@@ -24,8 +24,8 @@
 #include "../objects/level_entry.h"
 #include "../audio/random_sound.h"
 // CEGUI
-#include "CEGUIXMLHandler.h"
-#include "CEGUIXMLAttributes.h"
+#include <CEGUI/XMLHandler.h>
+#include <CEGUI/XMLAttributes.h>
 
 namespace SMC
 {
diff -ur smc-1.9/src/overworld/overworld.h smc-1.9.new/src/overworld/overworld.h
--- smc-1.9/src/overworld/overworld.h  2009-08-16 18:51:18.000000000 +0200
+++ smc-1.9.new/src/overworld/overworld.h  2014-06-13 16:08:13.552423619 +0200
@@ -24,8 +24,8 @@
 #include "../gui/hud.h"
 #include "../audio/random_sound.h"
 // CEGUI
-#include "CEGUIXMLHandler.h"
-#include "CEGUIXMLAttributes.h"
+#include <CEGUI/XMLHandler.h>
+#include <CEGUI/XMLAttributes.h>
 
 namespace SMC
 {
diff -ur smc-1.9/src/overworld/world_layer.h smc-1.9.new/src/overworld/world_layer.h
--- smc-1.9/src/overworld/world_layer.h  2009-08-09 04:49:54.000000000 +0200
+++ smc-1.9.new/src/overworld/world_layer.h  2014-06-13 16:07:54.416891334 +0200
@@ -21,8 +21,8 @@
 #include "../core/obj_manager.h"
 #include "../overworld/world_waypoint.h"
 // CEGUI
-#include "CEGUIXMLHandler.h"
-#include "CEGUIXMLAttributes.h"
+#include <CEGUI/XMLHandler.h>
+#include <CEGUI/XMLAttributes.h>
 
 namespace SMC
 {
diff -ur smc-1.9/src/overworld/world_manager.h smc-1.9.new/src/overworld/world_manager.h
--- smc-1.9/src/overworld/world_manager.h  2009-02-18 05:10:14.000000000 +0100
+++ smc-1.9.new/src/overworld/world_manager.h  2014-06-13 16:07:34.577376260 +0200
@@ -20,8 +20,8 @@
 #include "../core/obj_manager.h"
 #include "../core/camera.h"
 // CEGUI
-#include "CEGUIXMLHandler.h"
-#include "CEGUIXMLAttributes.h"
+#include <CEGUI/XMLHandler.h>
+#include <CEGUI/XMLAttributes.h>
 
 namespace SMC
 {
diff -ur smc-1.9/src/user/preferences.h smc-1.9.new/src/user/preferences.h
--- smc-1.9/src/user/preferences.h  2009-04-12 16:32:24.000000000 +0200
+++ smc-1.9.new/src/user/preferences.h  2014-06-13 16:08:47.054604748 +0200
@@ -20,8 +20,8 @@
 // SDL
 #include "SDL.h"
 // CEGUI
-#include "CEGUIXMLHandler.h"
-#include "CEGUIXMLAttributes.h"
+#include <CEGUI/XMLHandler.h>
+#include <CEGUI/XMLAttributes.h>
 
 namespace SMC
 {
diff -ur smc-1.9/src/video/video.h smc-1.9.new/src/video/video.h
--- smc-1.9/src/video/video.h  2014-06-13 16:52:56.037173304 +0200
+++ smc-1.9.new/src/video/video.h  2014-06-13 16:38:54.599616173 +0200
@@ -22,8 +22,8 @@
 #include "SDL_image.h"
 #include "SDL_opengl.h"
 // CEGUI
-#include "CEGUI.h"
-#include <RendererModules/OpenGL/CEGUIOpenGLRenderer.h>
+#include <CEGUI/CEGUI.h>
+#include <CEGUI/RendererModules/OpenGL/GLRenderer.h>
 
 namespace SMC
 {
@@ -41,7 +41,7 @@
 
   // Returns a matching Color value
   SDL_Color Get_SDL_Color( void ) const;
-  CEGUI::colour Get_cegui_Color( void ) const;
+  CEGUI::Colour Get_cegui_Color( void ) const;
 
   // += operator
   inline void operator += ( const Color &c )
@@ -134,10 +134,10 @@
 class cFake_GeometryBuffer : public CEGUI::GeometryBuffer
 {
     void draw() const {}
-    void setTranslation(const CEGUI::Vector3&) {}
-    void setRotation(const CEGUI::Vector3&) {}
-    void setPivot(const CEGUI::Vector3&) {}
-    void setClippingRegion(const CEGUI::Rect&) {}
+    void setTranslation(const CEGUI::Vector3f&) {}
+    void setRotation(const CEGUI::Quaternion& r) {}
+    void setPivot(const CEGUI::Vector3f&) {}
+    void setClippingRegion(const CEGUI::Rectf&) {}
     void appendVertex(const CEGUI::Vertex&) {}
     void appendGeometry(const CEGUI::Vertex* const, CEGUI::uint) {}
     void setActiveTexture(CEGUI::Texture*) {}
@@ -146,7 +146,11 @@
     CEGUI::uint getVertexCount() const { return 0; }
     CEGUI::uint getBatchCount() const { return 0; }
     void setRenderEffect(CEGUI::RenderEffect*) {}
-    CEGUI::RenderEffect* getRenderEffect() { return 0; }
+    CEGUI::RenderEffect* getRenderEffect() { return 0; }
+    void setBlendMode(const CEGUI::BlendMode mode) {}
+    CEGUI::BlendMode getBlendMode() const { return d_blendMode; }
+    void setClippingActive(const bool active) {}
+    bool isClippingActive() const { return false; }
 };
 
 class cFake_Texture : public CEGUI::Texture
@@ -156,34 +160,39 @@
         m_size(1, 1),
         m_scaling(1, 1)
     {}
-
-    const CEGUI::Size& getSize() const { return m_size; }
-    const CEGUI::Size& getOriginalDataSize() const { return m_size; }
-    const CEGUI::Vector2& getTexelScaling() const { return m_scaling; }
+
+    const CEGUI::String& getName() const { return m_name; }
+    const CEGUI::Sizef& getSize() const { return m_size; }
+    const CEGUI::Sizef& getOriginalDataSize() const { return m_size; }
+    const CEGUI::Vector2f& getTexelScaling() const { return m_scaling; }
     void loadFromFile(const CEGUI::String&, const CEGUI::String&) {}
-    void loadFromMemory(const void*, const CEGUI::Size&, CEGUI::Texture::PixelFormat) {}
-    void saveToMemory(void*) {}
-
-private:
-    CEGUI::Size m_size;
-    CEGUI::Vector2 m_scaling;
+    void loadFromMemory(const void*, const CEGUI::Sizef&, CEGUI::Texture::PixelFormat) {}
+    void saveToMemory(void*) {}
+    void blitFromMemory(const void* sourceData, const CEGUI::Rectf& area) {}
+    void blitToMemory(void* targetData) {}
+    bool isPixelFormatSupported(const PixelFormat fmt) const { return false; }
+
+private:
+    CEGUI::String m_name;
+    CEGUI::Sizef m_size;
+    CEGUI::Vector2f m_scaling;
 };
 
 class cFake_RenderTarget : public CEGUI::RenderTarget
 {
 public:
-    cFake_RenderTarget() : m_area(0, 0, 0, 0) {}
-    void draw(const CEGUI::GeometryBuffer&) {}
-    void draw(const CEGUI::RenderQueue&) {}
-    void setArea(const CEGUI::Rect&) {}
-    const CEGUI::Rect& getArea() const { return m_area; }
+    cFake_RenderTarget() : m_area(0, 0, 0, 0) {}
+    void draw(const CEGUI::GeometryBuffer& buffer) {}
+    void draw(const CEGUI::RenderQueue& queue) {}
+    void setArea(const CEGUI::Rectf& area) {}
+    const CEGUI::Rectf& getArea() const { return m_area; }
     bool isImageryCache() const { return false; }
     void activate() {}
     void deactivate() {}
-    void unprojectPoint(const CEGUI::GeometryBuffer&, const CEGUI::Vector2&, CEGUI::Vector2&) const {}
+    void unprojectPoint(const CEGUI::GeometryBuffer&, const CEGUI::Vector2f&, CEGUI::Vector2f&) const {}
 
 private:
-    CEGUI::Rect m_area;
+    CEGUI::Rectf m_area;
 };
 
 class cFake_Renderer : public CEGUI::Renderer
@@ -192,11 +201,10 @@
   cFake_Renderer( void ) :
         m_size(0, 0),
         m_dpi(0, 0),
-        m_identifierString("Fake Renderer"),
-        m_root(m_target)
+        m_identifierString("Fake Renderer")
   {}
 
-    CEGUI::RenderingRoot& getDefaultRenderingRoot() { return m_root; }
+    CEGUI::RenderTarget& getDefaultRenderTarget() { return m_target; }
     CEGUI::GeometryBuffer& createGeometryBuffer() { return m_geometry; }
     void destroyGeometryBuffer(const CEGUI::GeometryBuffer&) {}
     void destroyAllGeometryBuffers() {}
@@ -205,25 +213,24 @@
     void destroyAllTextureTargets() {}
     CEGUI::Texture& createTexture() { return m_texture; }
     CEGUI::Texture& createTexture(const CEGUI::String&, const CEGUI::String&) { return m_texture; }
-    CEGUI::Texture& createTexture(const CEGUI::Size&) { return m_texture; }
+    CEGUI::Texture& createTexture(const CEGUI::Sizef&) { return m_texture; }
     void destroyTexture(CEGUI::Texture&) {}
     void destroyAllTextures() {}
     void beginRendering() {}
     void endRendering() {}
-    void setDisplaySize(const CEGUI::Size&) {}
-    const CEGUI::Size& getDisplaySize() const { return m_size; }
-    const CEGUI::Vector2& getDisplayDPI() const {return m_dpi; }
+    void setDisplaySize(const CEGUI::Sizef&) {}
+    const CEGUI::Sizef& getDisplaySize() const { return m_size; }
+    const CEGUI::Vector2f& getDisplayDPI() const {return m_dpi; }
     CEGUI::uint getMaxTextureSize() const { return 0; }
     const CEGUI::String& getIdentifierString() const { return m_identifierString; }
 
 private:
-    CEGUI::Size m_size;
-    CEGUI::Vector2 m_dpi;
+    CEGUI::Sizef m_size;
+    CEGUI::Vector2f m_dpi;
     CEGUI::String m_identifierString;
     cFake_GeometryBuffer m_geometry;
     cFake_Texture m_texture;
     cFake_RenderTarget m_target;
-    CEGUI::RenderingRoot m_root;
 };
 
 /* *** *** *** *** *** *** *** Video class *** *** *** *** *** *** *** *** *** *** */
15 KB in 52 ms with coderay