fixed window width and height not being set correctly
This commit is contained in:
parent
5d6503e804
commit
d95594629e
10
main.c
10
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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue