Mercurial > projects > mde
comparison mde/input/Input.d @ 124:a2ef6b549101
Dynamic minimal size changing is now fully supported.
Support for reducing minimal size in layouts.
Editing numbers as text now always converts new number back to string at end of edit.
Floating point number display format changed.
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Mon, 05 Jan 2009 12:43:27 +0000 |
parents | 20f7d813bb0f |
children | 264028f4115a |
comparison
equal
deleted
inserted
replaced
123:d3b2cefd46c9 | 124:a2ef6b549101 |
---|---|
215 * May throw InputClassExceptions (on configuration errors). Catching the exception and continuing should | 215 * May throw InputClassExceptions (on configuration errors). Catching the exception and continuing should |
216 * be fine. */ | 216 * be fine. */ |
217 bool opCall (ref SDL_Event event) { | 217 bool opCall (ref SDL_Event event) { |
218 /* Non-config events. | 218 /* Non-config events. |
219 * | 219 * |
220 * Mouse events don't need config for the GUI. Handle them first so that if no config exists | 220 * Handle these first so that if no config exists some functionality at least is retained. |
221 * some functionality at least is retained. | |
222 * | 221 * |
223 * Coordinates don't need adjusting (they put the top-left most pixel at 0,0). | 222 * Coordinates don't need adjusting (they put the top-left most pixel at 0,0). |
224 */ | 223 */ |
225 switch (event.type) { | 224 switch (event.type) { |
225 case SDL_KEYDOWN: | |
226 if (letterCallback) { | |
227 try | |
228 letterCallback (event.key.keysym.sym, Utf.toString ([cast(wchar)event.key.keysym.unicode], cast(char[])utfBuf)); | |
229 catch (Exception e) | |
230 logger.error (CB_EXC ~ e.msg); | |
231 } | |
232 break; | |
233 | |
226 case SDL_MOUSEBUTTONDOWN: | 234 case SDL_MOUSEBUTTONDOWN: |
227 case SDL_MOUSEBUTTONUP: | 235 case SDL_MOUSEBUTTONUP: |
228 foreach (dg; mouseClickCallbacks) { | 236 foreach (dg; mouseClickCallbacks) { |
229 try | 237 try |
230 dg (event.button.x, event.button.y, | 238 dg (event.button.x, event.button.y, |
252 if (!config) return false; | 260 if (!config) return false; |
253 | 261 |
254 switch (event.type) { | 262 switch (event.type) { |
255 // Keyboard events: | 263 // Keyboard events: |
256 case SDL_KEYDOWN: | 264 case SDL_KEYDOWN: |
257 if (letterCallback) | |
258 letterCallback (event.key.keysym.sym, Utf.toString ([cast(wchar)event.key.keysym.unicode], cast(char[])utfBuf)); | |
259 case SDL_KEYUP: | 265 case SDL_KEYUP: |
260 if (letterCallback) break; // text input mode; no keyboard input from mappings | 266 if (letterCallback) break; // text input mode; no keyboard input from mappings |
261 outQueue[]* p = (Config.B.SDLKEY | event.key.keysym.sym) in config.button; | 267 outQueue[]* p = (Config.B.SDLKEY | event.key.keysym.sym) in config.button; |
262 if (p) foreach (outQueue q; *p) { | 268 if (p) foreach (outQueue q; *p) { |
263 bEvent (this, event.key.state == SDL_PRESSED, readOutQueue(q)); | 269 bEvent (this, event.key.state == SDL_PRESSED, readOutQueue(q)); |