DEADSOFTWARE

sdl2: fix building with sdl2 on linux
[flatwaifu.git] / src / sdl / main.c
index 5706cc75c95c5d490414e2673a56725522e724e7..0b1aada10b2c8886093651c5401a8fbab2eca3e9 100644 (file)
@@ -20,7 +20,7 @@
    51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 */
 
-#include <SDL.h>
+#include "SDL.h"
 #include <stdio.h>
 #include <stdarg.h>
 #include <stdlib.h> // srand exit
@@ -115,6 +115,16 @@ int Y_set_videomode (int w, int h, int flags) {
   return s != NULL;
 }
 
+void Y_get_videomode (int *w, int *h) {
+  if (surf != NULL) {
+    *w = surf->w;
+    *h = surf->h;
+  } else {
+    *w = 0;
+    *h = 0;
+  }
+}
+
 int Y_videomode_setted (void) {
   return surf != NULL;
 }
@@ -125,9 +135,16 @@ void Y_unset_videomode (void) {
   SDL_InitSubSystem(SDL_INIT_VIDEO);
 }
 
-int Y_set_fullscreen (int yes) {
-  //SDL_WM_ToggleFullScreen();
-  return 0;
+void Y_set_fullscreen (int yes) {
+  assert(surf != NULL);
+  int flags = 0;
+  if ((surf->flags & SDL_FULLSCREEN) == 0) {
+    flags |= SYSTEM_USE_FULLSCREEN;
+  }
+  if (surf->flags & SDL_OPENGL) {
+    flags |= SDL_OPENGL;
+  }
+  Y_set_videomode(surf->w, surf->h, flags);
 }
 
 int Y_get_fullscreen (void) {