Mercurial > hg > orthanc-stone
annotate Applications/Sdl/SdlEngine.cpp @ 1324:4d8d642f7036 broker
Added a NullLayer scene layer type that allows
"booking" a scene depth entry.
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Tue, 24 Mar 2020 16:24:26 +0100 |
parents | 7ec8fea061b9 |
children |
rev | line source |
---|---|
0 | 1 /** |
2 * Stone of Orthanc | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
1270
2d8ab34c8c91
upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1199
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
0 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
47 | 8 * modify it under the terms of the GNU Affero General Public License |
9 * as published by the Free Software Foundation, either version 3 of | |
10 * the License, or (at your option) any later version. | |
0 | 11 * |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
47 | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 * Affero General Public License for more details. | |
327 | 16 * |
47 | 17 * You should have received a copy of the GNU Affero General Public License |
0 | 18 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 **/ | |
20 | |
21 | |
22 #include "SdlEngine.h" | |
23 | |
24 #if ORTHANC_ENABLE_SDL == 1 | |
25 | |
212
5412adf19980
resort to OrthancFramework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
201
diff
changeset
|
26 #include <Core/Logging.h> |
201
e9c7a78a3e77
removed absolute paths
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
196
diff
changeset
|
27 |
0 | 28 #include <SDL.h> |
29 | |
30 namespace OrthancStone | |
31 { | |
271
46c5296d867e
OracleWebService and BasicSdlApplicationContext using the same global mutex
am@osimis.io
parents:
222
diff
changeset
|
32 void SdlEngine::SetSize(unsigned int width, |
56
9e3c2e75b870
extremely simplified SDL engine
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
53
diff
changeset
|
33 unsigned int height) |
9e3c2e75b870
extremely simplified SDL engine
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
53
diff
changeset
|
34 { |
385
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
35 NativeStoneApplicationContext::GlobalMutexLocker locker(context_); |
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
36 locker.GetCentralViewport().SetSize(width, height); |
56
9e3c2e75b870
extremely simplified SDL engine
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
53
diff
changeset
|
37 surface_.SetSize(width, height); |
9e3c2e75b870
extremely simplified SDL engine
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
53
diff
changeset
|
38 } |
327 | 39 |
56
9e3c2e75b870
extremely simplified SDL engine
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
53
diff
changeset
|
40 |
0 | 41 void SdlEngine::RenderFrame() |
42 { | |
56
9e3c2e75b870
extremely simplified SDL engine
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
53
diff
changeset
|
43 if (viewportChanged_) |
0 | 44 { |
293 | 45 NativeStoneApplicationContext::GlobalMutexLocker locker(context_); |
385
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
46 surface_.Render(locker.GetCentralViewport()); |
53
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
51
diff
changeset
|
47 |
56
9e3c2e75b870
extremely simplified SDL engine
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
53
diff
changeset
|
48 viewportChanged_ = false; |
0 | 49 } |
50 } | |
51 | |
52 | |
53 KeyboardModifiers SdlEngine::GetKeyboardModifiers(const uint8_t* keyboardState, | |
54 const int scancodeCount) | |
55 { | |
56 int result = KeyboardModifiers_None; | |
57 | |
58 if (keyboardState != NULL) | |
59 { | |
60 if (SDL_SCANCODE_LSHIFT < scancodeCount && | |
61 keyboardState[SDL_SCANCODE_LSHIFT]) | |
62 { | |
63 result |= KeyboardModifiers_Shift; | |
64 } | |
65 | |
66 if (SDL_SCANCODE_RSHIFT < scancodeCount && | |
67 keyboardState[SDL_SCANCODE_RSHIFT]) | |
68 { | |
69 result |= KeyboardModifiers_Shift; | |
70 } | |
71 | |
72 if (SDL_SCANCODE_LCTRL < scancodeCount && | |
73 keyboardState[SDL_SCANCODE_LCTRL]) | |
74 { | |
75 result |= KeyboardModifiers_Control; | |
76 } | |
77 | |
78 if (SDL_SCANCODE_RCTRL < scancodeCount && | |
79 keyboardState[SDL_SCANCODE_RCTRL]) | |
80 { | |
81 result |= KeyboardModifiers_Control; | |
82 } | |
83 | |
84 if (SDL_SCANCODE_LALT < scancodeCount && | |
85 keyboardState[SDL_SCANCODE_LALT]) | |
86 { | |
87 result |= KeyboardModifiers_Alt; | |
88 } | |
89 | |
90 if (SDL_SCANCODE_RALT < scancodeCount && | |
91 keyboardState[SDL_SCANCODE_RALT]) | |
92 { | |
93 result |= KeyboardModifiers_Alt; | |
94 } | |
95 } | |
96 | |
97 return static_cast<KeyboardModifiers>(result); | |
98 } | |
99 | |
100 | |
101 SdlEngine::SdlEngine(SdlWindow& window, | |
1066
b537002f83a9
removing broker from deprecated classes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
726
diff
changeset
|
102 NativeStoneApplicationContext& context) : |
0 | 103 window_(window), |
53
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
51
diff
changeset
|
104 context_(context), |
56
9e3c2e75b870
extremely simplified SDL engine
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
53
diff
changeset
|
105 surface_(window), |
9e3c2e75b870
extremely simplified SDL engine
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
53
diff
changeset
|
106 viewportChanged_(true) |
0 | 107 { |
108 } | |
109 | |
110 | |
111 void SdlEngine::Run() | |
112 { | |
113 int scancodeCount = 0; | |
114 const uint8_t* keyboardState = SDL_GetKeyboardState(&scancodeCount); | |
115 | |
385
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
116 SetSize(window_.GetWidth(), window_.GetHeight()); |
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
117 |
61
ca644004d2ee
MAJOR - removal of Start/Stop and observers in IWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
56
diff
changeset
|
118 { |
293 | 119 NativeStoneApplicationContext::GlobalMutexLocker locker(context_); |
385
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
120 locker.GetCentralViewport().FitContent(); |
61
ca644004d2ee
MAJOR - removal of Start/Stop and observers in IWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
56
diff
changeset
|
121 } |
ca644004d2ee
MAJOR - removal of Start/Stop and observers in IWidget
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
56
diff
changeset
|
122 |
0 | 123 bool stop = false; |
124 while (!stop) | |
125 { | |
56
9e3c2e75b870
extremely simplified SDL engine
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
53
diff
changeset
|
126 RenderFrame(); |
0 | 127 |
128 SDL_Event event; | |
129 | |
56
9e3c2e75b870
extremely simplified SDL engine
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
53
diff
changeset
|
130 while (!stop && |
9e3c2e75b870
extremely simplified SDL engine
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
53
diff
changeset
|
131 SDL_PollEvent(&event)) |
0 | 132 { |
293 | 133 NativeStoneApplicationContext::GlobalMutexLocker locker(context_); |
53
c2dc924f1a63
removing threading out of the framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
51
diff
changeset
|
134 |
327 | 135 if (event.type == SDL_QUIT) |
0 | 136 { |
137 stop = true; | |
138 break; | |
139 } | |
140 else if (event.type == SDL_MOUSEBUTTONDOWN) | |
141 { | |
142 KeyboardModifiers modifiers = GetKeyboardModifiers(keyboardState, scancodeCount); | |
143 | |
144 switch (event.button.button) | |
145 { | |
327 | 146 case SDL_BUTTON_LEFT: |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
467
diff
changeset
|
147 locker.GetCentralViewport().MouseDown(MouseButton_Left, event.button.x, event.button.y, modifiers, std::vector<Deprecated::Touch>()); |
327 | 148 break; |
0 | 149 |
327 | 150 case SDL_BUTTON_RIGHT: |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
467
diff
changeset
|
151 locker.GetCentralViewport().MouseDown(MouseButton_Right, event.button.x, event.button.y, modifiers, std::vector<Deprecated::Touch>()); |
327 | 152 break; |
0 | 153 |
327 | 154 case SDL_BUTTON_MIDDLE: |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
467
diff
changeset
|
155 locker.GetCentralViewport().MouseDown(MouseButton_Middle, event.button.x, event.button.y, modifiers, std::vector<Deprecated::Touch>()); |
327 | 156 break; |
0 | 157 |
327 | 158 default: |
159 break; | |
0 | 160 } |
161 } | |
162 else if (event.type == SDL_MOUSEMOTION) | |
163 { | |
726
4f2416d519b4
moving layers, widgets and loaders to Deprecated namespace
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
467
diff
changeset
|
164 locker.GetCentralViewport().MouseMove(event.button.x, event.button.y, std::vector<Deprecated::Touch>()); |
0 | 165 } |
166 else if (event.type == SDL_MOUSEBUTTONUP) | |
167 { | |
385
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
168 locker.GetCentralViewport().MouseUp(); |
0 | 169 } |
170 else if (event.type == SDL_WINDOWEVENT) | |
171 { | |
172 switch (event.window.event) | |
173 { | |
327 | 174 case SDL_WINDOWEVENT_LEAVE: |
385
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
175 locker.GetCentralViewport().MouseLeave(); |
327 | 176 break; |
0 | 177 |
327 | 178 case SDL_WINDOWEVENT_ENTER: |
385
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
179 locker.GetCentralViewport().MouseEnter(); |
327 | 180 break; |
0 | 181 |
327 | 182 case SDL_WINDOWEVENT_SIZE_CHANGED: |
183 SetSize(event.window.data1, event.window.data2); | |
184 break; | |
0 | 185 |
327 | 186 default: |
187 break; | |
0 | 188 } |
189 } | |
190 else if (event.type == SDL_MOUSEWHEEL) | |
191 { | |
192 KeyboardModifiers modifiers = GetKeyboardModifiers(keyboardState, scancodeCount); | |
193 | |
194 int x, y; | |
195 SDL_GetMouseState(&x, &y); | |
196 | |
197 if (event.wheel.y > 0) | |
198 { | |
385
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
199 locker.GetCentralViewport().MouseWheel(MouseWheelDirection_Up, x, y, modifiers); |
0 | 200 } |
201 else if (event.wheel.y < 0) | |
202 { | |
385
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
203 locker.GetCentralViewport().MouseWheel(MouseWheelDirection_Down, x, y, modifiers); |
0 | 204 } |
205 } | |
56
9e3c2e75b870
extremely simplified SDL engine
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
53
diff
changeset
|
206 else if (event.type == SDL_KEYDOWN && |
9e3c2e75b870
extremely simplified SDL engine
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
53
diff
changeset
|
207 event.key.repeat == 0 /* Ignore key bounce */) |
0 | 208 { |
209 KeyboardModifiers modifiers = GetKeyboardModifiers(keyboardState, scancodeCount); | |
210 | |
211 switch (event.key.keysym.sym) | |
212 { | |
385
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
213 case SDLK_a: locker.GetCentralViewport().KeyPressed(KeyboardKeys_Generic, 'a', modifiers); break; |
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
214 case SDLK_b: locker.GetCentralViewport().KeyPressed(KeyboardKeys_Generic, 'b', modifiers); break; |
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
215 case SDLK_c: locker.GetCentralViewport().KeyPressed(KeyboardKeys_Generic, 'c', modifiers); break; |
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
216 case SDLK_d: locker.GetCentralViewport().KeyPressed(KeyboardKeys_Generic, 'd', modifiers); break; |
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
217 case SDLK_e: locker.GetCentralViewport().KeyPressed(KeyboardKeys_Generic, 'e', modifiers); break; |
327 | 218 case SDLK_f: window_.ToggleMaximize(); break; |
385
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
219 case SDLK_g: locker.GetCentralViewport().KeyPressed(KeyboardKeys_Generic, 'g', modifiers); break; |
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
220 case SDLK_h: locker.GetCentralViewport().KeyPressed(KeyboardKeys_Generic, 'h', modifiers); break; |
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
221 case SDLK_i: locker.GetCentralViewport().KeyPressed(KeyboardKeys_Generic, 'i', modifiers); break; |
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
222 case SDLK_j: locker.GetCentralViewport().KeyPressed(KeyboardKeys_Generic, 'j', modifiers); break; |
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
223 case SDLK_k: locker.GetCentralViewport().KeyPressed(KeyboardKeys_Generic, 'k', modifiers); break; |
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
224 case SDLK_l: locker.GetCentralViewport().KeyPressed(KeyboardKeys_Generic, 'l', modifiers); break; |
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
225 case SDLK_m: locker.GetCentralViewport().KeyPressed(KeyboardKeys_Generic, 'm', modifiers); break; |
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
226 case SDLK_n: locker.GetCentralViewport().KeyPressed(KeyboardKeys_Generic, 'n', modifiers); break; |
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
227 case SDLK_o: locker.GetCentralViewport().KeyPressed(KeyboardKeys_Generic, 'o', modifiers); break; |
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
228 case SDLK_p: locker.GetCentralViewport().KeyPressed(KeyboardKeys_Generic, 'p', modifiers); break; |
327 | 229 case SDLK_q: stop = true; break; |
385
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
230 case SDLK_r: locker.GetCentralViewport().KeyPressed(KeyboardKeys_Generic, 'r', modifiers); break; |
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
231 case SDLK_s: locker.GetCentralViewport().KeyPressed(KeyboardKeys_Generic, 's', modifiers); break; |
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
232 case SDLK_t: locker.GetCentralViewport().KeyPressed(KeyboardKeys_Generic, 't', modifiers); break; |
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
233 case SDLK_u: locker.GetCentralViewport().KeyPressed(KeyboardKeys_Generic, 'u', modifiers); break; |
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
234 case SDLK_v: locker.GetCentralViewport().KeyPressed(KeyboardKeys_Generic, 'v', modifiers); break; |
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
235 case SDLK_w: locker.GetCentralViewport().KeyPressed(KeyboardKeys_Generic, 'w', modifiers); break; |
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
236 case SDLK_x: locker.GetCentralViewport().KeyPressed(KeyboardKeys_Generic, 'x', modifiers); break; |
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
237 case SDLK_y: locker.GetCentralViewport().KeyPressed(KeyboardKeys_Generic, 'y', modifiers); break; |
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
238 case SDLK_z: locker.GetCentralViewport().KeyPressed(KeyboardKeys_Generic, 'z', modifiers); break; |
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
239 case SDLK_KP_0: locker.GetCentralViewport().KeyPressed(KeyboardKeys_Generic, '0', modifiers); break; |
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
240 case SDLK_KP_1: locker.GetCentralViewport().KeyPressed(KeyboardKeys_Generic, '1', modifiers); break; |
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
241 case SDLK_KP_2: locker.GetCentralViewport().KeyPressed(KeyboardKeys_Generic, '2', modifiers); break; |
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
242 case SDLK_KP_3: locker.GetCentralViewport().KeyPressed(KeyboardKeys_Generic, '3', modifiers); break; |
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
243 case SDLK_KP_4: locker.GetCentralViewport().KeyPressed(KeyboardKeys_Generic, '4', modifiers); break; |
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
244 case SDLK_KP_5: locker.GetCentralViewport().KeyPressed(KeyboardKeys_Generic, '5', modifiers); break; |
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
245 case SDLK_KP_6: locker.GetCentralViewport().KeyPressed(KeyboardKeys_Generic, '6', modifiers); break; |
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
246 case SDLK_KP_7: locker.GetCentralViewport().KeyPressed(KeyboardKeys_Generic, '7', modifiers); break; |
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
247 case SDLK_KP_8: locker.GetCentralViewport().KeyPressed(KeyboardKeys_Generic, '8', modifiers); break; |
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
248 case SDLK_KP_9: locker.GetCentralViewport().KeyPressed(KeyboardKeys_Generic, '9', modifiers); break; |
0 | 249 |
327 | 250 case SDLK_PLUS: |
251 case SDLK_KP_PLUS: | |
385
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
252 locker.GetCentralViewport().KeyPressed(KeyboardKeys_Generic, '+', modifiers); break; |
327 | 253 |
254 case SDLK_MINUS: | |
255 case SDLK_KP_MINUS: | |
385
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
256 locker.GetCentralViewport().KeyPressed(KeyboardKeys_Generic, '-', modifiers); break; |
170
0261909fa6f0
add support for plus/minus in SDL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
167
diff
changeset
|
257 |
1199
922d2e61aa5d
RadiograpyScene: can now remove any layer + new key wrappers for Delete/Backspace
Alain Mazy <alain@mazy.be>
parents:
726
diff
changeset
|
258 case SDLK_DELETE: |
922d2e61aa5d
RadiograpyScene: can now remove any layer + new key wrappers for Delete/Backspace
Alain Mazy <alain@mazy.be>
parents:
726
diff
changeset
|
259 locker.GetCentralViewport().KeyPressed(KeyboardKeys_Delete, 0, modifiers); break; |
922d2e61aa5d
RadiograpyScene: can now remove any layer + new key wrappers for Delete/Backspace
Alain Mazy <alain@mazy.be>
parents:
726
diff
changeset
|
260 case SDLK_BACKSPACE: |
922d2e61aa5d
RadiograpyScene: can now remove any layer + new key wrappers for Delete/Backspace
Alain Mazy <alain@mazy.be>
parents:
726
diff
changeset
|
261 locker.GetCentralViewport().KeyPressed(KeyboardKeys_Backspace, 0, modifiers); break; |
327 | 262 case SDLK_RIGHT: |
385
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
263 locker.GetCentralViewport().KeyPressed(KeyboardKeys_Right, 0, modifiers); break; |
327 | 264 case SDLK_LEFT: |
385
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
265 locker.GetCentralViewport().KeyPressed(KeyboardKeys_Left, 0, modifiers); break; |
327 | 266 case SDLK_UP: |
385
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
267 locker.GetCentralViewport().KeyPressed(KeyboardKeys_Up, 0, modifiers); break; |
327 | 268 case SDLK_DOWN: |
385
6cc3ce74dc05
using message broker in widgets
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
330
diff
changeset
|
269 locker.GetCentralViewport().KeyPressed(KeyboardKeys_Down, 0, modifiers); break; |
327 | 270 default: |
271 break; | |
0 | 272 } |
273 } | |
274 } | |
275 | |
98
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
63
diff
changeset
|
276 // Small delay to avoid using 100% of CPU |
a33abae66344
scrolling over series
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
63
diff
changeset
|
277 SDL_Delay(1); |
0 | 278 } |
279 } | |
280 } | |
281 | |
282 #endif |