ObjGameKit  Diff

Differences From Artifact [e02b7cbb4f]:

To Artifact [1ce7f6f9e5]:


17
18
19
20
21
22
23

24
25
26
27
28
29
30
 *       be misrepresented as being the original software.
 *   3.) This notice may not be removed or altered from any source distribution.
 */

#import "OGKDisplay.h"
#import "OGKEvent.h"
#import "OGKEventQueue.h"

#import "TestMain.h"

OF_APPLICATION_DELEGATE(TestMain)

@implementation TestMain
- (void)displayWasClosed: (OGKCloseEvent*)event
{







>







17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 *       be misrepresented as being the original software.
 *   3.) This notice may not be removed or altered from any source distribution.
 */

#import "OGKDisplay.h"
#import "OGKEvent.h"
#import "OGKEventQueue.h"
#import "OGKBitmap.h"
#import "TestMain.h"

OF_APPLICATION_DELEGATE(TestMain)

@implementation TestMain
- (void)displayWasClosed: (OGKCloseEvent*)event
{
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
90
91
92
93
94

- (void)mouseButtonWasReleased: (OGKMouseButtonPressedEvent*)event
{
	of_log(@"Mouse button was released: %d (X=%.f Y=%.f WX=%.f WY=%.f)",
	    event.button, event.cursor.x, event.cursor.y,
	    event.wheel.x, event.wheel.y);
}













- (void)applicationDidFinishLaunching
{
	display = [[OGKDisplay alloc] initWithSize: of_dimension(640, 480)
					fullscreen: NO
					 resizable: NO];
	eventQueue = [[OGKEventQueue alloc] init];
	eventQueue.delegate = self;

	[eventQueue registerDisplay: display];
	[eventQueue registerKeyboard];
	[eventQueue registerMouse];



	for (running = YES; running;) {
		@autoreleasepool {
			[eventQueue handleNextEvent];

		}
	}
}

- (void)applicationWillTerminate
{
	/* Make sure they don't get deallocated after al_uninstall_system() */
	display = nil;
	eventQueue = nil;

	al_uninstall_system();
}
@end







>
>
>
>
>
>
>
>
>
>
>
>













>
>


|
>













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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110

- (void)mouseButtonWasReleased: (OGKMouseButtonPressedEvent*)event
{
	of_log(@"Mouse button was released: %d (X=%.f Y=%.f WX=%.f WY=%.f)",
	    event.button, event.cursor.x, event.cursor.y,
	    event.wheel.x, event.wheel.y);
}

- (void)handleEvents
{
	[eventQueue handleNextEvent];
}

- (void)draw
{
	[OGKBitmap clearToColor: OGK_COLOR_BLACK];
	[bitmap drawAtPosition: of_point(160, 120)];
	[display update];
}

- (void)applicationDidFinishLaunching
{
	display = [[OGKDisplay alloc] initWithSize: of_dimension(640, 480)
					fullscreen: NO
					 resizable: NO];
	eventQueue = [[OGKEventQueue alloc] init];
	eventQueue.delegate = self;

	[eventQueue registerDisplay: display];
	[eventQueue registerKeyboard];
	[eventQueue registerMouse];

	bitmap = [[OGKBitmap alloc] initWithFile: @"test.bmp"];

	for (running = YES; running;) {
		@autoreleasepool {
			[self handleEvents];
			[self draw];
		}
	}
}

- (void)applicationWillTerminate
{
	/* Make sure they don't get deallocated after al_uninstall_system() */
	display = nil;
	eventQueue = nil;

	al_uninstall_system();
}
@end