mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-07-03 06:24:32 +00:00
Obsolete & remove BBGE_BUILD_SDL2. Closes #65.
This commit is contained in:
parent
a04af25d88
commit
e7594ecead
12 changed files with 41 additions and 39 deletions
|
@ -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)
|
||||
|
|
|
@ -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:
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -31,13 +31,13 @@ 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))
|
||||
if(SDL_InitSubSystem(SDL_INIT_HAPTIC) < 0)
|
||||
debugLog("Failed to init haptic subsystem");
|
||||
# endif
|
||||
#endif
|
||||
sdl_joy = NULL;
|
||||
buttonBitmask = 0;
|
||||
deadZone1 = 0.3f;
|
||||
|
@ -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
|
||||
|
|
|
@ -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,10 +80,10 @@ 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
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue