Add OGK_DISPLAY_POSITION_DEFAULT.

This commit is contained in:
Jonathan Schleifer 2012-08-26 16:21:16 +02:00
parent 217a493a8d
commit a819fe0b81
2 changed files with 12 additions and 1 deletions

View file

@ -18,10 +18,15 @@
* 3.) This notice may not be removed or altered from any source distribution. * 3.) This notice may not be removed or altered from any source distribution.
*/ */
/* For NAN */
#include <math.h>
#include <allegro5/allegro.h> #include <allegro5/allegro.h>
#import <ObjFW/ObjFW.h> #import <ObjFW/ObjFW.h>
#define OGK_DISPLAY_POSITION_DEFAULT of_point(NAN, NAN)
typedef enum ogk_display_flags_t { typedef enum ogk_display_flags_t {
OGK_DISPLAY_FLAGS_FULLSCREEN = 0x01, OGK_DISPLAY_FLAGS_FULLSCREEN = 0x01,
OGK_DISPLAY_FLAGS_RESIZABLE = 0x02, OGK_DISPLAY_FLAGS_RESIZABLE = 0x02,

View file

@ -65,6 +65,9 @@ static OFDataArray *allegroDisplays = nil;
self = [super init]; self = [super init];
if (isnan(position.x) || isnan(position.y))
al_set_new_window_position(INT_MAX, INT_MAX);
else
al_set_new_window_position(position.x, position.y); al_set_new_window_position(position.x, position.y);
if (flags & OGK_DISPLAY_FLAGS_FULLSCREEN) if (flags & OGK_DISPLAY_FLAGS_FULLSCREEN)
@ -129,6 +132,9 @@ static OFDataArray *allegroDisplays = nil;
al_get_window_position(display, &x, &y); al_get_window_position(display, &x, &y);
if (x == INT_MAX && y == INT_MAX)
return of_point(NAN, NAN);
return of_point(x, y); return of_point(x, y);
} }