1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-02-03 18:14:01 +00:00

Obsolete & remove BBGE_BUILD_SDL2. Closes #65.

This commit is contained in:
fgenesis 2022-04-05 05:20:01 +02:00
parent a04af25d88
commit e7594ecead
12 changed files with 41 additions and 39 deletions

View file

@ -794,7 +794,7 @@ static bool sdlVideoModeOK(int disp, const int w, const int h, const int bpp)
{
if(!w && !h)
return true;
#ifdef BBGE_BUILD_SDL2
#if SDL_VERSION_ATLEAST(2,0,0)
SDL_DisplayMode mode;
const int modecount = SDL_GetNumDisplayModes(disp);
for (int i = 0; i < modecount; i++) {
@ -915,7 +915,7 @@ This build is not yet final, and as such there are a couple things lacking. They
SDL_Init(SDL_INIT_VIDEO);
if (fullscreen && !sdlVideoModeOK(user.video.displayindex, user.video.resx, user.video.resy, user.video.bits))
{
#ifdef BBGE_BUILD_SDL2
#if SDL_VERSION_ATLEAST(2,0,0)
SDL_DisplayMode mode, closest;
mode.format = 0;
mode.driverdata = 0;

View file

@ -154,7 +154,7 @@ static void init()
if(!worker)
{
#ifdef BBGE_BUILD_SDL2
#if SDL_VERSION_ATLEAST(2,0,0)
worker = SDL_CreateThread(_NetworkWorkerThread, "network", NULL);
#else
worker = SDL_CreateThread(_NetworkWorkerThread, NULL);

View file

@ -916,7 +916,7 @@ luaFunc(loadfile_caseinsensitive)
}
}
#ifdef BBGE_BUILD_SDL2
#if SDL_VERSION_ATLEAST(2,0,0)
#define LUAAPI_HAS_CLIPBOARD
luaFunc(os_setclipboard)
{
@ -9513,7 +9513,7 @@ luaFunc(pe_isRunning)
luaFunc(getPerformanceCounter)
{
#ifdef BBGE_BUILD_SDL2
#if SDL_VERSION_ATLEAST(2,0,0)
luaReturnNum((lua_Number)SDL_GetPerformanceCounter());
#else
luaReturnNum((lua_Number)SDL_GetTicks());
@ -9522,7 +9522,7 @@ luaFunc(getPerformanceCounter)
luaFunc(getPerformanceFreq)
{
#ifdef BBGE_BUILD_SDL2
#if SDL_VERSION_ATLEAST(2,0,0)
luaReturnNum((lua_Number)SDL_GetPerformanceFrequency());
#else
luaReturnNum((lua_Number)1000);

View file

@ -140,7 +140,7 @@ std::string getInputCodeToUserString(unsigned int k, size_t joystickID)
// It's just confusing to see Y instead of Z with a german keyboard layout...
if(k && k < KEY_MAXARRAY)
{
#ifdef BBGE_BUILD_SDL2
#if SDL_VERSION_ATLEAST(2,0,0)
pretty = SDL_GetScancodeName((SDL_Scancode)k);
const SDL_Keycode kcode = SDL_GetKeyFromScancode((SDL_Scancode)k);
if(kcode != SDLK_UNKNOWN)

View file

@ -175,7 +175,7 @@ void Core::onWindowResize(int w, int h)
updateWindowDrawSize(w, h);
bool reloadRes = false;
#ifndef BBGE_BUILD_SDL2
#if !SDL_VERSION_ATLEAST(2,0,0)
reloadRes = true; // SDL1.2 loses the GL context on resize, so all resources must be reloaded
#endif
@ -542,7 +542,7 @@ void Core::init()
unsigned sdlflags = SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_JOYSTICK;
quitNestedMainFlag = false;
#ifdef BBGE_BUILD_SDL2
#if SDL_VERSION_ATLEAST(2,0,0)
// Haptic is inited separately, in Jostick.cpp, when a joystick is actually plugged in
sdlflags |= SDL_INIT_GAMECONTROLLER;
#else
@ -616,7 +616,7 @@ bool Core::getKeyState(int k)
void Core::initJoystickLibrary()
{
#ifndef BBGE_BUILD_SDL2
#if !SDL_VERSION_ATLEAST(2,0,0)
detectJoysticks();
#endif
@ -736,7 +736,7 @@ void Core::enumerateScreenModesIfNecessary(int display /* = -1 */)
{
if(display == -1)
{
#ifdef BBGE_BUILD_SDL2
#if SDL_VERSION_ATLEAST(2,0,0)
if(window)
display = window->getDisplayIndex();
else
@ -754,7 +754,7 @@ void Core::enumerateScreenModes(int display)
_lastEnumeratedDisplayIndex = display;
screenModes.clear();
#ifdef BBGE_BUILD_SDL2
#if SDL_VERSION_ATLEAST(2,0,0)
screenModes.push_back(ScreenMode(0, 0, 0)); // "Desktop" screen mode
SDL_DisplayMode mode;
@ -1283,7 +1283,7 @@ void Core::onEvent(const SDL_Event& event)
}
else if (focus)
{
#ifdef BBGE_BUILD_SDL2
#if SDL_VERSION_ATLEAST(2,0,0)
unsigned kidx = event.key.keysym.scancode;
#else
unsigned kidx = event.key.keysym.sym;
@ -1298,7 +1298,7 @@ void Core::onEvent(const SDL_Event& event)
{
if (focus)
{
#ifdef BBGE_BUILD_SDL2
#if SDL_VERSION_ATLEAST(2,0,0)
unsigned kidx = event.key.keysym.scancode;
#else
unsigned kidx = event.key.keysym.sym;
@ -1326,7 +1326,7 @@ void Core::onEvent(const SDL_Event& event)
}
break;
#ifdef BBGE_BUILD_SDL2
#if SDL_VERSION_ATLEAST(2,0,0)
case SDL_MOUSEWHEEL:
{

View file

@ -183,7 +183,7 @@ std::list<OggDecoder*> OggDecoder::decoderList;
void OggDecoder::startDecoderThread()
{
stop_thread = false;
#ifdef BBGE_BUILD_SDL2
#if SDL_VERSION_ATLEAST(2,0,0)
decoderThread = SDL_CreateThread((int (*)(void *))decode_loop, "OggDecoder", NULL);
#else
decoderThread = SDL_CreateThread((int (*)(void *))decode_loop, NULL);

View file

@ -1,9 +1,10 @@
#ifndef BBGE_GAME_KEYS_H
#define BBGE_GAME_KEYS_H
#include <SDL_version.h>
#include "BBGECompileConfig.h"
#ifdef BBGE_BUILD_SDL2
#if SDL_VERSION_ATLEAST(2,0,0)
#include <SDL_scancode.h>
@ -120,7 +121,7 @@
#define KEY_MAXARRAY SDL_NUM_SCANCODES
#else // BBGE_BUILD_SDL2
#else // begin SDL1
// ------------- SDL 1.2 code path -----------------
@ -239,6 +240,6 @@
#define KEY_MAXARRAY SDLK_LAST
#endif // BBGE_BUILD_SDL2
#endif // end SDL1
#endif // BBGE_GAME_KEYS_H

View file

@ -31,7 +31,7 @@ unsigned Joystick::GetNumJoysticks()
Joystick::Joystick()
{
stickIndex = -1;
# ifdef BBGE_BUILD_SDL2
#if SDL_VERSION_ATLEAST(2,0,0)
sdl_controller = NULL;
sdl_haptic = NULL;
if(!SDL_WasInit(SDL_INIT_HAPTIC))
@ -61,7 +61,7 @@ Joystick::~Joystick()
{
shutdown();
#ifdef BBGE_BUILD_SDL2
#if SDL_VERSION_ATLEAST(2,0,0)
if(SDL_WasInit(SDL_INIT_HAPTIC))
SDL_QuitSubSystem(SDL_INIT_HAPTIC);
#endif
@ -82,7 +82,7 @@ bool Joystick::init(int stick)
stickIndex = stick;
numJoyAxes = 0;
#ifdef BBGE_BUILD_SDL2
#if SDL_VERSION_ATLEAST(2,0,0)
if (SDL_IsGameController(stick))
{
sdl_controller = SDL_GameControllerOpen(stick);
@ -110,7 +110,7 @@ bool Joystick::init(int stick)
if (sdl_joy)
{
#ifdef BBGE_BUILD_SDL2
#if SDL_VERSION_ATLEAST(2,0,0)
const char *n = SDL_JoystickName(sdl_joy);
name = n ? n : "<?>";
SDL_JoystickGUID jg = SDL_JoystickGetGUID(sdl_joy);
@ -153,7 +153,7 @@ bool Joystick::init(int stick)
void Joystick::shutdown()
{
#ifdef BBGE_BUILD_SDL2
#if SDL_VERSION_ATLEAST(2,0,0)
if (sdl_haptic)
{
SDL_HapticClose(sdl_haptic);
@ -185,7 +185,7 @@ void Joystick::rumble(float leftMotor, float rightMotor, float time)
{
if (core->joystickEnabled)
{
#ifdef BBGE_BUILD_SDL2
#if SDL_VERSION_ATLEAST(2,0,0)
if (sdl_haptic)
{
const float power = (leftMotor + rightMotor) / 2.0f;
@ -237,7 +237,7 @@ void Joystick::update(float dt)
{
if (core->joystickEnabled && sdl_joy && stickIndex != -1)
{
#ifdef BBGE_BUILD_SDL2
#if SDL_VERSION_ATLEAST(2,0,0)
if (!SDL_JoystickGetAttached(sdl_joy))
{
debugLog("Lost Joystick");
@ -284,7 +284,7 @@ void Joystick::update(float dt)
buttonBitmask = 0;
#ifdef BBGE_BUILD_SDL2
#if SDL_VERSION_ATLEAST(2,0,0)
if (sdl_controller)
{
for (unsigned i = 0; i < SDL_CONTROLLER_BUTTON_MAX; i++)
@ -317,7 +317,7 @@ bool Joystick::anyButton() const
unsigned Joystick::getNumAxes() const
{
#ifdef BBGE_BUILD_SDL2
#if SDL_VERSION_ATLEAST(2,0,0)
return sdl_controller ? SDL_CONTROLLER_AXIS_MAX : numJoyAxes;
#else
return numJoyAxes;
@ -364,7 +364,7 @@ const char *Joystick::getAxisName(unsigned axis) const
{
if(axis >= numJoyAxes)
return NULL;
#ifdef BBGE_BUILD_SDL2
#if SDL_VERSION_ATLEAST(2,0,0)
if(sdl_controller)
return SDL_GameControllerGetStringForAxis((SDL_GameControllerAxis)axis);
#endif
@ -373,7 +373,7 @@ const char *Joystick::getAxisName(unsigned axis) const
const char *Joystick::getButtonName(unsigned btn) const
{
#ifdef BBGE_BUILD_SDL2
#if SDL_VERSION_ATLEAST(2,0,0)
if(sdl_controller)
return SDL_GameControllerGetStringForButton((SDL_GameControllerButton)btn);
#endif

View file

@ -3,8 +3,9 @@
#include <string>
#include <SDL_joystick.h>
#include <SDL_version.h>
#ifdef BBGE_BUILD_SDL2
#if SDL_VERSION_ATLEAST(2,0,0)
#include <SDL_gamecontroller.h>
#include <SDL_haptic.h>
#endif
@ -79,7 +80,7 @@ private:
std::string name;
std::string guid;
# ifdef BBGE_BUILD_SDL2
#if SDL_VERSION_ATLEAST(2,0,0)
SDL_GameController *sdl_controller;
SDL_Haptic *sdl_haptic;
#endif

View file

@ -66,7 +66,7 @@ void initIcon(void *screen)
SDL_SysWMinfo wminfo;
SDL_VERSION(&wminfo.version)
#ifdef BBGE_BUILD_SDL2
#if SDL_VERSION_ATLEAST(2,0,0)
SDL_GetWindowWMInfo((SDL_Window*)screen, &wminfo);
HWND hwnd = wminfo.info.win.window;
#else

View file

@ -43,7 +43,7 @@
AdditionalOptions="/MP"
Optimization="0"
AdditionalIncludeDirectories="&quot;$(SolutionDir)\..\ExternalLibs\freetype2\include\freetype\config&quot;;&quot;$(SolutionDir)\..\ExternalLibs\glpng&quot;;&quot;$(SolutionDir)\..\ExternalLibs\libogg\include&quot;;&quot;$(SolutionDir)\..\ExternalLibs\libvorbis\include&quot;;&quot;$(SolutionDir)\..\ExternalLibs\freetype2\include&quot;;&quot;$(SolutionDir)\..\ExternalLibs\FTGL\include&quot;;&quot;$(SolutionDir)\..\ExternalLibs\SDL2\include&quot;;&quot;$(SolutionDir)\..\ExternalLibs\AL\include&quot;;&quot;$(SolutionDir)\..\BBGE&quot;;&quot;$(SolutionDir)\..\ExternalLibs\lua-5.1.4\src&quot;;&quot;$(SolutionDir)\..\ExternalLibs\lvpa\include&quot;;&quot;$(SolutionDir)\..\ExternalLibs\lvpa&quot;;&quot;$(SolutionDir)\..\ExternalLibs\tinyxml2&quot;;&quot;$(SolutionDir)\..\ExternalLibs\ttvfs&quot;;&quot;$(SolutionDir)\..\ExternalLibs\ttvfs_cfileapi&quot;;&quot;$(SolutionDir)\..\ExternalLibs&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;GL_GLEXT_LEGACY=1;HAVE_PUTENV=1;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;BBGE_BUILD_WINDOWS=1;BBGE_BUILD_VFS=1;VFS_ENABLE_C_API=1;BBGE_USE_GLM=1;AQUARIA_INTERNAL_FTGL=1;BBGE_BUILD_SDL2"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;GL_GLEXT_LEGACY=1;HAVE_PUTENV=1;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;BBGE_BUILD_WINDOWS=1;BBGE_BUILD_VFS=1;VFS_ENABLE_C_API=1;BBGE_USE_GLM=1;AQUARIA_INTERNAL_FTGL=1"
MinimalRebuild="false"
BasicRuntimeChecks="0"
RuntimeLibrary="3"
@ -126,7 +126,7 @@
OmitFramePointers="true"
EnableFiberSafeOptimizations="true"
AdditionalIncludeDirectories="&quot;$(SolutionDir)\..\ExternalLibs\freetype2\include\freetype\config&quot;;&quot;$(SolutionDir)\..\ExternalLibs\glpng&quot;;&quot;$(SolutionDir)\..\ExternalLibs\libogg\include&quot;;&quot;$(SolutionDir)\..\ExternalLibs\libvorbis\include&quot;;&quot;$(SolutionDir)\..\ExternalLibs\freetype2\include&quot;;&quot;$(SolutionDir)\..\ExternalLibs\FTGL\include&quot;;&quot;$(SolutionDir)\..\ExternalLibs\SDL2\include&quot;;&quot;$(SolutionDir)\..\ExternalLibs\AL\include&quot;;&quot;$(SolutionDir)\..\BBGE&quot;;&quot;$(SolutionDir)\..\ExternalLibs\lua-5.1.4\src&quot;;&quot;$(SolutionDir)\..\ExternalLibs\lvpa\include&quot;;&quot;$(SolutionDir)\..\ExternalLibs\lvpa&quot;;&quot;$(SolutionDir)\..\ExternalLibs\tinyxml2&quot;;&quot;$(SolutionDir)\..\ExternalLibs\ttvfs&quot;;&quot;$(SolutionDir)\..\ExternalLibs\ttvfs_cfileapi&quot;;&quot;$(SolutionDir)\..\ExternalLibs&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;GL_GLEXT_LEGACY=1;HAVE_PUTENV=1;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;BBGE_BUILD_WINDOWS=1;_HAS_EXCEPTIONS=0;BBGE_BUILD_VFS=1;VFS_ENABLE_C_API=1;BBGE_USE_GLM=1;AQUARIA_INTERNAL_FTGL=1;BBGE_BUILD_SDL2"
PreprocessorDefinitions="WIN32;NDEBUG;GL_GLEXT_LEGACY=1;HAVE_PUTENV=1;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;BBGE_BUILD_WINDOWS=1;_HAS_EXCEPTIONS=0;BBGE_BUILD_VFS=1;VFS_ENABLE_C_API=1;BBGE_USE_GLM=1;AQUARIA_INTERNAL_FTGL=1"
StringPooling="true"
ExceptionHandling="0"
RuntimeLibrary="0"

View file

@ -44,7 +44,7 @@
AdditionalOptions="/MP"
Optimization="0"
AdditionalIncludeDirectories="&quot;$(SolutionDir)\..\ExternalLibs\freetype2\include\freetype\config&quot;;&quot;$(SolutionDir)\..\ExternalLibs\glpng&quot;;&quot;$(SolutionDir)\..\BBGE&quot;;&quot;$(SolutionDir)\..\ExternalLibs\zlib&quot;;&quot;$(SolutionDir)\..\ExternalLibs\png&quot;;&quot;$(SolutionDir)\..\ExternalLibs\libogg\include&quot;;&quot;$(SolutionDir)\..\ExternalLibs\libvorbis\include&quot;;&quot;$(SolutionDir)\..\ExternalLibs\freetype2\include&quot;;&quot;$(SolutionDir)\..\ExternalLibs\FTGL\include&quot;;&quot;$(SolutionDir)\..\ExternalLibs\SDL2\include&quot;;&quot;$(SolutionDir)\..\ExternalLibs\AL\include&quot;;&quot;$(SolutionDir)\..\ExternalLibs\tinyxml2&quot;;&quot;$(SolutionDir)\..\ExternalLibs\ttvfs&quot;;&quot;$(SolutionDir)\..\ExternalLibs\ttvfs_cfileapi&quot;;&quot;$(SolutionDir)\..\ExternalLibs\lvpa&quot;;&quot;$(SolutionDir)\..\ExternalLibs\lvpa\include&quot;;&quot;$(SolutionDir)\..\ExternalLibs&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;GL_GLEXT_LEGACY=1;HAVE_PUTENV=1;FTGL_LIBRARY_STATIC;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;BBGE_BUILD_WINDOWS=1;VFS_ENABLE_C_API=1;BBGE_USE_GLM=1;AQUARIA_INTERNAL_FTGL=1;BBGE_BUILD_SDL2"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;GL_GLEXT_LEGACY=1;HAVE_PUTENV=1;FTGL_LIBRARY_STATIC;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;BBGE_BUILD_WINDOWS=1;VFS_ENABLE_C_API=1;BBGE_USE_GLM=1;AQUARIA_INTERNAL_FTGL=1"
MinimalRebuild="false"
BasicRuntimeChecks="0"
RuntimeLibrary="3"
@ -117,7 +117,7 @@
OmitFramePointers="true"
EnableFiberSafeOptimizations="true"
AdditionalIncludeDirectories="&quot;$(SolutionDir)\..\ExternalLibs\freetype2\include\freetype\config&quot;;&quot;$(SolutionDir)\..\ExternalLibs\glpng&quot;;&quot;$(SolutionDir)\..\BBGE&quot;;&quot;$(SolutionDir)\..\ExternalLibs\zlib&quot;;&quot;$(SolutionDir)\..\ExternalLibs\png&quot;;&quot;$(SolutionDir)\..\ExternalLibs\libogg\include&quot;;&quot;$(SolutionDir)\..\ExternalLibs\libvorbis\include&quot;;&quot;$(SolutionDir)\..\ExternalLibs\freetype2\include&quot;;&quot;$(SolutionDir)\..\ExternalLibs\FTGL\include&quot;;&quot;$(SolutionDir)\..\ExternalLibs\SDL2\include&quot;;&quot;$(SolutionDir)\..\ExternalLibs\AL\include&quot;;&quot;$(SolutionDir)\..\ExternalLibs\tinyxml2&quot;;&quot;$(SolutionDir)\..\ExternalLibs\ttvfs&quot;;&quot;$(SolutionDir)\..\ExternalLibs\ttvfs_cfileapi&quot;;&quot;$(SolutionDir)\..\ExternalLibs\lvpa&quot;;&quot;$(SolutionDir)\..\ExternalLibs\lvpa\include&quot;;&quot;$(SolutionDir)\..\ExternalLibs&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;GL_GLEXT_LEGACY=1;HAVE_PUTENV=1;FTGL_LIBRARY_STATIC;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;BBGE_BUILD_WINDOWS=1;_HAS_EXCEPTIONS=0;VFS_ENABLE_C_API=1;BBGE_USE_GLM=1;AQUARIA_INTERNAL_FTGL=1;BBGE_BUILD_SDL2"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;GL_GLEXT_LEGACY=1;HAVE_PUTENV=1;FTGL_LIBRARY_STATIC;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;BBGE_BUILD_WINDOWS=1;_HAS_EXCEPTIONS=0;VFS_ENABLE_C_API=1;BBGE_USE_GLM=1;AQUARIA_INTERNAL_FTGL=1"
StringPooling="true"
ExceptionHandling="0"
RuntimeLibrary="0"