ObjGameKit  Check-in [85092e308a]

Overview
Comment:Add vsync.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 85092e308a7f320a6dd8b73c1201ffa8d2a20a42ad743f044d8e1761be78fa05
User & Date: js on 2012-08-26 15:11:32
Other Links: manifest | tags
Context
2012-08-28
17:39
Add keycodes.h. check-in: 8bf981dfa3 user: js tags: trunk
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
Changes

Modified src/OGKDisplay.h from [e6858a90c7] to [9d86d6f0f8].

28
29
30
31
32
33
34
35

36
37
38
39
40
41
42
#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

} ogk_display_flags_t;

@interface OGKDisplay: OFObject
{
	ALLEGRO_DISPLAY *display;
}








|
>







28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#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,
	OGK_DISPLAY_FLAGS_VSYNC		= 0x20
} ogk_display_flags_t;

@interface OGKDisplay: OFObject
{
	ALLEGRO_DISPLAY *display;
}

Modified src/OGKDisplay.m from [90ca05166c] to [8d516f814d].

77
78
79
80
81
82
83





84
85
86
87
88
89
90
	if (flags & OGK_DISPLAY_FLAGS_OPENGL)
		allegroFlags |= ALLEGRO_OPENGL;
	if (flags & OGK_DISPLAY_FLAGS_OPENGL_3)
		allegroFlags |= ALLEGRO_OPENGL_3_0;
	if (flags & OGK_DISPLAY_FLAGS_OPENGL_3_ONLY)
		allegroFlags |= ALLEGRO_OPENGL_FORWARD_COMPATIBLE;






	al_set_new_display_flags(allegroFlags);
	display = al_create_display(size.width, size.height);

	if (display == NULL)
		@throw [OFInitializationFailedException
		    exceptionWithClass: [self class]];








>
>
>
>
>







77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
	if (flags & OGK_DISPLAY_FLAGS_OPENGL)
		allegroFlags |= ALLEGRO_OPENGL;
	if (flags & OGK_DISPLAY_FLAGS_OPENGL_3)
		allegroFlags |= ALLEGRO_OPENGL_3_0;
	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);

	if (display == NULL)
		@throw [OFInitializationFailedException
		    exceptionWithClass: [self class]];

Modified tests/TestMain.m from [00aa33180c] to [e1d8f71724].

83
84
85
86
87
88
89
90


91
92
93
94
95
96
97
	[OGKBitmap clearToColor: OGK_COLOR_BLACK];
	[bitmap drawAtPosition: position];
	[display update];
}

- (void)applicationDidFinishLaunching
{
	ogk_display_flags_t flags = OGK_DISPLAY_FLAGS_RESIZABLE;



	display = [[OGKDisplay alloc] initWithSize: of_dimension(640, 480)
					  position: of_point(200, 200)
					     flags: flags];
	display.size = of_dimension(800, 600);
	display.windowPosition = of_point(100, 100);
	display.windowTitle = @"ObjGameKit test";







|
>
>







83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
	[OGKBitmap clearToColor: OGK_COLOR_BLACK];
	[bitmap drawAtPosition: position];
	[display update];
}

- (void)applicationDidFinishLaunching
{
	ogk_display_flags_t flags =
	    OGK_DISPLAY_FLAGS_RESIZABLE |
	    OGK_DISPLAY_FLAGS_VSYNC;

	display = [[OGKDisplay alloc] initWithSize: of_dimension(640, 480)
					  position: of_point(200, 200)
					     flags: flags];
	display.size = of_dimension(800, 600);
	display.windowPosition = of_point(100, 100);
	display.windowTitle = @"ObjGameKit test";