mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-12-10 05:38:49 +00:00
Add poll interval to libScePad (#1415)
This commit is contained in:
committed by
GitHub
parent
87f8fea4de
commit
c38e3f77f9
@@ -4,6 +4,7 @@
|
||||
#include <SDL3/SDL_events.h>
|
||||
#include <SDL3/SDL_init.h>
|
||||
#include <SDL3/SDL_properties.h>
|
||||
#include <SDL3/SDL_timer.h>
|
||||
#include <SDL3/SDL_video.h>
|
||||
#include "common/assert.h"
|
||||
#include "common/config.h"
|
||||
@@ -20,6 +21,11 @@
|
||||
|
||||
namespace Frontend {
|
||||
|
||||
static Uint32 SDLCALL PollController(void* userdata, SDL_TimerID timer_id, Uint32 interval) {
|
||||
auto* controller = reinterpret_cast<Input::GameController*>(userdata);
|
||||
return controller->Poll();
|
||||
}
|
||||
|
||||
WindowSDL::WindowSDL(s32 width_, s32 height_, Input::GameController* controller_,
|
||||
std::string_view window_title)
|
||||
: width{width_}, height{height_}, controller{controller_} {
|
||||
@@ -119,6 +125,10 @@ void WindowSDL::waitEvent() {
|
||||
}
|
||||
}
|
||||
|
||||
void WindowSDL::initTimers() {
|
||||
SDL_AddTimer(100, &PollController, controller);
|
||||
}
|
||||
|
||||
void WindowSDL::onResize() {
|
||||
SDL_GetWindowSizeInPixels(window, &width, &height);
|
||||
ImGui::Core::OnResize();
|
||||
|
||||
Reference in New Issue
Block a user