Browse Source

Window resizing working

Thomas Buck 10 years ago
parent
commit
1e125794e2
5 changed files with 18 additions and 5 deletions
  1. 3
    0
      ChangeLog
  2. 7
    0
      include/OpenRaider.h
  3. 1
    1
      include/SDLSystem.h
  4. 4
    3
      src/OpenRaider.cpp
  5. 3
    1
      src/SDLSystem.cpp

+ 3
- 0
ChangeLog View File

5
 
5
 
6
  OpenRaider (0.1.2) xythobuz <xythobuz@xythobuz.de>
6
  OpenRaider (0.1.2) xythobuz <xythobuz@xythobuz.de>
7
 
7
 
8
+	[ 20140312 ]
9
+	* Resizing the window works properly (except for fixed string positions)
10
+
8
 	[ 20140311 ]
11
 	[ 20140311 ]
9
 	* Removed empty Camera, Matrix, Particle, Quaternion,
12
 	* Removed empty Camera, Matrix, Particle, Quaternion,
10
 	  Vector3d and ViewVolume destructors
13
 	  Vector3d and ViewVolume destructors

+ 7
- 0
include/OpenRaider.h View File

74
     void start();
74
     void start();
75
 
75
 
76
     /*!
76
     /*!
77
+     * \brief Resizes game window and updated renderer
78
+     * \param width new width
79
+     * \param height new height
80
+     */
81
+    virtual void resize(unsigned int width, unsigned int height);
82
+
83
+    /*!
77
      * \brief Mouse motion input
84
      * \brief Mouse motion input
78
      * \param x relative x motion
85
      * \param x relative x motion
79
      * \param y relative y motion
86
      * \param y relative y motion

+ 1
- 1
include/SDLSystem.h View File

86
      * \param width new width
86
      * \param width new width
87
      * \param height new height
87
      * \param height new height
88
      */
88
      */
89
-    void resize(unsigned int width, unsigned int height);
89
+    virtual void resize(unsigned int width, unsigned int height);
90
 
90
 
91
     /*!
91
     /*!
92
      * \brief Start game loop
92
      * \brief Start game loop

+ 4
- 3
src/OpenRaider.cpp View File

3061
         if (rc_command("xga", cmd))
3061
         if (rc_command("xga", cmd))
3062
         {
3062
         {
3063
             resize(1024, 768);
3063
             resize(1024, 768);
3064
-            m_render.Update(1024, 768);
3065
         }
3064
         }
3066
         else if (rc_command("svga", cmd))
3065
         else if (rc_command("svga", cmd))
3067
         {
3066
         {
3068
             resize(800, 600);
3067
             resize(800, 600);
3069
-            m_render.Update(800, 600);
3070
         }
3068
         }
3071
         else if (rc_command("vga", cmd))
3069
         else if (rc_command("vga", cmd))
3072
         {
3070
         {
3073
             resize(640, 460);
3071
             resize(640, 460);
3074
-            m_render.Update(640, 460);
3075
         }
3072
         }
3076
     }
3073
     }
3077
     else if (rc_command("sshot", cmd))
3074
     else if (rc_command("sshot", cmd))
3172
     }
3169
     }
3173
 }
3170
 }
3174
 
3171
 
3172
+void OpenRaider::resize(unsigned int width, unsigned int height) {
3173
+    SDLSystem::resize(width, height);
3174
+    m_render.Update(width, height);
3175
+}
3175
 
3176
 
3176
 void OpenRaider::loadPakFolderRecursive(const char *dir) {
3177
 void OpenRaider::loadPakFolderRecursive(const char *dir) {
3177
     struct dirent *ep;
3178
     struct dirent *ep;

+ 3
- 1
src/SDLSystem.cpp View File

106
     m_width = width;
106
     m_width = width;
107
     m_height = height;
107
     m_height = height;
108
 
108
 
109
+    SDL_SetWindowSize(mWindow, width, height);
110
+
109
     // Resize context
111
     // Resize context
110
     resizeGL(width, height);
112
     resizeGL(width, height);
111
 }
113
 }
316
                 case SDL_WINDOWEVENT:
318
                 case SDL_WINDOWEVENT:
317
                     switch(event.window.event) {
319
                     switch(event.window.event) {
318
                         case SDL_WINDOWEVENT_RESIZED:
320
                         case SDL_WINDOWEVENT_RESIZED:
319
-                            resizeGL(event.window.data1, event.window.data2);
321
+                            resize(event.window.data1, event.window.data2);
320
                             break;
322
                             break;
321
                     }
323
                     }
322
                     break;
324
                     break;

Loading…
Cancel
Save