| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#pragma once |
| 5 |
|
| 6 |
#include <map> |
| 7 |
#include <memory> |
| 8 |
#include <mutex> |
| 9 |
#include <span> |
| 10 |
#include <vector> |
| 11 |
|
| 12 |
#include "Common/CommonTypes.h" |
| 13 |
#include "VideoCommon/OnScreenUIKeyMap.h" |
| 14 |
|
| 15 |
class NativeVertexFormat; |
| 16 |
class AbstractTexture; |
| 17 |
class AbstractPipeline; |
| 18 |
struct ImTextureData; |
| 19 |
|
| 20 |
namespace VideoCommon |
| 21 |
{ |
| 22 |
|
| 23 |
class OnScreenUI |
| 24 |
{ |
| 25 |
public: |
| 26 |
OnScreenUI() = default; |
| 27 |
~OnScreenUI(); |
| 28 |
|
| 29 |
|
| 30 |
bool Initialize(u32 width, u32 height, float scale); |
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
std::unique_lock<std::mutex> GetImGuiLock(); |
| 36 |
|
| 37 |
bool IsReady() { return m_ready; } |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
void BeginImGuiFrame(u32 width, u32 height); |
| 42 |
|
| 43 |
|
| 44 |
void BeginImGuiFrameUnlocked(u32 width, u32 height); |
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
void DrawImGui(); |
| 49 |
|
| 50 |
|
| 51 |
bool RecompileImGuiPipeline(); |
| 52 |
|
| 53 |
void SetScale(float backbuffer_scale); |
| 54 |
|
| 55 |
void Finalize(); |
| 56 |
|
| 57 |
|
| 58 |
void SetKeyMap(const DolphinKeyMap& key_map); |
| 59 |
void SetKey(u32 key, bool is_down, const char* chars); |
| 60 |
void SetMousePos(float x, float y); |
| 61 |
void SetMousePress(u32 button_mask); |
| 62 |
|
| 63 |
private: |
| 64 |
void DrawDebugText(); |
| 65 |
void DrawChallengesAndLeaderboards(); |
| 66 |
void UpdateImguiTexture(ImTextureData* tex); |
| 67 |
|
| 68 |
|
| 69 |
std::unique_ptr<NativeVertexFormat> m_imgui_vertex_format; |
| 70 |
std::vector<std::unique_ptr<AbstractTexture>> m_imgui_textures; |
| 71 |
std::unique_ptr<AbstractPipeline> m_imgui_pipeline; |
| 72 |
std::map<u32, int> m_dolphin_to_imgui_map; |
| 73 |
std::mutex m_imgui_mutex; |
| 74 |
u64 m_imgui_last_frame_time = 0; |
| 75 |
|
| 76 |
u32 m_backbuffer_width = 1; |
| 77 |
u32 m_backbuffer_height = 1; |
| 78 |
float m_backbuffer_scale = 1.0; |
| 79 |
|
| 80 |
#ifdef USE_RETRO_ACHIEVEMENTS |
| 81 |
std::map<int, std::unique_ptr<AbstractTexture>, std::less<>> m_challenge_texture_map; |
| 82 |
#endif |
| 83 |
|
| 84 |
bool m_ready = false; |
| 85 |
}; |
| 86 |
} |