ObjGameKit  Diff

Differences From Artifact [fbfc273e25]:

To Artifact [c9b84695dd]:


45
46
47
48
49
50
51
52

53
54
55
56
57
58
59
60
61
62

63
64
65

66
67
68
69
70
71
72
73
74
75
76
77
78
79
80










81
82

83
84
85
86
87
88
89
45
46
47
48
49
50
51

52
53
54
55
56
57
58
59
60
61

62

63

64
65
66
67






68
69




70
71
72
73
74
75
76
77
78
79
80

81
82
83
84
85
86
87
88







-
+









-
+
-

-
+



-
-
-
-
-
-


-
-
-
-
+
+
+
+
+
+
+
+
+
+

-
+







	[mutex lock];
	@try {
		ALLEGRO_DISPLAY **cArray = [allegroDisplays cArray];
		size_t i, count = [allegroDisplays count];

		for (i = 0; i < count; i++)
			if (cArray[i] == display)
				return [displays objectAtIndex: i];
				return displays[i];
	} @finally {
		[mutex unlock];
	}

	return nil;
}

- initWithSize: (of_dimension_t)size
      position: (of_point_t)position
    fullscreen: (BOOL)fullscreen
	 flags: (ogk_display_flags_t)flags
     resizable: (BOOL)resizable
{
	int flags = 0;
	int allegroFlags = 0;

	self = [super init];

#if 0
	/* TODO: Find a nice way to set these when requested */
	flags |= ALLEGRO_OPENGL_3_0;
	flags |= ALLEGRO_OPENGL_FORWARD_COMPATIBLE;
#endif

	al_set_new_window_position(position.x, position.y);

	if (fullscreen)
		flags |= ALLEGRO_FULLSCREEN;
	else if (resizable)
		flags |= ALLEGRO_RESIZABLE;
	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;
	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(flags);
	al_set_new_display_flags(allegroFlags);
	display = al_create_display(size.width, size.height);

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

	[mutex lock];