Add vsync.
This commit is contained in:
parent
a819fe0b81
commit
569fcf994b
3 changed files with 10 additions and 2 deletions
|
@ -32,7 +32,8 @@ typedef enum ogk_display_flags_t {
|
|||
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
|
||||
|
|
|
@ -81,6 +81,11 @@ static OFDataArray *allegroDisplays = nil;
|
|||
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);
|
||||
|
||||
|
|
Reference in a new issue