Add OGK_DISPLAY_POSITION_DEFAULT.
This commit is contained in:
parent
217a493a8d
commit
a819fe0b81
2 changed files with 12 additions and 1 deletions
|
@ -18,10 +18,15 @@
|
|||
* 3.) This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/* For NAN */
|
||||
#include <math.h>
|
||||
|
||||
#include <allegro5/allegro.h>
|
||||
|
||||
#import <ObjFW/ObjFW.h>
|
||||
|
||||
#define OGK_DISPLAY_POSITION_DEFAULT of_point(NAN, NAN)
|
||||
|
||||
typedef enum ogk_display_flags_t {
|
||||
OGK_DISPLAY_FLAGS_FULLSCREEN = 0x01,
|
||||
OGK_DISPLAY_FLAGS_RESIZABLE = 0x02,
|
||||
|
|
|
@ -65,7 +65,10 @@ static OFDataArray *allegroDisplays = nil;
|
|||
|
||||
self = [super init];
|
||||
|
||||
al_set_new_window_position(position.x, position.y);
|
||||
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);
|
||||
|
||||
if (flags & OGK_DISPLAY_FLAGS_FULLSCREEN)
|
||||
allegroFlags |= ALLEGRO_FULLSCREEN;
|
||||
|
@ -129,6 +132,9 @@ static OFDataArray *allegroDisplays = nil;
|
|||
|
||||
al_get_window_position(display, &x, &y);
|
||||
|
||||
if (x == INT_MAX && y == INT_MAX)
|
||||
return of_point(NAN, NAN);
|
||||
|
||||
return of_point(x, y);
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue