From 5a4307160ef9026a6dc440af276df9fa82cc55c4 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 8 Apr 2018 11:51:02 +0300 Subject: [PATCH] Fixed compilation of SDL backend --- src/CMakeLists.txt | 1 - src/posix/sdl/sdlglvideo.cpp | 25 +++++-- src/posix/sdl/sdlglvideo.h | 4 - src/posix/sdl/sdlvideo.cpp | 140 ----------------------------------- 4 files changed, 19 insertions(+), 151 deletions(-) delete mode 100644 src/posix/sdl/sdlvideo.cpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 591598f1d..dda761e72 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -519,7 +519,6 @@ set( PLAT_SDL_SOURCES posix/sdl/i_joystick.cpp posix/sdl/i_main.cpp posix/sdl/i_system.cpp - posix/sdl/sdlvideo.cpp posix/sdl/sdlglvideo.cpp posix/sdl/st_start.cpp ) set( PLAT_UNIX_SOURCES diff --git a/src/posix/sdl/sdlglvideo.cpp b/src/posix/sdl/sdlglvideo.cpp index 4d2998095..222ef8969 100644 --- a/src/posix/sdl/sdlglvideo.cpp +++ b/src/posix/sdl/sdlglvideo.cpp @@ -94,6 +94,8 @@ CUSTOM_CVAR(Bool, gl_es, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCA } #endif +CVAR (Int, vid_adapter, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) + // PRIVATE DATA DEFINITIONS ------------------------------------------------ // CODE -------------------------------------------------------------------- @@ -395,12 +397,6 @@ bool SDLGLFB::IsFullscreen () return (SDL_GetWindowFlags (Screen) & SDL_WINDOW_FULLSCREEN_DESKTOP) != 0; } - -bool SDLGLFB::IsValid () -{ - return DFrameBuffer::IsValid() && Screen != NULL; -} - void SDLGLFB::SetVSync( bool vsync ) { #if defined (__APPLE__) @@ -449,3 +445,20 @@ int SDLGLFB::GetClientHeight() return height; } + +// each platform has its own specific version of this function. +void I_SetWindowTitle(const char* caption) +{ +#if 0 + // This needs to be done differently. The static_cast here is fundamentally wrong because SDLFB is not the true ancestor of the screen's class. + auto Screen = static_cast(screen)->GetSDLWindow(); + if (caption) + SDL_SetWindowTitle(static_cast(screen)->GetSDLWindow(), caption); + else + { + FString default_caption; + default_caption.Format(GAMESIG " %s (%s)", GetVersionString(), GetGitTime()); + SDL_SetWindowTitle(static_cast(screen)->GetSDLWindow(), default_caption); + } +#endif +} diff --git a/src/posix/sdl/sdlglvideo.h b/src/posix/sdl/sdlglvideo.h index a8bf2d60f..b8eda3877 100644 --- a/src/posix/sdl/sdlglvideo.h +++ b/src/posix/sdl/sdlglvideo.h @@ -50,11 +50,7 @@ public: ~SDLGLFB (); void ForceBuffering (bool force); - bool Lock(bool buffered); - bool Lock (); - void Unlock(); - bool IsValid (); bool IsFullscreen (); virtual void SetVSync( bool vsync ); diff --git a/src/posix/sdl/sdlvideo.cpp b/src/posix/sdl/sdlvideo.cpp deleted file mode 100644 index 38b3e2986..000000000 --- a/src/posix/sdl/sdlvideo.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/* -** sdlvideo.cpp -** -**--------------------------------------------------------------------------- -** Copyright 2005-2016 Randy Heit -** All rights reserved. -** -** Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions -** are met: -** -** 1. Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** 2. Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in the -** documentation and/or other materials provided with the distribution. -** 3. The name of the author may not be used to endorse or promote products -** derived from this software without specific prior written permission. -** -** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -**--------------------------------------------------------------------------- -** -*/ - -// HEADER FILES ------------------------------------------------------------ - -#include "doomtype.h" - -#include "templates.h" -#include "i_system.h" -#include "i_video.h" -#include "v_video.h" -#include "v_pfx.h" -#include "stats.h" -#include "v_palette.h" -#include "sdlvideo.h" -#include "swrenderer/r_swrenderer.h" -#include "version.h" - -#include - -#ifdef __APPLE__ -#include -#endif // __APPLE__ - -// MACROS ------------------------------------------------------------------ - -// TYPES ------------------------------------------------------------------- - -struct MiniModeInfo -{ - uint16_t Width, Height; -}; - -// PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- - -// PRIVATE FUNCTION PROTOTYPES --------------------------------------------- - -// EXTERNAL DATA DECLARATIONS ---------------------------------------------- - -extern IVideo *Video; -extern bool GUICapture; - -EXTERN_CVAR (Float, Gamma) -EXTERN_CVAR (Int, vid_maxfps) -EXTERN_CVAR (Bool, cl_capfps) -EXTERN_CVAR (Bool, vid_vsync) - -// PUBLIC DATA DEFINITIONS ------------------------------------------------- - -CVAR (Int, vid_adapter, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) - -CVAR (Int, vid_displaybits, 32, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) - -CVAR (Bool, vid_forcesurface, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) - -CUSTOM_CVAR (Float, rgamma, 1.f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) -{ - if (screen != NULL) - { - screen->SetGamma (Gamma); - } -} -CUSTOM_CVAR (Float, ggamma, 1.f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) -{ - if (screen != NULL) - { - screen->SetGamma (Gamma); - } -} -CUSTOM_CVAR (Float, bgamma, 1.f, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) -{ - if (screen != NULL) - { - screen->SetGamma (Gamma); - } -} - -// PRIVATE DATA DEFINITIONS ------------------------------------------------ - -extern cycle_t BlitCycles; -static cycle_t SDLFlipCycles; - -// CODE -------------------------------------------------------------------- - - -ADD_STAT (blit) -{ - FString out; - out.Format ("blit=%04.1f ms flip=%04.1f ms", - BlitCycles.TimeMS(), SDLFlipCycles.TimeMS()); - return out; -} - -// each platform has its own specific version of this function. -void I_SetWindowTitle(const char* caption) -{ -#if 0 - // This needs to be done differently. The static_cast here is fundamentally wrong because SDLFB is not the true ancestor of the screen's class. - auto Screen = static_cast(screen)->GetSDLWindow(); - if (caption) - SDL_SetWindowTitle(static_cast(screen)->GetSDLWindow(), caption); - else - { - FString default_caption; - default_caption.Format(GAMESIG " %s (%s)", GetVersionString(), GetGitTime()); - SDL_SetWindowTitle(static_cast(screen)->GetSDLWindow(), default_caption); - } -#endif -} -