mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-25 14:50:15 +00:00
Fix SDL input. fix travis build error.
This commit is contained in:
parent
8aa5a2c64f
commit
788f00119c
@ -58,8 +58,8 @@ static const std::array<int, Settings::NativeInput::NUM_INPUTS> defaults = {
|
||||
void Config::ReadValues() {
|
||||
// Controls
|
||||
for (int i = 0; i < Settings::NativeInput::NUM_INPUTS; ++i) {
|
||||
//Settings::values.input_mappings[Settings::NativeInput::All[i]] =
|
||||
// sdl2_config->GetInteger("Controls", Settings::NativeInput::Mapping[i], defaults[i]);
|
||||
Settings::values.input_mappings[Settings::NativeInput::All[i]] =
|
||||
sdl2_config->Get("Controls", Settings::NativeInput::Mapping[i], std::to_string(defaults[i]));
|
||||
}
|
||||
Settings::values.pad_circle_modifier_scale = (float)sdl2_config->GetReal("Controls", "pad_circle_modifier_scale", 0.5);
|
||||
|
||||
|
@ -18,6 +18,9 @@
|
||||
#include "core/settings.h"
|
||||
#include "core/hle/service/hid/hid.h"
|
||||
|
||||
#include "input_core/input_core.h"
|
||||
#include "input_core/devices/Keyboard.h"
|
||||
|
||||
#include "citra/emu_window/emu_window_sdl2.h"
|
||||
|
||||
#include "video_core/video_core.h"
|
||||
@ -38,12 +41,15 @@ void EmuWindow_SDL2::OnMouseButton(u32 button, u8 state, s32 x, s32 y) {
|
||||
}
|
||||
}
|
||||
|
||||
void EmuWindow_SDL2::OnKeyEvent(int key, u8 state) {
|
||||
void EmuWindow_SDL2::OnKeyEvent(SDL_Keysym key, u8 state) {
|
||||
auto& keyboard = InputCore::main_keyboard;
|
||||
KeyboardKey param = KeyboardKey(key.sym, key.scancode, SDL_GetKeyName(key.scancode));
|
||||
|
||||
if (state == SDL_PRESSED) {
|
||||
//KeyMap::PressKey(*this, key);
|
||||
keyboard->KeyPressed(param);
|
||||
}
|
||||
else if (state == SDL_RELEASED) {
|
||||
//KeyMap::ReleaseKey(*this, key);
|
||||
keyboard->KeyReleased(param);
|
||||
}
|
||||
}
|
||||
|
||||
@ -144,7 +150,7 @@ void EmuWindow_SDL2::PollEvents() {
|
||||
break;
|
||||
case SDL_KEYDOWN:
|
||||
case SDL_KEYUP:
|
||||
OnKeyEvent(static_cast<int>(event.key.keysym.scancode), event.key.state);
|
||||
OnKeyEvent(event.key.keysym, event.key.state);
|
||||
break;
|
||||
case SDL_MOUSEMOTION:
|
||||
OnMouseMotion(event.motion.x, event.motion.y);
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "common/emu_window.h"
|
||||
|
||||
struct SDL_Window;
|
||||
struct SDL_Keysym;
|
||||
|
||||
class EmuWindow_SDL2 : public EmuWindow {
|
||||
public:
|
||||
@ -35,7 +36,7 @@ public:
|
||||
|
||||
private:
|
||||
/// Called by PollEvents when a key is pressed or released.
|
||||
void OnKeyEvent(int key, u8 state);
|
||||
void OnKeyEvent(SDL_Keysym key, u8 state);
|
||||
|
||||
/// Called by PollEvents when the mouse moves.
|
||||
void OnMouseMotion(s32 x, s32 y);
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "core/hle/service/hid/hid_spvr.h"
|
||||
#include "core/hle/service/hid/hid_user.h"
|
||||
|
||||
#include "input_core\input_core.h"
|
||||
#include "input_core/input_core.h"
|
||||
|
||||
#include "core/core_timing.h"
|
||||
#include "core/hle/kernel/event.h"
|
||||
|
Loading…
Reference in New Issue
Block a user