summaryrefslogtreecommitdiff
path: root/src/common/emu_window.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/emu_window.h')
-rw-r--r--src/common/emu_window.h102
1 files changed, 102 insertions, 0 deletions
diff --git a/src/common/emu_window.h b/src/common/emu_window.h
new file mode 100644
index 000000000..f49367057
--- /dev/null
+++ b/src/common/emu_window.h
@@ -0,0 +1,102 @@
1/**
2 * Copyright (C) 2005-2012 Gekko Emulator
3 *
4 * @file emu_window.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
30//namespace input_common
31//{
32//class KeyboardInput;
33//}
34
35// Abstraction class used to provide an interface between emulation code and the frontend (e.g. SDL,
36// QGLWidget, GLFW, etc...)
37class EmuWindow
38{
39
40public:
41 /// Data structure to store an emuwindow configuration
42 struct Config{
43 bool fullscreen;
44 int res_width;
45 int res_height;
46 };
47
48 /// Swap buffers to display the next frame
49 virtual void SwapBuffers() = 0;
50
51 /// Polls window events
52 virtual void PollEvents() = 0;
53
54 /// Makes the graphics context current for the caller thread
55 virtual void MakeCurrent() = 0;
56
57 /// Releases (dunno if this is the "right" word) the GLFW context from the caller thread
58 virtual void DoneCurrent() = 0;
59
60 /**
61 * @brief Called from KeyboardInput constructor to notify EmuWindow about its presence
62 * @param controller_interface Pointer to a running KeyboardInput interface
63 */
64 //void set_controller_interface(input_common::KeyboardInput* controller_interface) {
65 // controller_interface_ = controller_interface;
66 //}
67 //input_common::KeyboardInput* controller_interface() { return controller_interface_; }
68
69 Config config() { return config_; }
70 void set_config(Config val) { config_ = val; }
71
72 int client_area_width() { return client_area_width_; }
73 void set_client_area_width(int val) { client_area_width_ = val; }
74
75 int client_area_height() { return client_area_height_; }
76 void set_client_area_height(int val) { client_area_height_ = val; }
77
78 std::string window_title() { return window_title_; }
79 void set_window_title(std::string val) { window_title_ = val; }
80
81protected:
82 EmuWindow() : client_area_width_(640), client_area_height_(480) {
83 char window_title[255];
84 sprintf(window_title, "citra [%s|%s] - %s",
85 "null-cpu",
86 "null-renderer",
87 __DATE__);
88 window_title_ = window_title;
89 }
90 virtual ~EmuWindow() {}
91
92 std::string window_title_; ///< Current window title, should be used by window impl.
93
94 int client_area_width_; ///< Current client width, should be set by window impl.
95 int client_area_height_; ///< Current client height, should be set by window impl.
96
97private:
98 Config config_; ///< Internal configuration
99
100};
101
102#endif // CORE_EMUWINDOW_H_