Mercurial > projects > mde
comparison mde/input/input.d @ 11:b940f267419e
Options class created & changes to mergetag exception messages.
Options class created (barebones). Loading/saving from Init.
Init no longer runs cleanup functions after initialisation failure.
Improved mergetag exception messages & error reporting.
committer: Diggory Hardy <diggory.hardy@gmail.com>
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Thu, 21 Feb 2008 09:05:33 +0000 |
parents | 4c3575400769 |
children | bff0d802cb7d |
comparison
equal
deleted
inserted
replaced
10:4c3575400769 | 11:b940f267419e |
---|---|
178 if (p) foreach (outQueue q; *p) { | 178 if (p) foreach (outQueue q; *p) { |
179 aEvent (this, event.jaxis.value, readOutQueue(q)); | 179 aEvent (this, event.jaxis.value, readOutQueue(q)); |
180 } | 180 } |
181 break; | 181 break; |
182 | 182 |
183 case SDL_JOYBALLMOTION: // NOTE: untested | 183 case SDL_JOYBALLMOTION: |
184 outQueue[]* p = (Config.M.JOYBALL | (event.jball.which << 12) | event.jball.ball) in config.relMotion; | 184 outQueue[]* p = (Config.M.JOYBALL | (event.jball.which << 12) | event.jball.ball) in config.relMotion; |
185 if (p) foreach (outQueue q; *p) { | 185 if (p) foreach (outQueue q; *p) { |
186 mEvent (this, event.jball.xrel, event.jball.yrel, readOutQueue(q)); | 186 mEvent (this, event.jball.xrel, event.jball.yrel, readOutQueue(q)); |
187 } | 187 } |
188 break; | 188 break; |
189 | 189 |
190 case SDL_JOYHATMOTION: // NOTE: untested | 190 case SDL_JOYHATMOTION: |
191 static ubyte[uint] oldJHatVals; // necessary to store this to know which "axis" changed | 191 static ubyte[uint] oldJHatVals; // necessary to store this to know which "axis" changed |
192 | 192 |
193 uint index = (event.jhat.which << 12) | event.jhat.hat; | 193 uint index = (event.jhat.which << 12) | event.jhat.hat; |
194 ubyte* oVal_p = index in oldJHatVals; | 194 ubyte* oVal_p = index in oldJHatVals; |
195 ubyte oldJHatVal = (oVal_p) ? *oVal_p : SDL_HAT_CENTERED; | 195 ubyte oldJHatVal = (oVal_p) ? *oVal_p : SDL_HAT_CENTERED; |
295 Config config; // Configuration | 295 Config config; // Configuration |
296 | 296 |
297 bool[inputID] button; // Table of button states | 297 bool[inputID] button; // Table of button states |
298 short[inputID] axis; // Table of axes states | 298 short[inputID] axis; // Table of axes states |
299 ushort mouse_x, mouse_y; // Current screen coords of the window manager mouse | 299 ushort mouse_x, mouse_y; // Current screen coords of the window manager mouse |
300 // FIXME: might need a bit of work... at any rate defining a default ID. | |
301 RelPair[inputID] relMotion; // Table of relative mouse / joystick ball motions | 300 RelPair[inputID] relMotion; // Table of relative mouse / joystick ball motions |
302 | 301 |
303 // FIXME: these need to be more like multimaps, supporting multiple dgs (also some means of removal?) | 302 // FIXME: currently no means of removal |
304 ButtonCallback[][inputID] buttonCallbacks; | 303 ButtonCallback[][inputID] buttonCallbacks; |
305 AxisCallback[][inputID] axisCallbacks; | 304 AxisCallback[][inputID] axisCallbacks; |
306 RelMotionCallback[][inputID] relMotionCallbacks; | 305 RelMotionCallback[][inputID] relMotionCallbacks; |
307 MouseClickCallback[] mouseClickCallbacks; | 306 MouseClickCallback[] mouseClickCallbacks; |
308 | 307 |