ObjGameKit  Check-in [b5e933c8b8]

Overview
Comment:Add OGK_DISPLAY_POSITION_DEFAULT.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: b5e933c8b8a8dc329a09e8396c168ad311487b017628a83c9e06ee94d4eaeec0
User & Date: js on 2012-08-26 14:21:16
Other Links: manifest | tags
Context
2012-08-26
15:11
Add vsync. check-in: 85092e308a user: js tags: trunk
14:21
Add OGK_DISPLAY_POSITION_DEFAULT. check-in: b5e933c8b8 user: js tags: trunk
14:04
.gitignore: Add extra.mk. check-in: b6cd0e0efd user: js tags: trunk
Changes

Modified src/OGKDisplay.h from [5aa9048201] to [e6858a90c7].

14
15
16
17
18
19
20



21
22
23


24
25
26
27
28
29
30
 *       in a product, an acknowledgment in the product documentation would be
 *       appreciated but is not required.
 *   2.) Altered source versions must be plainly marked as such, and must not
 *       be misrepresented as being the original software.
 *   3.) This notice may not be removed or altered from any source distribution.
 */




#include <allegro5/allegro.h>

#import <ObjFW/ObjFW.h>



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







>
>
>



>
>







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 *       in a product, an acknowledgment in the product documentation would be
 *       appreciated but is not required.
 *   2.) Altered source versions must be plainly marked as such, and must not
 *       be misrepresented as being the original software.
 *   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,
	OGK_DISPLAY_FLAGS_OPENGL	= 0x04,
	OGK_DISPLAY_FLAGS_OPENGL_3	= 0x08,
	OGK_DISPLAY_FLAGS_OPENGL_3_ONLY	= 0x10

Modified src/OGKDisplay.m from [2b13daa365] to [90ca05166c].

61
62
63
64
65
66
67



68
69
70
71
72
73
74
75
      position: (of_point_t)position
	 flags: (ogk_display_flags_t)flags
{
	int allegroFlags = 0;

	self = [super init];




	al_set_new_window_position(position.x, position.y);

	if (flags & OGK_DISPLAY_FLAGS_FULLSCREEN)
		allegroFlags |= ALLEGRO_FULLSCREEN;
	if (flags & OGK_DISPLAY_FLAGS_RESIZABLE)
		allegroFlags |= ALLEGRO_RESIZABLE;
	if (flags & OGK_DISPLAY_FLAGS_OPENGL)
		allegroFlags |= ALLEGRO_OPENGL;







>
>
>
|







61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
      position: (of_point_t)position
	 flags: (ogk_display_flags_t)flags
{
	int allegroFlags = 0;

	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);

	if (flags & OGK_DISPLAY_FLAGS_FULLSCREEN)
		allegroFlags |= ALLEGRO_FULLSCREEN;
	if (flags & OGK_DISPLAY_FLAGS_RESIZABLE)
		allegroFlags |= ALLEGRO_RESIZABLE;
	if (flags & OGK_DISPLAY_FLAGS_OPENGL)
		allegroFlags |= ALLEGRO_OPENGL;
124
125
126
127
128
129
130



131
132
133
134
135
136
137
}

- (of_point_t)windowPosition
{
	int x, y;

	al_get_window_position(display, &x, &y);




	return of_point(x, y);
}

- (void)setSize: (of_dimension_t)size
{
	al_resize_display(display, size.width, size.height);







>
>
>







127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
}

- (of_point_t)windowPosition
{
	int 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);
}

- (void)setSize: (of_dimension_t)size
{
	al_resize_display(display, size.width, size.height);