1 | /** |
2 | * Copyright (c) 2006-2023 LOVE Development Team |
3 | * |
4 | * This software is provided 'as-is', without any express or implied |
5 | * warranty. In no event will the authors be held liable for any damages |
6 | * arising from the use of this software. |
7 | * |
8 | * Permission is granted to anyone to use this software for any purpose, |
9 | * including commercial applications, and to alter it and redistribute it |
10 | * freely, subject to the following restrictions: |
11 | * |
12 | * 1. The origin of this software must not be misrepresented; you must not |
13 | * claim that you wrote the original software. If you use this software |
14 | * in a product, an acknowledgment in the product documentation would be |
15 | * appreciated but is not required. |
16 | * 2. Altered source versions must be plainly marked as such, and must not be |
17 | * misrepresented as being the original software. |
18 | * 3. This notice may not be removed or altered from any source distribution. |
19 | **/ |
20 | |
21 | // LOVE |
22 | #include "Window.h" |
23 | |
24 | namespace love |
25 | { |
26 | namespace window |
27 | { |
28 | |
29 | Window::~Window() |
30 | { |
31 | } |
32 | |
33 | void Window::swapBuffers() |
34 | { |
35 | } |
36 | |
37 | bool Window::getConstant(const char *in, FullscreenType &out) |
38 | { |
39 | return fullscreenTypes.find(in, out); |
40 | } |
41 | |
42 | bool Window::getConstant(FullscreenType in, const char *&out) |
43 | { |
44 | return fullscreenTypes.find(in, out); |
45 | } |
46 | |
47 | std::vector<std::string> Window::getConstants(FullscreenType) |
48 | { |
49 | return fullscreenTypes.getNames(); |
50 | } |
51 | |
52 | bool Window::getConstant(const char *in, Setting &out) |
53 | { |
54 | return settings.find(in, out); |
55 | } |
56 | |
57 | bool Window::getConstant(Setting in, const char *&out) |
58 | { |
59 | return settings.find(in, out); |
60 | } |
61 | |
62 | bool Window::getConstant(const char *in, MessageBoxType &out) |
63 | { |
64 | return messageBoxTypes.find(in, out); |
65 | } |
66 | |
67 | bool Window::getConstant(MessageBoxType in, const char *&out) |
68 | { |
69 | return messageBoxTypes.find(in, out); |
70 | } |
71 | |
72 | std::vector<std::string> Window::getConstants(MessageBoxType) |
73 | { |
74 | return messageBoxTypes.getNames(); |
75 | } |
76 | |
77 | bool Window::getConstant(const char *in, DisplayOrientation &out) |
78 | { |
79 | return orientations.find(in, out); |
80 | } |
81 | |
82 | bool Window::getConstant(DisplayOrientation in, const char *&out) |
83 | { |
84 | return orientations.find(in, out); |
85 | } |
86 | |
87 | std::vector<std::string> Window::getConstants(DisplayOrientation) |
88 | { |
89 | return orientations.getNames(); |
90 | } |
91 | |
92 | StringMap<Window::Setting, Window::SETTING_MAX_ENUM>::Entry Window::settingEntries[] = |
93 | { |
94 | {"fullscreen" , SETTING_FULLSCREEN}, |
95 | {"fullscreentype" , SETTING_FULLSCREEN_TYPE}, |
96 | {"vsync" , SETTING_VSYNC}, |
97 | {"msaa" , SETTING_MSAA}, |
98 | {"stencil" , SETTING_STENCIL}, |
99 | {"depth" , SETTING_DEPTH}, |
100 | {"resizable" , SETTING_RESIZABLE}, |
101 | {"minwidth" , SETTING_MIN_WIDTH}, |
102 | {"minheight" , SETTING_MIN_HEIGHT}, |
103 | {"borderless" , SETTING_BORDERLESS}, |
104 | {"centered" , SETTING_CENTERED}, |
105 | {"display" , SETTING_DISPLAY}, |
106 | {"highdpi" , SETTING_HIGHDPI}, |
107 | {"usedpiscale" , SETTING_USE_DPISCALE}, |
108 | {"refreshrate" , SETTING_REFRESHRATE}, |
109 | {"x" , SETTING_X}, |
110 | {"y" , SETTING_Y}, |
111 | }; |
112 | |
113 | StringMap<Window::Setting, Window::SETTING_MAX_ENUM> Window::settings(Window::settingEntries, sizeof(Window::settingEntries)); |
114 | |
115 | StringMap<Window::FullscreenType, Window::FULLSCREEN_MAX_ENUM>::Entry Window::fullscreenTypeEntries[] = |
116 | { |
117 | {"exclusive" , FULLSCREEN_EXCLUSIVE}, |
118 | {"desktop" , FULLSCREEN_DESKTOP}, |
119 | }; |
120 | |
121 | StringMap<Window::FullscreenType, Window::FULLSCREEN_MAX_ENUM> Window::fullscreenTypes(Window::fullscreenTypeEntries, sizeof(Window::fullscreenTypeEntries)); |
122 | |
123 | StringMap<Window::MessageBoxType, Window::MESSAGEBOX_MAX_ENUM>::Entry Window::messageBoxTypeEntries[] = |
124 | { |
125 | {"error" , MESSAGEBOX_ERROR}, |
126 | {"warning" , MESSAGEBOX_WARNING}, |
127 | {"info" , MESSAGEBOX_INFO}, |
128 | }; |
129 | |
130 | StringMap<Window::MessageBoxType, Window::MESSAGEBOX_MAX_ENUM> Window::messageBoxTypes(Window::messageBoxTypeEntries, sizeof(Window::messageBoxTypeEntries)); |
131 | |
132 | StringMap<Window::DisplayOrientation, Window::ORIENTATION_MAX_ENUM>::Entry Window::orientationEntries[] = |
133 | { |
134 | {"unknown" , ORIENTATION_UNKNOWN}, |
135 | {"landscape" , ORIENTATION_LANDSCAPE}, |
136 | {"landscapeflipped" , ORIENTATION_LANDSCAPE_FLIPPED}, |
137 | {"portrait" , ORIENTATION_PORTRAIT}, |
138 | {"portraitflipped" , ORIENTATION_PORTRAIT_FLIPPED}, |
139 | }; |
140 | |
141 | StringMap<Window::DisplayOrientation, Window::ORIENTATION_MAX_ENUM> Window::orientations(Window::orientationEntries, sizeof(Window::orientationEntries)); |
142 | |
143 | } // window |
144 | } // love |
145 | |