Index: src/OGKDisplay.h ================================================================== --- src/OGKDisplay.h +++ src/OGKDisplay.h @@ -30,11 +30,12 @@ typedef enum ogk_display_flags_t { OGK_DISPLAY_FLAGS_FULLSCREEN = 0x01, OGK_DISPLAY_FLAGS_RESIZABLE = 0x02, OGK_DISPLAY_FLAGS_OPENGL = 0x04, OGK_DISPLAY_FLAGS_OPENGL_3 = 0x08, - OGK_DISPLAY_FLAGS_OPENGL_3_ONLY = 0x10 + OGK_DISPLAY_FLAGS_OPENGL_3_ONLY = 0x10, + OGK_DISPLAY_FLAGS_VSYNC = 0x20 } ogk_display_flags_t; @interface OGKDisplay: OFObject { ALLEGRO_DISPLAY *display; Index: src/OGKDisplay.m ================================================================== --- src/OGKDisplay.m +++ src/OGKDisplay.m @@ -79,10 +79,15 @@ if (flags & OGK_DISPLAY_FLAGS_OPENGL_3) allegroFlags |= ALLEGRO_OPENGL_3_0; if (flags & OGK_DISPLAY_FLAGS_OPENGL_3_ONLY) allegroFlags |= ALLEGRO_OPENGL_FORWARD_COMPATIBLE; + if (flags & OGK_DISPLAY_FLAGS_VSYNC) + al_set_new_display_option(ALLEGRO_VSYNC, 1, ALLEGRO_SUGGEST); + else + al_set_new_display_option(ALLEGRO_VSYNC, 0, ALLEGRO_SUGGEST); + al_set_new_display_flags(allegroFlags); display = al_create_display(size.width, size.height); if (display == NULL) @throw [OFInitializationFailedException Index: tests/TestMain.m ================================================================== --- tests/TestMain.m +++ tests/TestMain.m @@ -85,11 +85,13 @@ [display update]; } - (void)applicationDidFinishLaunching { - ogk_display_flags_t flags = OGK_DISPLAY_FLAGS_RESIZABLE; + ogk_display_flags_t flags = + OGK_DISPLAY_FLAGS_RESIZABLE | + OGK_DISPLAY_FLAGS_VSYNC; display = [[OGKDisplay alloc] initWithSize: of_dimension(640, 480) position: of_point(200, 200) flags: flags]; display.size = of_dimension(800, 600);