src/window.c

changeset 231
0da563c4e39c
parent 220
6b266e907f89
equal deleted inserted replaced
230:02090b2d147e 231:0da563c4e39c
27 27
28 #include "ascension/error.h" 28 #include "ascension/error.h"
29 #include "ascension/window.h" 29 #include "ascension/window.h"
30 #include "ascension/context.h" 30 #include "ascension/context.h"
31 31
32 #include <assert.h>
32 #include <GL/glew.h> 33 #include <GL/glew.h>
33 34
34 void asc_window_settings_init_defaults(AscWindowSettings *settings) { 35 void asc_window_settings_init_defaults(AscWindowSettings *settings) {
35 settings->dimensions.width = 800u; 36 settings->dimensions.width = 800u;
36 settings->dimensions.height = 600u; 37 settings->dimensions.height = 600u;
208 asc_error("Failed to get display mode for window %u on display %d: %s", 209 asc_error("Failed to get display mode for window %u on display %d: %s",
209 window->id, display, SDL_GetError()); 210 window->id, display, SDL_GetError());
210 } 211 }
211 return ASC_VEC2U(dm.w, dm.h); 212 return ASC_VEC2U(dm.w, dm.h);
212 } 213 }
214
215 float asc_window_ui_scale(unsigned int index) {
216 assert(asc_context.windows[index].window != NULL);
217 return asc_context.windows[index].ui_scale;
218 }
219
220 void asc_window_set_title(unsigned index, const char *title) {
221 assert(asc_context.windows[index].window != NULL);
222 SDL_SetWindowTitle(asc_context.windows[index].window, title);
223 }
224
225 void asc_window_set_size(unsigned index, asc_vec2u size) {
226 assert(asc_context.windows[index].window != NULL);
227 asc_context.windows[index].dimensions = size;
228 SDL_SetWindowSize(asc_context.windows[index].window, (int)size.width, (int)size.height);
229 }

mercurial