2016-03-01 17:24:18 +00:00
|
|
|
// Copyright 2016 Citra Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2016-12-11 21:32:41 +00:00
|
|
|
#include <memory>
|
2016-03-01 17:24:18 +00:00
|
|
|
#include <utility>
|
2016-12-23 13:37:40 +00:00
|
|
|
#include "core/frontend/emu_window.h"
|
2016-03-01 17:24:18 +00:00
|
|
|
|
|
|
|
struct SDL_Window;
|
|
|
|
|
2018-08-12 00:20:19 +00:00
|
|
|
class EmuWindow_SDL2 : public Core::Frontend::EmuWindow {
|
2016-03-01 17:24:18 +00:00
|
|
|
public:
|
2018-04-21 07:52:34 +00:00
|
|
|
explicit EmuWindow_SDL2(bool fullscreen);
|
2016-03-01 17:24:18 +00:00
|
|
|
~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;
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
2018-04-21 07:52:34 +00:00
|
|
|
/// Called when user passes the fullscreen parameter flag
|
|
|
|
void Fullscreen();
|
|
|
|
|
2018-05-30 22:35:57 +00:00
|
|
|
/// Whether the GPU and driver supports the OpenGL extension required
|
|
|
|
bool SupportsRequiredGLExtensions();
|
|
|
|
|
2016-03-01 17:24:18 +00:00
|
|
|
/// Called when a configuration change affects the minimal size of the window
|
2016-09-19 01:01:46 +00:00
|
|
|
void OnMinimalClientAreaChangeRequest(
|
|
|
|
const std::pair<unsigned, unsigned>& minimal_size) override;
|
2016-03-01 17:24:18 +00:00
|
|
|
|
|
|
|
/// Is the window still open?
|
|
|
|
bool is_open = true;
|
|
|
|
|
|
|
|
/// Internal SDL2 render window
|
|
|
|
SDL_Window* render_window;
|
|
|
|
|
2016-09-18 00:38:01 +00:00
|
|
|
using SDL_GLContext = void*;
|
2016-03-01 17:24:18 +00:00
|
|
|
/// The OpenGL context associated with the window
|
|
|
|
SDL_GLContext gl_context;
|
|
|
|
};
|