26 */ |
26 */ |
27 |
27 |
28 #include "ascension/window.h" |
28 #include "ascension/window.h" |
29 #include "ascension/context.h" |
29 #include "ascension/context.h" |
30 #include "ascension/error.h" |
30 #include "ascension/error.h" |
|
31 #include "ascension/utils.h" |
31 |
32 |
32 #include <cx/linked_list.h> |
33 #include <cx/linked_list.h> |
33 #include <cx/printf.h> |
34 #include <cx/printf.h> |
34 |
35 |
35 #include <GL/glew.h> |
36 #include <GL/glew.h> |
64 bool asc_loop_next(void) { |
65 bool asc_loop_next(void) { |
65 // dispatch SDL events |
66 // dispatch SDL events |
66 SDL_Event event; |
67 SDL_Event event; |
67 while (SDL_PollEvent(&event)) { |
68 while (SDL_PollEvent(&event)) { |
68 switch (event.type) { |
69 switch (event.type) { |
69 case SDL_QUIT:return false; |
70 case SDL_QUIT: |
|
71 asc_set_flag(&asc_context.flags, ASC_FLAG_QUIT); |
|
72 break; |
70 case SDL_WINDOWEVENT: { |
73 case SDL_WINDOWEVENT: { |
71 if (event.window.type == SDL_WINDOWEVENT_RESIZED) |
74 if (event.window.type == SDL_WINDOWEVENT_RESIZED) |
72 asc_event_window_resized( |
75 asc_event_window_resized( |
73 event.window.windowID, |
76 event.window.windowID, |
74 event.window.data1, |
77 event.window.data1, |
91 for (unsigned int i = 0 ; i < ASC_MAX_WINDOWS ; i++) { |
94 for (unsigned int i = 0 ; i < ASC_MAX_WINDOWS ; i++) { |
92 if (asc_context.windows[i].id > 0) { |
95 if (asc_context.windows[i].id > 0) { |
93 asc_window_sync(&asc_context.windows[i]); |
96 asc_window_sync(&asc_context.windows[i]); |
94 } |
97 } |
95 } |
98 } |
96 return true; |
99 |
|
100 return !asc_test_flag(asc_context.flags, ASC_FLAG_QUIT); |
97 } |
101 } |
98 |
102 |
99 void asc_window_settings_init_defaults(AscWindowSettings* settings) { |
103 void asc_window_settings_init_defaults(AscWindowSettings* settings) { |
100 settings->depth_size = 24; |
104 settings->depth_size = 24; |
101 settings->vsync = 1; |
105 settings->vsync = 1; |