Fix SDL input. fix travis build error.

This commit is contained in:
Anon 2016-07-30 11:39:21 -05:00
parent 8aa5a2c64f
commit 788f00119c
4 changed files with 15 additions and 8 deletions

View File

@ -58,8 +58,8 @@ static const std::array<int, Settings::NativeInput::NUM_INPUTS> defaults = {
void Config::ReadValues() { void Config::ReadValues() {
// Controls // Controls
for (int i = 0; i < Settings::NativeInput::NUM_INPUTS; ++i) { for (int i = 0; i < Settings::NativeInput::NUM_INPUTS; ++i) {
//Settings::values.input_mappings[Settings::NativeInput::All[i]] = Settings::values.input_mappings[Settings::NativeInput::All[i]] =
// sdl2_config->GetInteger("Controls", Settings::NativeInput::Mapping[i], defaults[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); Settings::values.pad_circle_modifier_scale = (float)sdl2_config->GetReal("Controls", "pad_circle_modifier_scale", 0.5);

View File

@ -18,6 +18,9 @@
#include "core/settings.h" #include "core/settings.h"
#include "core/hle/service/hid/hid.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 "citra/emu_window/emu_window_sdl2.h"
#include "video_core/video_core.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) { if (state == SDL_PRESSED) {
//KeyMap::PressKey(*this, key); keyboard->KeyPressed(param);
} }
else if (state == SDL_RELEASED) { else if (state == SDL_RELEASED) {
//KeyMap::ReleaseKey(*this, key); keyboard->KeyReleased(param);
} }
} }
@ -144,7 +150,7 @@ void EmuWindow_SDL2::PollEvents() {
break; break;
case SDL_KEYDOWN: case SDL_KEYDOWN:
case SDL_KEYUP: case SDL_KEYUP:
OnKeyEvent(static_cast<int>(event.key.keysym.scancode), event.key.state); OnKeyEvent(event.key.keysym, event.key.state);
break; break;
case SDL_MOUSEMOTION: case SDL_MOUSEMOTION:
OnMouseMotion(event.motion.x, event.motion.y); OnMouseMotion(event.motion.x, event.motion.y);

View File

@ -9,6 +9,7 @@
#include "common/emu_window.h" #include "common/emu_window.h"
struct SDL_Window; struct SDL_Window;
struct SDL_Keysym;
class EmuWindow_SDL2 : public EmuWindow { class EmuWindow_SDL2 : public EmuWindow {
public: public:
@ -35,7 +36,7 @@ public:
private: private:
/// Called by PollEvents when a key is pressed or released. /// 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. /// Called by PollEvents when the mouse moves.
void OnMouseMotion(s32 x, s32 y); void OnMouseMotion(s32 x, s32 y);

View File

@ -12,7 +12,7 @@
#include "core/hle/service/hid/hid_spvr.h" #include "core/hle/service/hid/hid_spvr.h"
#include "core/hle/service/hid/hid_user.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/core_timing.h"
#include "core/hle/kernel/event.h" #include "core/hle/kernel/event.h"