src/window.c

changeset 237
2ea35c5f4760
parent 231
0da563c4e39c
equal deleted inserted replaced
236:7ad67e547266 237:2ea35c5f4760
220 void asc_window_set_title(unsigned index, const char *title) { 220 void asc_window_set_title(unsigned index, const char *title) {
221 assert(asc_context.windows[index].window != NULL); 221 assert(asc_context.windows[index].window != NULL);
222 SDL_SetWindowTitle(asc_context.windows[index].window, title); 222 SDL_SetWindowTitle(asc_context.windows[index].window, title);
223 } 223 }
224 224
225 void asc_window_set_position(unsigned index, asc_vec2i pos) {
226 assert(asc_context.windows[index].window != NULL);
227 SDL_SetWindowPosition(asc_context.windows[index].window, pos.x, pos.y);
228 }
229
230 void asc_window_center(unsigned index) {
231 // TODO: add support for multiple displays
232 // TODO: add support for centering just one axis
233 assert(asc_context.windows[index].window != NULL);
234 SDL_SetWindowPosition(asc_context.windows[index].window,
235 SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
236 }
237
225 void asc_window_set_size(unsigned index, asc_vec2u size) { 238 void asc_window_set_size(unsigned index, asc_vec2u size) {
226 assert(asc_context.windows[index].window != NULL); 239 assert(asc_context.windows[index].window != NULL);
227 asc_context.windows[index].dimensions = size; 240 asc_context.windows[index].dimensions = size;
241 // TODO: check what needs to be changed when SDL_WINDOW_ALLOW_HIGHDPI is supported by the engine
228 SDL_SetWindowSize(asc_context.windows[index].window, (int)size.width, (int)size.height); 242 SDL_SetWindowSize(asc_context.windows[index].window, (int)size.width, (int)size.height);
229 } 243 }

mercurial