Mercurial > projects > mde
comparison mde/setup/Screen.d @ 116:5ee69b3ed9c9
Partial implementation of infinite widget recursion protection; some cleanup.
Implemented recursion protection which only allowed unsafe widgets to be instantiated once; realised this was far too restrictive (multiple sibling instances are needed) and a check against parent widgets would be needed. Could be implemented by passing widgets a reference to parents.
Removed ButtonWidget aka First interactible widget.
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Sun, 21 Dec 2008 12:03:50 +0000 |
parents | ee209602770d |
children | 9f035cd139c6 |
comparison
equal
deleted
inserted
replaced
115:1b1e2297e2fc | 116:5ee69b3ed9c9 |
---|---|
54 | 54 |
55 static: | 55 static: |
56 /** Init function to initialize SDL. */ | 56 /** Init function to initialize SDL. */ |
57 StageState init () { // init func | 57 StageState init () { // init func |
58 // Initialise SDL | 58 // Initialise SDL |
59 debug logger.trace ("Calling SDL_Init (SDL_INIT_VIDEO | SDL_INIT_JOYSTICK)"); | 59 debug (SDLCalls) logger.trace ("Calling SDL_Init (SDL_INIT_VIDEO | SDL_INIT_JOYSTICK)"); |
60 if (SDL_Init (SDL_INIT_VIDEO | SDL_INIT_JOYSTICK /+| SDL_INIT_EVENTTHREAD+/)) { | 60 if (SDL_Init (SDL_INIT_VIDEO | SDL_INIT_JOYSTICK /+| SDL_INIT_EVENTTHREAD+/)) { |
61 logger.fatal ("SDL initialisation failed:"); | 61 logger.fatal ("SDL initialisation failed:"); |
62 char* msg = SDL_GetError (); | 62 char* msg = SDL_GetError (); |
63 logger.fatal (msg ? fromStringz(msg) : "no reason available"); | 63 logger.fatal (msg ? fromStringz(msg) : "no reason available"); |
64 | 64 |
66 } | 66 } |
67 return StageState.ACTIVE; | 67 return StageState.ACTIVE; |
68 } | 68 } |
69 /** SDL shutdown */ | 69 /** SDL shutdown */ |
70 StageState cleanup () { | 70 StageState cleanup () { |
71 debug logger.trace ("Calling SDL_Quit ()"); | 71 debug (SDLCalls) logger.trace ("Calling SDL_Quit ()"); |
72 SDL_Quit(); | 72 SDL_Quit(); |
73 return StageState.INACTIVE; | 73 return StageState.INACTIVE; |
74 } | 74 } |
75 /** Init function to set up a window with OpenGL support. */ | 75 /** Init function to set up a window with OpenGL support. */ |
76 StageState initWindow () { | 76 StageState initWindow () { |
212 logger.error ("Drawable failed while setting size: "~e.msg); | 212 logger.error ("Drawable failed while setting size: "~e.msg); |
213 } | 213 } |
214 } | 214 } |
215 | 215 |
216 //debug logger.trace ("Setting video mode {}x{}, 32-bit, flags: {}", w,h,flags); | 216 //debug logger.trace ("Setting video mode {}x{}, 32-bit, flags: {}", w,h,flags); |
217 debug logger.trace ("Calling SDL_SetVideoMode ({}, {}, 32, 0x{:x})", w,h, flags); | 217 debug (SDLCalls) logger.trace ("Calling SDL_SetVideoMode ({}, {}, 32, 0x{:x})", w,h, flags); |
218 if (SDL_SetVideoMode (w, h, 32, flags) is null) { | 218 if (SDL_SetVideoMode (w, h, 32, flags) is null) { |
219 logger.fatal ("Unable to set video mode:"); | 219 logger.fatal ("Unable to set video mode:"); |
220 char* msg = SDL_GetError (); | 220 char* msg = SDL_GetError (); |
221 logger.fatal (msg ? fromStringz(msg) : "no reason available"); | 221 logger.fatal (msg ? fromStringz(msg) : "no reason available"); |
222 | 222 |