diff options
Diffstat (limited to 'src/citra/emu_window/emu_window_sdl2.h')
| -rw-r--r-- | src/citra/emu_window/emu_window_sdl2.h | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/src/citra/emu_window/emu_window_sdl2.h b/src/citra/emu_window/emu_window_sdl2.h new file mode 100644 index 000000000..77279f022 --- /dev/null +++ b/src/citra/emu_window/emu_window_sdl2.h | |||
| @@ -0,0 +1,64 @@ | |||
| 1 | // Copyright 2016 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include <utility> | ||
| 8 | |||
| 9 | #include "common/emu_window.h" | ||
| 10 | |||
| 11 | struct SDL_Window; | ||
| 12 | |||
| 13 | class EmuWindow_SDL2 : public EmuWindow { | ||
| 14 | public: | ||
| 15 | EmuWindow_SDL2(); | ||
| 16 | ~EmuWindow_SDL2(); | ||
| 17 | |||
| 18 | /// Swap buffers to display the next frame | ||
| 19 | void SwapBuffers() override; | ||
| 20 | |||
| 21 | /// Polls window events | ||
| 22 | void PollEvents() override; | ||
| 23 | |||
| 24 | /// Makes the graphics context current for the caller thread | ||
| 25 | void MakeCurrent() override; | ||
| 26 | |||
| 27 | /// Releases the GL context from the caller thread | ||
| 28 | void DoneCurrent() override; | ||
| 29 | |||
| 30 | /// Whether the window is still open, and a close request hasn't yet been sent | ||
| 31 | bool IsOpen() const; | ||
| 32 | |||
| 33 | /// Load keymap from configuration | ||
| 34 | void ReloadSetKeymaps() override; | ||
| 35 | |||
| 36 | private: | ||
| 37 | /// Called by PollEvents when a key is pressed or released. | ||
| 38 | void OnKeyEvent(int key, u8 state); | ||
| 39 | |||
| 40 | /// Called by PollEvents when the mouse moves. | ||
| 41 | void OnMouseMotion(s32 x, s32 y); | ||
| 42 | |||
| 43 | /// Called by PollEvents when a mouse button is pressed or released | ||
| 44 | void OnMouseButton(u32 button, u8 state, s32 x, s32 y); | ||
| 45 | |||
| 46 | /// Called by PollEvents when any event that may cause the window to be resized occurs | ||
| 47 | void OnResize(); | ||
| 48 | |||
| 49 | /// Called when a configuration change affects the minimal size of the window | ||
| 50 | void OnMinimalClientAreaChangeRequest(const std::pair<unsigned, unsigned>& minimal_size) override; | ||
| 51 | |||
| 52 | /// Is the window still open? | ||
| 53 | bool is_open = true; | ||
| 54 | |||
| 55 | /// Internal SDL2 render window | ||
| 56 | SDL_Window* render_window; | ||
| 57 | |||
| 58 | using SDL_GLContext = void *; | ||
| 59 | /// The OpenGL context associated with the window | ||
| 60 | SDL_GLContext gl_context; | ||
| 61 | |||
| 62 | /// Device id of keyboard for use with KeyMap | ||
| 63 | int keyboard_id; | ||
| 64 | }; | ||