Debian Codegraph @

Source/Core/DolphinNoGUI/Platform.h

raw symbols SCIP
1 // Copyright 2018 Dolphin Emulator Project
2 // SPDX-License-Identifier: GPL-2.0-or-later
3
4 #pragma once
5
6 #include <memory>
7 #include <string>
8
9 #include "Common/Flag.h"
10 #include "Common/WindowSystemInfo.h"
11
12 class Platform
13 {
14 public:
15 virtual ~Platform();
16
17 bool IsRunning() const { return m_running.IsSet(); }
18 bool IsWindowFocused() const { return m_window_focus; }
19 bool IsWindowFullscreen() const { return m_window_fullscreen; }
20
21 virtual bool Init();
22 virtual void SetTitle(const std::string& title);
23 virtual void MainLoop() = 0;
24
25 virtual WindowSystemInfo GetWindowSystemInfo() const = 0;
26
27 // Requests a graceful shutdown, from SIGINT/SIGTERM.
28 void RequestShutdown();
29
30 // Request an immediate shutdown.
31 void Stop();
32
33 static std::unique_ptr<Platform> CreateHeadlessPlatform();
34 #ifdef HAVE_X11
35 static std::unique_ptr<Platform> CreateX11Platform();
36 #endif
37
38 #ifdef __linux__
39 static std::unique_ptr<Platform> CreateFBDevPlatform();
40 #endif
41
42 #ifdef _WIN32
43 static std::unique_ptr<Platform> CreateWin32Platform();
44 #endif
45
46 #ifdef __APPLE__
47 static std::unique_ptr<Platform> CreateMacOSPlatform();
48 #endif
49
50 protected:
51 void UpdateRunningFlag();
52
53 Common::Flag m_running{true};
54 Common::Flag m_shutdown_requested{false};
55 Common::Flag m_tried_graceful_shutdown{false};
56
57 bool m_window_focus = true; // Should be made atomic if actually implemented
58 bool m_window_fullscreen = false;
59 };