ObjGameKit  Diff

Differences From Artifact [7219e86adc]:

To Artifact [84dbf1da64]:

  • File src/OGKEventQueue.m — part of check-in [4719f25709] at 2012-08-26 12:17:52 on branch trunk — Only call al_*_destroy if Allegro is initialized.

    Otherwise, it would crash if al_uinstall_system() has already been
    called. Handling it this way eliminates the need to dealloc all objects
    before calling al_uninstall_system(), which meant that it was the users
    repsonsibility to call al_uninstall_system() after the user made sure
    all objects are deallocated. Now the user does not get to see any
    al_*() function. (user: js, size: 5851) [annotate] [blame] [check-ins using]


29
30
31
32
33
34
35
36

37
38
39
40
41
42
43
44
45
46
47
48
49
50
51

52

53
54
55
56
57
58
59
29
30
31
32
33
34
35

36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52

53
54
55
56
57
58
59
60







-
+















+
-
+







@synthesize delegate;

+ (void)initialize
{
	if (self != [OGKEventQueue class])
		return;

	if (!al_install_system(ALLEGRO_VERSION_INT, NULL))
	if (!al_init())
		@throw [OFInitializationFailedException
		    exceptionWithClass: self];
}

- init
{
	self = [super init];

	eventQueue = al_create_event_queue();

	return self;
}

- (void)dealloc
{
	if (al_is_system_installed())
	al_destroy_event_queue(eventQueue);
		al_destroy_event_queue(eventQueue);
}

- (void)handleNextEvent
{
	OGKEvent *event = [[OGKEvent alloc] init];
	ALLEGRO_EVENT *allegroEvent = [event OGK_allegroEvent];