Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions drivers/sdl/joypad_sdl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,13 @@
#include <SDL3/SDL_iostream.h>
#include <SDL3/SDL_joystick.h>

JoypadSDL *JoypadSDL::singleton = nullptr;

// Macro to skip the SDL joystick event handling if the device is an SDL gamepad, because
// there are separate events for SDL gamepads
#define SKIP_EVENT_FOR_GAMEPAD \
if (SDL_IsGamepad(sdl_event.jdevice.which)) { \
continue; \
}

JoypadSDL::JoypadSDL() {
singleton = this;
}

JoypadSDL::~JoypadSDL() {
// Process any remaining input events
process_events();
Expand All @@ -65,11 +59,6 @@ JoypadSDL::~JoypadSDL() {
}
}
SDL_Quit();
singleton = nullptr;
}

JoypadSDL *JoypadSDL::get_singleton() {
return singleton;
}

Error JoypadSDL::initialize() {
Expand Down
5 changes: 0 additions & 5 deletions drivers/sdl/joypad_sdl.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,8 @@ typedef struct SDL_Gamepad SDL_Gamepad;

class JoypadSDL {
public:
JoypadSDL();
~JoypadSDL();

static JoypadSDL *get_singleton();

Error initialize();
void process_events();

Expand All @@ -69,8 +66,6 @@ class JoypadSDL {
SDL_Gamepad *get_sdl_gamepad() const;
};

static JoypadSDL *singleton;

Joypad joypads[Input::JOYPADS_MAX];
HashMap<SDL_JoystickID, int> sdl_instance_id_to_joypad_id;

Expand Down