src/window.c

changeset 12
d89e0ebc76d2
parent 9
6ad1a4213954
child 13
f04a49b2aeee
equal deleted inserted replaced
11:d83af80eb09b 12:d89e0ebc76d2
55 static void asc_event_window_resized(Uint32 id, Sint32 width, Sint32 height) { 55 static void asc_event_window_resized(Uint32 id, Sint32 width, Sint32 height) {
56 for (unsigned int i = 0 ; i < ASC_MAX_WINDOWS ; i++) { 56 for (unsigned int i = 0 ; i < ASC_MAX_WINDOWS ; i++) {
57 if (asc_context.windows[i].id == id) { 57 if (asc_context.windows[i].id == id) {
58 asc_context.windows[i].dimensions.width = width; 58 asc_context.windows[i].dimensions.width = width;
59 asc_context.windows[i].dimensions.height = height; 59 asc_context.windows[i].dimensions.height = height;
60 asc_mat4f_ortho(asc_context.windows[i].projection, 0, (float) width, (float) height, 0);
60 return; 61 return;
61 } 62 }
62 } 63 }
63 } 64 }
64 65
141 142
142 window->id = SDL_GetWindowID(window->window); 143 window->id = SDL_GetWindowID(window->window);
143 SDL_GetWindowSize(window->window, 144 SDL_GetWindowSize(window->window,
144 &window->dimensions.width, 145 &window->dimensions.width,
145 &window->dimensions.height 146 &window->dimensions.height
147 );
148 asc_mat4f_ortho(
149 window->projection,
150 0,
151 (float) window->dimensions.width,
152 (float) window->dimensions.height,
153 0
146 ); 154 );
147 155
148 SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE); 156 SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
149 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, settings->gl_major_version); 157 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, settings->gl_major_version);
150 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, settings->gl_minor_version); 158 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, settings->gl_minor_version);

mercurial