yuzu/src/yuzu_cmd/emu_window/emu_window_sdl2.h

94 lines
2.8 KiB
C++
Raw Normal View History

chore: make yuzu REUSE compliant [REUSE] is a specification that aims at making file copyright information consistent, so that it can be both human and machine readable. It basically requires that all files have a header containing copyright and licensing information. When this isn't possible, like when dealing with binary assets, generated files or embedded third-party dependencies, it is permitted to insert copyright information in the `.reuse/dep5` file. Oh, and it also requires that all the licenses used in the project are present in the `LICENSES` folder, that's why the diff is so huge. This can be done automatically with `reuse download --all`. The `reuse` tool also contains a handy subcommand that analyzes the project and tells whether or not the project is (still) compliant, `reuse lint`. Following REUSE has a few advantages over the current approach: - Copyright information is easy to access for users / downstream - Files like `dist/license.md` do not need to exist anymore, as `.reuse/dep5` is used instead - `reuse lint` makes it easy to ensure that copyright information of files like binary assets / images is always accurate and up to date To add copyright information of files that didn't have it I looked up who committed what and when, for each file. As yuzu contributors do not have to sign a CLA or similar I couldn't assume that copyright ownership was of the "yuzu Emulator Project", so I used the name and/or email of the commit author instead. [REUSE]: https://reuse.software Follow-up to 01cf05bc75b1e47beb08937439f3ed9339e7b254
2022-05-14 20:06:02 -04:00
// SPDX-FileCopyrightText: 2016 Citra Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <utility>
#include "core/frontend/emu_window.h"
struct SDL_Window;
namespace Core {
class System;
}
namespace InputCommon {
class InputSubsystem;
2021-02-23 21:39:02 -05:00
enum class MouseButton;
2021-09-20 20:40:00 -04:00
} // namespace InputCommon
2021-02-23 21:39:02 -05:00
class EmuWindow_SDL2 : public Core::Frontend::EmuWindow {
public:
2022-06-13 15:41:36 -04:00
explicit EmuWindow_SDL2(InputCommon::InputSubsystem* input_subsystem_, Core::System& system_);
~EmuWindow_SDL2();
/// Whether the window is still open, and a close request hasn't yet been sent
bool IsOpen() const;
/// Returns if window is shown (not minimized)
bool IsShown() const override;
/// Wait for the next event on the main thread.
void WaitEvent();
// Sets the window icon from yuzu.bmp
void SetWindowIcon();
protected:
/// Called by WaitEvent when a key is pressed or released.
void OnKeyEvent(int key, u8 state);
/// Called by WaitEvent when the mouse moves.
void OnMouseMotion(s32 x, s32 y);
2021-02-23 21:39:02 -05:00
/// Converts a SDL mouse button into MouseInput mouse button
2021-09-20 20:40:00 -04:00
InputCommon::MouseButton SDLButtonToMouseButton(u32 button) const;
2021-02-23 21:39:02 -05:00
/// Called by WaitEvent when a mouse button is pressed or released
void OnMouseButton(u32 button, u8 state, s32 x, s32 y);
/// Translates pixel position (0..1) to pixel positions
std::pair<unsigned, unsigned> TouchToPixelPos(float touch_x, float touch_y) const;
/// Called by WaitEvent when a finger starts touching the touchscreen
2021-09-20 20:40:00 -04:00
void OnFingerDown(float x, float y, std::size_t id);
/// Called by WaitEvent when a finger moves while touching the touchscreen
2021-09-20 20:40:00 -04:00
void OnFingerMotion(float x, float y, std::size_t id);
/// Called by WaitEvent when a finger stops touching the touchscreen
void OnFingerUp();
/// Called by WaitEvent when any event that may cause the window to be resized occurs
void OnResize();
/// Called when users want to hide the mouse cursor
void ShowCursor(bool show_cursor);
/// Called when user passes the fullscreen parameter flag
void Fullscreen();
/// Called when a configuration change affects the minimal size of the window
void OnMinimalClientAreaChangeRequest(std::pair<u32, u32> minimal_size) override;
/// Is the window still open?
bool is_open = true;
/// Is the window being shown?
bool is_shown = true;
/// Internal SDL2 render window
SDL_Window* render_window{};
/// Keeps track of how often to update the title bar during gameplay
u32 last_time = 0;
/// Input subsystem to use with this window.
InputCommon::InputSubsystem* input_subsystem;
/// yuzu core instance
Core::System& system;
};
2022-11-27 20:37:37 -05:00
class DummyContext : public Core::Frontend::GraphicsContext {};