mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-18 09:24:58 +00:00
Add poll interval to libScePad (#1415)
This commit is contained in:
parent
87f8fea4de
commit
c38e3f77f9
5 changed files with 38 additions and 2 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue