DEADSOFTWARE

sdl: fix fullscreen
[flatwaifu.git] / src / soft / vga.c
index ef97ca7afa9103bae141e77173ba343e3c84290d..ce83101ec24dbabf5d61fad05295fb9915ca5705 100644 (file)
@@ -40,8 +40,8 @@ byte bright[256];
 byte mixmap[256][256];
 byte clrmap[256*12];
 
-static byte *buffer;
-static int buf_w, buf_h, pitch;
+byte *buffer;
+int buf_w, buf_h, pitch;
 static int offx, offy;
 static int cx1, cx2, cy1, cy2;
 static byte flametab[16] = {
@@ -64,24 +64,6 @@ vgaimg *V_loadvgaimg (char *name) {
   return V_getvgaimg(F_getresid(name));
 }
 
-short V_init (void) {
-  int flags = fullscreen ? SYSTEM_USE_FULLSCREEN : 0;
-  int res = Y_set_videomode(SCRW, SCRH, flags);
-  if (res == 0) {
-    ERR_failinit("Unable to set video mode");
-  }
-  Y_get_buffer(&buffer, &buf_w, &buf_h, &pitch);
-  return 0;
-}
-
-void V_done (void) {
-  buffer = NULL;
-  buf_w = 0;
-  buf_h = 0;
-  pitch = 0;
-  Y_unset_videomode();
-}
-
 static void draw_rect (int x, int y, int w, int h, int c) {
   int i;
   int x0 = max(x, cx1);
@@ -96,9 +78,9 @@ static void draw_rect (int x, int y, int w, int h, int c) {
 
 void V_setrect (short x, short w, short y, short h) {
   cx1 = max(x, 0);
-  cx2 = min(x + w - 1, SCRW - 1);
+  cx2 = min(x + w - 1, buf_w - 1);
   cy1 = max(y, 0);
-  cy2 = min(y + h - 1, SCRH - 1);
+  cy2 = min(y + h - 1, buf_h - 1);
 }
 
 static void putpixel (int x, int y, byte color) {
@@ -118,7 +100,7 @@ static void mappixel (int x, int y, byte *cmap) {
 
 void V_center (int f) {
   if (f) {
-    V_offset(SCRW / 2 - 320 / 2, SCRH / 2 - 200 / 2);
+    V_offset(buf_w / 2 - 320 / 2, buf_h / 2 - 200 / 2);
   } else {
     V_offset(0, 0);
   }
@@ -241,7 +223,3 @@ void V_remap_rect (int x, int y, int w, int h, byte *cmap) {
         for (cy=y; cy<y+h; cy++)
             mappixel(cx,cy,cmap);
 }
-
-void V_toggle (void) {
-  fullscreen = Y_set_fullscreen(!Y_get_fullscreen());
-}