ref: 3c7676e0f1ae6fecebcfb41c0ecc96a2ad300eef
parent: adac14ddd4c94027afe59381ea046ace0adbefc3
author: LTCHIPS <ltchips994@gmail.com>
date: Tue Mar 20 20:48:33 EDT 2018
Fullscreen/Windowed modes can be switched again :)
--- a/rott/modexlib.c
+++ b/rott/modexlib.c
@@ -54,7 +54,7 @@
SDL_Surface *sdl_surface = NULL;
-static SDL_Window * window = NULL;
+SDL_Window * window = NULL;
static SDL_Renderer * renderer = NULL;
@@ -431,8 +431,6 @@
=
====================
*/
-
-
void GraphicsMode ( void )
{
Uint32 flags = 0;
@@ -454,17 +452,16 @@
//SDL_WM_SetCaption ("Rise of the Triad", "ROTT");
//SDL_ShowCursor (0);
// sdl_surface = SDL_SetVideoMode (320, 200, 8, flags);
- //if (sdl_fullscreen)
- //flags = SDL_FULLSCREEN;
+ if (sdl_fullscreen)
+ flags = SDL_WINDOW_FULLSCREEN;
window = SDL_CreateWindow("Rise of the Triad",
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT,
- 0);
+ flags);
//SDL_CreateWindowAndRenderer(iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT, 0, &window, &renderer);
-
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
sdl_texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ABGR8888,
@@ -475,11 +472,14 @@
//sdl_surface = SDL_SetVideoMode (iGLOBAL_SCREENWIDTH, iGLOBAL_SCREENHEIGHT, 8, flags);
sdl_surface = SDL_CreateRGBSurface(0,iGLOBAL_SCREENWIDTH,iGLOBAL_SCREENHEIGHT,
8,0,0,0,0);
+
+ //ToggleFullscreen();
if (window == NULL)
{
Error ("Could not set video mode\n");
}
}
+
/*
====================
--- a/rott/rt_in.c
+++ b/rott/rt_in.c
@@ -21,6 +21,8 @@
#include <stdlib.h>
#include <string.h>
#include <SDL2/SDL_scancode.h>
+#include <SDL2/SDL_keycode.h>
+#include <SDL2/SDL_mouse.h>
#if PLATFORM_DOS
#include <conio.h>
@@ -272,8 +274,6 @@
* surface's current flags are used.
* @return non-zero on success, zero on failure.
*/
-//TODO: Write new fullscreen toggle....
-
/*
* The windib driver can't alert us to the keypad enter key, which
* Ken's code depends on heavily. It sends it as the same key as the
@@ -894,7 +894,7 @@
Insert(scancodes, SDLK_LALT, sc_Alt);
Insert(scancodes, SDLK_RALT, sc_Alt);
- //Insert(scancodes, SDLK_MODE, sc_Alt);
+ Insert(scancodes, SDLK_MODE, sc_Alt);
Insert(scancodes, SDLK_RCTRL, sc_Control);
Insert(scancodes, SDLK_SPACE, sc_Space);
Insert(scancodes, SDLK_CAPSLOCK, sc_CapsLock);
@@ -917,6 +917,7 @@
Insert(scancodes, SDLK_MINUS, sc_Minus);
+ Insert(scancodes, SDLK_KP_PERIOD, sc_Delete);
Insert(scancodes, SDLK_KP_7, sc_Home);
Insert(scancodes, SDLK_KP_8, sc_UpArrow);
Insert(scancodes, SDLK_KP_9, sc_PgUp);
--- a/rott/rt_menu.c
+++ b/rott/rt_menu.c
@@ -120,6 +120,8 @@
int bufferheight;
int bufferwidth;
+extern SDL_Window *window;
+
cfont_t *IFont;
font_t *CurrentFont;
font_t *newfont1;
@@ -5729,11 +5731,12 @@
DrawExtOptionsButtons ();
break;
case 5:
- //if (SDL_WM_ToggleFullScreen(SDL_GetVideoSurface()))
- //{
- //sdl_fullscreen ^= 1;
+ if (!sdl_fullscreen)
+ SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN);
+ else
+ SDL_SetWindowFullscreen(window, 0); //0 means make it windowed
+ sdl_fullscreen ^= 1;
DrawExtOptionsButtons ();
- //}
break;
case 6:
autoAimMissileWeps ^= 1;