Mercurial > projects > mde
comparison mde/setup/Screen.d @ 95:2a364c7d82c9
Boolean options can be adjusted from the gui now (using a very basic widget). Also some bug-fixes.
Fixed a minor bug where layouts with the same id but without shared alignments would be messed up.
Tracked down the "nothing trawn until a resize" bug (see jobs.txt).
If widgets throw during creation they're now replaced by debug widgets.
Function pointers are converted to delegates using a safer method.
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Thu, 06 Nov 2008 11:07:18 +0000 |
parents | 9520cc0448e5 |
children | 30470bc19ca4 |
comparison
equal
deleted
inserted
replaced
94:9520cc0448e5 | 95:2a364c7d82c9 |
---|---|
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 if (SDL_Init (SDL_INIT_VIDEO | SDL_INIT_JOYSTICK /+| SDL_INIT_EVENTTHREAD+/)) { | 59 debug logger.trace ("Calling SDL_Init"); |
60 //FIXME: init SDL_INIT_TIMER? | |
61 if (SDL_Init (SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_TIMER /+| SDL_INIT_EVENTTHREAD+/)) { | |
60 logger.fatal ("SDL initialisation failed:"); | 62 logger.fatal ("SDL initialisation failed:"); |
61 char* msg = SDL_GetError (); | 63 char* msg = SDL_GetError (); |
62 logger.fatal (msg ? fromStringz(msg) : "no reason available"); | 64 logger.fatal (msg ? fromStringz(msg) : "no reason available"); |
63 | 65 |
64 throw new InitException ("SDL Initialization failed"); | 66 throw new InitException ("SDL Initialization failed"); |
65 } | 67 } |
66 return StageState.ACTIVE; | 68 return StageState.ACTIVE; |
67 } | 69 } |
68 /** SDL shutdown */ | 70 /** SDL shutdown */ |
69 StageState cleanup () { | 71 StageState cleanup () { |
72 debug logger.trace ("Calling SDL_Quit"); | |
70 SDL_Quit(); | 73 SDL_Quit(); |
71 return StageState.INACTIVE; | 74 return StageState.INACTIVE; |
72 } | 75 } |
73 /** Init function to set up a window with OpenGL support. */ | 76 /** Init function to set up a window with OpenGL support. */ |
74 StageState initWindow () { | 77 StageState initWindow () { |
143 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); | 146 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
144 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); | 147 glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
145 //NOTE: wrap mode may have an effect, but shouldn't be noticed... | 148 //NOTE: wrap mode may have an effect, but shouldn't be noticed... |
146 | 149 |
147 // Window-manager settings | 150 // Window-manager settings |
151 debug logger.trace ("Calling SDL_WM_SetCaption"); | |
148 SDL_WM_SetCaption (toStringz ("mde"), null); | 152 SDL_WM_SetCaption (toStringz ("mde"), null); |
149 // SDL_WM_GrabInput (use later) | 153 // SDL_WM_GrabInput (use later) |
150 //END Create window and initialize OpenGL | 154 //END Create window and initialize OpenGL |
151 return StageState.ACTIVE; | 155 return StageState.ACTIVE; |
152 } | 156 } |
211 logger.error ("Drawable failed while setting size: "~e.msg); | 215 logger.error ("Drawable failed while setting size: "~e.msg); |
212 } | 216 } |
213 } | 217 } |
214 | 218 |
215 //debug logger.trace ("Setting video mode {}x{}, 32-bit, flags: {}", w,h,flags); | 219 //debug logger.trace ("Setting video mode {}x{}, 32-bit, flags: {}", w,h,flags); |
220 debug logger.trace ("Calling SDL_SetVideoMode"); | |
216 if (SDL_SetVideoMode (w, h, 32, flags) is null) { | 221 if (SDL_SetVideoMode (w, h, 32, flags) is null) { |
217 logger.fatal ("Unable to set video mode:"); | 222 logger.fatal ("Unable to set video mode:"); |
218 char* msg = SDL_GetError (); | 223 char* msg = SDL_GetError (); |
219 logger.fatal (msg ? fromStringz(msg) : "no reason available"); | 224 logger.fatal (msg ? fromStringz(msg) : "no reason available"); |
220 | 225 |