diff options
Diffstat (limited to 'src/citra/emu_window/emu_window_sdl2.cpp')
| -rw-r--r-- | src/citra/emu_window/emu_window_sdl2.cpp | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/citra/emu_window/emu_window_sdl2.cpp b/src/citra/emu_window/emu_window_sdl2.cpp index da12307b7..12f3e2c71 100644 --- a/src/citra/emu_window/emu_window_sdl2.cpp +++ b/src/citra/emu_window/emu_window_sdl2.cpp | |||
| @@ -16,8 +16,8 @@ | |||
| 16 | #include "common/scm_rev.h" | 16 | #include "common/scm_rev.h" |
| 17 | #include "common/string_util.h" | 17 | #include "common/string_util.h" |
| 18 | 18 | ||
| 19 | #include "core/settings.h" | ||
| 20 | #include "core/hle/service/hid/hid.h" | 19 | #include "core/hle/service/hid/hid.h" |
| 20 | #include "core/settings.h" | ||
| 21 | 21 | ||
| 22 | #include "citra/emu_window/emu_window_sdl2.h" | 22 | #include "citra/emu_window/emu_window_sdl2.h" |
| 23 | 23 | ||
| @@ -40,9 +40,9 @@ void EmuWindow_SDL2::OnMouseButton(u32 button, u8 state, s32 x, s32 y) { | |||
| 40 | 40 | ||
| 41 | void EmuWindow_SDL2::OnKeyEvent(int key, u8 state) { | 41 | void EmuWindow_SDL2::OnKeyEvent(int key, u8 state) { |
| 42 | if (state == SDL_PRESSED) { | 42 | if (state == SDL_PRESSED) { |
| 43 | KeyMap::PressKey(*this, { key, keyboard_id }); | 43 | KeyMap::PressKey(*this, {key, keyboard_id}); |
| 44 | } else if (state == SDL_RELEASED) { | 44 | } else if (state == SDL_RELEASED) { |
| 45 | KeyMap::ReleaseKey(*this, { key, keyboard_id }); | 45 | KeyMap::ReleaseKey(*this, {key, keyboard_id}); |
| 46 | } | 46 | } |
| 47 | } | 47 | } |
| 48 | 48 | ||
| @@ -55,7 +55,8 @@ void EmuWindow_SDL2::OnResize() { | |||
| 55 | 55 | ||
| 56 | SDL_GetWindowSize(render_window, &width, &height); | 56 | SDL_GetWindowSize(render_window, &width, &height); |
| 57 | 57 | ||
| 58 | NotifyFramebufferLayoutChanged(EmuWindow::FramebufferLayout::DefaultScreenLayout(width, height)); | 58 | NotifyFramebufferLayoutChanged( |
| 59 | EmuWindow::FramebufferLayout::DefaultScreenLayout(width, height)); | ||
| 59 | } | 60 | } |
| 60 | 61 | ||
| 61 | EmuWindow_SDL2::EmuWindow_SDL2() { | 62 | EmuWindow_SDL2::EmuWindow_SDL2() { |
| @@ -80,12 +81,13 @@ EmuWindow_SDL2::EmuWindow_SDL2() { | |||
| 80 | SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); | 81 | SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); |
| 81 | SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 0); | 82 | SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 0); |
| 82 | 83 | ||
| 83 | std::string window_title = Common::StringFromFormat("Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc); | 84 | std::string window_title = |
| 84 | render_window = SDL_CreateWindow(window_title.c_str(), | 85 | Common::StringFromFormat("Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc); |
| 86 | render_window = SDL_CreateWindow( | ||
| 87 | window_title.c_str(), | ||
| 85 | SDL_WINDOWPOS_UNDEFINED, // x position | 88 | SDL_WINDOWPOS_UNDEFINED, // x position |
| 86 | SDL_WINDOWPOS_UNDEFINED, // y position | 89 | SDL_WINDOWPOS_UNDEFINED, // y position |
| 87 | VideoCore::kScreenTopWidth, | 90 | VideoCore::kScreenTopWidth, VideoCore::kScreenTopHeight + VideoCore::kScreenBottomHeight, |
| 88 | VideoCore::kScreenTopHeight + VideoCore::kScreenBottomHeight, | ||
| 89 | SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI); | 91 | SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI); |
| 90 | 92 | ||
| 91 | if (render_window == nullptr) { | 93 | if (render_window == nullptr) { |
| @@ -171,10 +173,13 @@ void EmuWindow_SDL2::DoneCurrent() { | |||
| 171 | void EmuWindow_SDL2::ReloadSetKeymaps() { | 173 | void EmuWindow_SDL2::ReloadSetKeymaps() { |
| 172 | KeyMap::ClearKeyMapping(keyboard_id); | 174 | KeyMap::ClearKeyMapping(keyboard_id); |
| 173 | for (int i = 0; i < Settings::NativeInput::NUM_INPUTS; ++i) { | 175 | for (int i = 0; i < Settings::NativeInput::NUM_INPUTS; ++i) { |
| 174 | KeyMap::SetKeyMapping({ Settings::values.input_mappings[Settings::NativeInput::All[i]], keyboard_id }, KeyMap::mapping_targets[i]); | 176 | KeyMap::SetKeyMapping( |
| 177 | {Settings::values.input_mappings[Settings::NativeInput::All[i]], keyboard_id}, | ||
| 178 | KeyMap::mapping_targets[i]); | ||
| 175 | } | 179 | } |
| 176 | } | 180 | } |
| 177 | 181 | ||
| 178 | void EmuWindow_SDL2::OnMinimalClientAreaChangeRequest(const std::pair<unsigned, unsigned>& minimal_size) { | 182 | void EmuWindow_SDL2::OnMinimalClientAreaChangeRequest( |
| 183 | const std::pair<unsigned, unsigned>& minimal_size) { | ||
| 179 | SDL_SetWindowMinimumSize(render_window, minimal_size.first, minimal_size.second); | 184 | SDL_SetWindowMinimumSize(render_window, minimal_size.first, minimal_size.second); |
| 180 | } | 185 | } |