diff options
| author | 2016-09-21 11:29:48 -0700 | |
|---|---|---|
| committer | 2016-09-21 11:29:48 -0700 | |
| commit | d5d2ca8058a0f1c00ab7ca9fe2c058ba47546c0a (patch) | |
| tree | 8a22ca73ff838f3f0090b29a548ae81087fc90ed /src/citra/emu_window/emu_window_sdl2.cpp | |
| parent | README: Specify master branch for Travis CI badge (diff) | |
| parent | Fix Travis clang-format check (diff) | |
| download | yuzu-d5d2ca8058a0f1c00ab7ca9fe2c058ba47546c0a.tar.gz yuzu-d5d2ca8058a0f1c00ab7ca9fe2c058ba47546c0a.tar.xz yuzu-d5d2ca8058a0f1c00ab7ca9fe2c058ba47546c0a.zip | |
Merge pull request #2086 from linkmauve/clang-format
Add clang-format as part of our {commit,travis}-time checks
Diffstat (limited to 'src/citra/emu_window/emu_window_sdl2.cpp')
| -rw-r--r-- | src/citra/emu_window/emu_window_sdl2.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/citra/emu_window/emu_window_sdl2.cpp b/src/citra/emu_window/emu_window_sdl2.cpp index da12307b7..7df054208 100644 --- a/src/citra/emu_window/emu_window_sdl2.cpp +++ b/src/citra/emu_window/emu_window_sdl2.cpp | |||
| @@ -5,22 +5,16 @@ | |||
| 5 | #include <algorithm> | 5 | #include <algorithm> |
| 6 | #include <cstdlib> | 6 | #include <cstdlib> |
| 7 | #include <string> | 7 | #include <string> |
| 8 | |||
| 9 | #define SDL_MAIN_HANDLED | 8 | #define SDL_MAIN_HANDLED |
| 10 | #include <SDL.h> | 9 | #include <SDL.h> |
| 11 | |||
| 12 | #include <glad/glad.h> | 10 | #include <glad/glad.h> |
| 13 | 11 | #include "citra/emu_window/emu_window_sdl2.h" | |
| 14 | #include "common/key_map.h" | 12 | #include "common/key_map.h" |
| 15 | #include "common/logging/log.h" | 13 | #include "common/logging/log.h" |
| 16 | #include "common/scm_rev.h" | 14 | #include "common/scm_rev.h" |
| 17 | #include "common/string_util.h" | 15 | #include "common/string_util.h" |
| 18 | |||
| 19 | #include "core/settings.h" | ||
| 20 | #include "core/hle/service/hid/hid.h" | 16 | #include "core/hle/service/hid/hid.h" |
| 21 | 17 | #include "core/settings.h" | |
| 22 | #include "citra/emu_window/emu_window_sdl2.h" | ||
| 23 | |||
| 24 | #include "video_core/video_core.h" | 18 | #include "video_core/video_core.h" |
| 25 | 19 | ||
| 26 | void EmuWindow_SDL2::OnMouseMotion(s32 x, s32 y) { | 20 | void EmuWindow_SDL2::OnMouseMotion(s32 x, s32 y) { |
| @@ -40,9 +34,9 @@ void EmuWindow_SDL2::OnMouseButton(u32 button, u8 state, s32 x, s32 y) { | |||
| 40 | 34 | ||
| 41 | void EmuWindow_SDL2::OnKeyEvent(int key, u8 state) { | 35 | void EmuWindow_SDL2::OnKeyEvent(int key, u8 state) { |
| 42 | if (state == SDL_PRESSED) { | 36 | if (state == SDL_PRESSED) { |
| 43 | KeyMap::PressKey(*this, { key, keyboard_id }); | 37 | KeyMap::PressKey(*this, {key, keyboard_id}); |
| 44 | } else if (state == SDL_RELEASED) { | 38 | } else if (state == SDL_RELEASED) { |
| 45 | KeyMap::ReleaseKey(*this, { key, keyboard_id }); | 39 | KeyMap::ReleaseKey(*this, {key, keyboard_id}); |
| 46 | } | 40 | } |
| 47 | } | 41 | } |
| 48 | 42 | ||
| @@ -55,7 +49,8 @@ void EmuWindow_SDL2::OnResize() { | |||
| 55 | 49 | ||
| 56 | SDL_GetWindowSize(render_window, &width, &height); | 50 | SDL_GetWindowSize(render_window, &width, &height); |
| 57 | 51 | ||
| 58 | NotifyFramebufferLayoutChanged(EmuWindow::FramebufferLayout::DefaultScreenLayout(width, height)); | 52 | NotifyFramebufferLayoutChanged( |
| 53 | EmuWindow::FramebufferLayout::DefaultScreenLayout(width, height)); | ||
| 59 | } | 54 | } |
| 60 | 55 | ||
| 61 | EmuWindow_SDL2::EmuWindow_SDL2() { | 56 | EmuWindow_SDL2::EmuWindow_SDL2() { |
| @@ -80,12 +75,13 @@ EmuWindow_SDL2::EmuWindow_SDL2() { | |||
| 80 | SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); | 75 | SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); |
| 81 | SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 0); | 76 | SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 0); |
| 82 | 77 | ||
| 83 | std::string window_title = Common::StringFromFormat("Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc); | 78 | std::string window_title = |
| 84 | render_window = SDL_CreateWindow(window_title.c_str(), | 79 | Common::StringFromFormat("Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc); |
| 80 | render_window = SDL_CreateWindow( | ||
| 81 | window_title.c_str(), | ||
| 85 | SDL_WINDOWPOS_UNDEFINED, // x position | 82 | SDL_WINDOWPOS_UNDEFINED, // x position |
| 86 | SDL_WINDOWPOS_UNDEFINED, // y position | 83 | SDL_WINDOWPOS_UNDEFINED, // y position |
| 87 | VideoCore::kScreenTopWidth, | 84 | VideoCore::kScreenTopWidth, VideoCore::kScreenTopHeight + VideoCore::kScreenBottomHeight, |
| 88 | VideoCore::kScreenTopHeight + VideoCore::kScreenBottomHeight, | ||
| 89 | SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI); | 85 | SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI); |
| 90 | 86 | ||
| 91 | if (render_window == nullptr) { | 87 | if (render_window == nullptr) { |
| @@ -171,10 +167,14 @@ void EmuWindow_SDL2::DoneCurrent() { | |||
| 171 | void EmuWindow_SDL2::ReloadSetKeymaps() { | 167 | void EmuWindow_SDL2::ReloadSetKeymaps() { |
| 172 | KeyMap::ClearKeyMapping(keyboard_id); | 168 | KeyMap::ClearKeyMapping(keyboard_id); |
| 173 | for (int i = 0; i < Settings::NativeInput::NUM_INPUTS; ++i) { | 169 | 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]); | 170 | KeyMap::SetKeyMapping( |
| 171 | {Settings::values.input_mappings[Settings::NativeInput::All[i]], keyboard_id}, | ||
| 172 | KeyMap::mapping_targets[i]); | ||
| 175 | } | 173 | } |
| 176 | } | 174 | } |
| 177 | 175 | ||
| 178 | void EmuWindow_SDL2::OnMinimalClientAreaChangeRequest(const std::pair<unsigned, unsigned>& minimal_size) { | 176 | void EmuWindow_SDL2::OnMinimalClientAreaChangeRequest( |
| 177 | const std::pair<unsigned, unsigned>& minimal_size) { | ||
| 178 | |||
| 179 | SDL_SetWindowMinimumSize(render_window, minimal_size.first, minimal_size.second); | 179 | SDL_SetWindowMinimumSize(render_window, minimal_size.first, minimal_size.second); |
| 180 | } | 180 | } |