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.
|
* 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,
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue