diff --git a/main.c b/main.c index ce2f313..a1cee93 100644 --- a/main.c +++ b/main.c @@ -20,6 +20,8 @@ int main(void) { Window * window = openWindow("Window", 800, 600); + printf("%d %d\n", window->width, window->height); + windowSetFps(window, 300); while (!windowKeyPressed(window, WINDOW_KEY_ESC)) { @@ -34,10 +36,10 @@ int main(void) //windowGetMousePosition(window, &x, &y); //printf("x: %d, y: %d\n", x, y); - int w = 0; - int h = 0; - windowGetSize(window, &w, &h); - printf("%dx%d\n", w, h); + //int w = 0; + //int h = 0; + //windowGetSize(window, &w, &h); + //printf("%dx%d\n", w, h); glClearColor(0.1, 0.2, 0.3, 1); glClear(GL_COLOR_BUFFER_BIT); diff --git a/src/openwindow.c b/src/openwindow.c index a73d3f4..a20e655 100644 --- a/src/openwindow.c +++ b/src/openwindow.c @@ -206,6 +206,9 @@ Window * openWindow(const char * name, size_t width, size_t height) { w->dt.t1 = calloc(1, sizeof(struct timespec)); w->dt.t2 = calloc(1, sizeof(struct timespec)); + w->width = width; + w->height = height; + if (init(w, name, width, height) < 0) { fprintf(stderr, "Failed to initialize window: X11 error!\n"); exit(1); @@ -489,6 +492,9 @@ Window * openWindow(const char * name, size_t width, size_t height) { Window * w = calloc(1, sizeof(Window)); w->fps = WINDOW_DEFAULT_FPS; + w->width = width; + w->height = height; + if (init(w, name, width, height) < 0) { fprintf(stderr, "Failed to initialize wgl!\n"); exit(1);