diff options
| author | bunnei <bunneidev@gmail.com> | 2016-03-02 20:32:32 -0500 | 
|---|---|---|
| committer | bunnei <bunneidev@gmail.com> | 2016-03-02 20:32:32 -0500 | 
| commit | 699b2a6571849bddda4fee3eb31f2f7b7e83a882 (patch) | |
| tree | 0db944960a7f7a924f34afa1222ad6e9d3421b11 /src/citra/emu_window/emu_window_sdl2.h | |
| parent | ea0ca1721521c2b20ac8cc9b1d8eab08f8ec23a9 (diff) | |
| parent | 48366b1071a7e6ee367435b78845b429c0c9c31f (diff) | |
Merge pull request #1403 from MerryMage/sdl
Dependencies: Remove GLFW, Add SDL2
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 @@ +// Copyright 2016 Citra Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include <utility> + +#include "common/emu_window.h" + +struct SDL_Window; + +class EmuWindow_SDL2 : public EmuWindow { +public: +    EmuWindow_SDL2(); +    ~EmuWindow_SDL2(); + +    /// Swap buffers to display the next frame +    void SwapBuffers() override; + +    /// Polls window events +    void PollEvents() override; + +    /// Makes the graphics context current for the caller thread +    void MakeCurrent() override; + +    /// Releases the GL context from the caller thread +    void DoneCurrent() override; + +    /// Whether the window is still open, and a close request hasn't yet been sent +    bool IsOpen() const; + +    /// Load keymap from configuration +    void ReloadSetKeymaps() override; + +private: +    /// Called by PollEvents when a key is pressed or released. +    void OnKeyEvent(int key, u8 state); + +    /// Called by PollEvents when the mouse moves. +    void OnMouseMotion(s32 x, s32 y); + +    /// Called by PollEvents when a mouse button is pressed or released +    void OnMouseButton(u32 button, u8 state, s32 x, s32 y); + +    /// Called by PollEvents when any event that may cause the window to be resized occurs +    void OnResize(); + +    /// Called when a configuration change affects the minimal size of the window +    void OnMinimalClientAreaChangeRequest(const std::pair<unsigned, unsigned>& minimal_size) override; + +    /// Is the window still open? +    bool is_open = true; + +    /// Internal SDL2 render window +    SDL_Window* render_window; + +    using SDL_GLContext = void *; +    /// The OpenGL context associated with the window +    SDL_GLContext gl_context; + +    /// Device id of keyboard for use with KeyMap +    int keyboard_id; +}; | 
