summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/common/common.vcxproj1
-rw-r--r--src/common/common.vcxproj.filters1
-rw-r--r--src/common/src/emu_window.h106
3 files changed, 108 insertions, 0 deletions
diff --git a/src/common/common.vcxproj b/src/common/common.vcxproj
index 1cfe0bb37..8190f0e31 100644
--- a/src/common/common.vcxproj
+++ b/src/common/common.vcxproj
@@ -154,6 +154,7 @@
154 <ClInclude Include="src\console_listener.h" /> 154 <ClInclude Include="src\console_listener.h" />
155 <ClInclude Include="src\cpu_detect.h" /> 155 <ClInclude Include="src\cpu_detect.h" />
156 <ClInclude Include="src\debug_interface.h" /> 156 <ClInclude Include="src\debug_interface.h" />
157 <ClInclude Include="src\emu_window.h" />
157 <ClInclude Include="src\extended_trace.h" /> 158 <ClInclude Include="src\extended_trace.h" />
158 <ClInclude Include="src\fifo_queue.h" /> 159 <ClInclude Include="src\fifo_queue.h" />
159 <ClInclude Include="src\file_search.h" /> 160 <ClInclude Include="src\file_search.h" />
diff --git a/src/common/common.vcxproj.filters b/src/common/common.vcxproj.filters
index ab8e5d12e..ddfb609e4 100644
--- a/src/common/common.vcxproj.filters
+++ b/src/common/common.vcxproj.filters
@@ -52,6 +52,7 @@
52 <ClInclude Include="src\timer.h" /> 52 <ClInclude Include="src\timer.h" />
53 <ClInclude Include="src\atomic_gcc.h" /> 53 <ClInclude Include="src\atomic_gcc.h" />
54 <ClInclude Include="src\atomic_win32.h" /> 54 <ClInclude Include="src\atomic_win32.h" />
55 <ClInclude Include="src\emu_window.h" />
55 </ItemGroup> 56 </ItemGroup>
56 <ItemGroup> 57 <ItemGroup>
57 <None Include="CMakeLists.txt" /> 58 <None Include="CMakeLists.txt" />
diff --git a/src/common/src/emu_window.h b/src/common/src/emu_window.h
new file mode 100644
index 000000000..08f7d4766
--- /dev/null
+++ b/src/common/src/emu_window.h
@@ -0,0 +1,106 @@
1/**
2 * Copyright (C) 2005-2012 Gekko Emulator
3 *
4 * @file emuwindow.h
5 * @author Neobrain
6 * @date 2012-06-01
7 * @brief Interface for implementing an emulator window manager
8 *
9 * @section LICENSE
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation; either version 2 of
13 * the License, or (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details at
19 * http://www.gnu.org/copyleft/gpl.html
20 *
21 * Official project repository can be found at:
22 * http://code.google.com/p/gekko-gc-emu/
23 */
24
25#ifndef CORE_EMUWINDOW_H_
26#define CORE_EMUWINDOW_H_
27
28#include "common.h"
29#include "config.h"
30
31namespace input_common
32{
33class KeyboardInput;
34}
35
36// Abstraction class used to provide an interface between emulation code and the frontend (e.g. SDL,
37// QGLWidget, GLFW, etc...)
38class EmuWindow
39{
40
41public:
42 /// Data structure to store an emuwindow configuration
43 struct Config{
44 bool fullscreen;
45 int res_width;
46 int res_height;
47 };
48
49 /// Swap buffers to display the next frame
50 virtual void SwapBuffers() = 0;
51
52 /// Polls window events
53 virtual void PollEvents() = 0;
54
55 /// Makes the graphics context current for the caller thread
56 virtual void MakeCurrent() = 0;
57
58 /// Releases (dunno if this is the "right" word) the GLFW context from the caller thread
59 virtual void DoneCurrent() = 0;
60
61 /**
62 * @brief Called from KeyboardInput constructor to notify EmuWindow about its presence
63 * @param controller_interface Pointer to a running KeyboardInput interface
64 */
65 void set_controller_interface(input_common::KeyboardInput* controller_interface) {
66 controller_interface_ = controller_interface;
67 }
68 input_common::KeyboardInput* controller_interface() { return controller_interface_; }
69
70 Config config() { return config_; }
71 void set_config(Config val) { config_ = val; }
72
73 int client_area_width() { return client_area_width_; }
74 void set_client_area_width(int val) { client_area_width_ = val; }
75
76 int client_area_height() { return client_area_height_; }
77 void set_client_area_height(int val) { client_area_height_ = val; }
78
79 std::string window_title() { return window_title_; }
80 void set_window_title(std::string val) { window_title_ = val; }
81
82protected:
83 EmuWindow() : controller_interface_(NULL), client_area_width_(640), client_area_height_(480) {
84 char window_title[255];
85 sprintf(window_title, "gekko [%s|%s] - %s",
86 common::g_config->CPUCoreTypeToString(common::g_config->powerpc_core()).c_str(),
87 common::g_config->RenderTypeToString(common::g_config->current_renderer()).c_str(),
88 __DATE__);
89 window_title_ = window_title;
90 }
91 virtual ~EmuWindow() {}
92
93 std::string window_title_; ///< Current window title, should be used by window impl.
94
95 int client_area_width_; ///< Current client width, should be set by window impl.
96 int client_area_height_; ///< Current client height, should be set by window impl.
97
98private:
99 Config config_; ///< Internal configuration
100
101 input_common::KeyboardInput* controller_interface_;
102
103 DISALLOW_COPY_AND_ASSIGN(EmuWindow);
104};
105
106#endif // CORE_EMUWINDOW_H_