ObjGameKit  Check-in [c977e39bbe]

Overview
Comment:Adjust to ObjFW change.

Applications don't terminate after applicationDidFinishLaunching
anymore.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | trunk
Files: files | file ages | folders
SHA3-256: c977e39bbeea65d8d5dc71547b11e8cea0d3f4a2c67455e6fe3235c825dd28dd
User & Date: js on 2012-09-09 13:18:07
Other Links: manifest | tags
Context
2012-09-09
13:18
Adjust to ObjFW change. Leaf check-in: c977e39bbe user: js tags: trunk
2012-08-28
20:10
Add a test animation. check-in: d5c8cc4029 user: js tags: trunk
Changes

Modified src/OGKEvent.m from [d9d82a1154] to [0258e0e165].

43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
@implementation OGKKeyReleaseEvent
@end

@implementation OGKCharacterTypedEvent
- (of_unichar_t)character
{
	if (event.keyboard.unichar < 1)
		return 0xFFFD;

	return event.keyboard.unichar;
}

- (unsigned)modifiers
{
	return event.keyboard.modifiers;







|







43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
@implementation OGKKeyReleaseEvent
@end

@implementation OGKCharacterTypedEvent
- (of_unichar_t)character
{
	if (event.keyboard.unichar < 1)
		return 0;

	return event.keyboard.unichar;
}

- (unsigned)modifiers
{
	return event.keyboard.modifiers;

Modified tests/TestMain.h from [7e7dd1e48b] to [6d66ab1a73].

27
28
29
30
31
32
33
34
35
36
37
38
39
40
@interface TestMain: OFObject <OFApplicationDelegate, OGKEventQueueDelegate>
{
	OGKDisplay *display;
	OGKEventQueue *eventQueue;
	OGKBitmap *bitmap;
	of_point_t position;
	of_dimension_t scale;
	BOOL running;
	ogk_rotation_t rotation;
	ogk_color_t tint;
	OFThread *animationThread;
	BOOL stopAnimation;
}
@end







<






27
28
29
30
31
32
33

34
35
36
37
38
39
@interface TestMain: OFObject <OFApplicationDelegate, OGKEventQueueDelegate>
{
	OGKDisplay *display;
	OGKEventQueue *eventQueue;
	OGKBitmap *bitmap;
	of_point_t position;
	of_dimension_t scale;

	ogk_rotation_t rotation;
	ogk_color_t tint;
	OFThread *animationThread;
	BOOL stopAnimation;
}
@end

Modified tests/TestMain.m from [a1fc7a3a43] to [ff2ce8d9d5].

32
33
34
35
36
37
38
39
40
41
42
43
44
45
46

OF_APPLICATION_DELEGATE(TestMain)

@implementation TestMain
- (void)display: (OGKDisplay*)display
      wasClosed: (OGKCloseEvent*)event
{
	running = NO;
}

- (void)keyWasPressed: (OGKKeyPressEvent*)event
	      display: (OGKDisplay*)display
{
	of_log(@"Pressed: %d", event.keycode);
}







|







32
33
34
35
36
37
38
39
40
41
42
43
44
45
46

OF_APPLICATION_DELEGATE(TestMain)

@implementation TestMain
- (void)display: (OGKDisplay*)display
      wasClosed: (OGKCloseEvent*)event
{
	[OFApplication terminate];
}

- (void)keyWasPressed: (OGKKeyPressEvent*)event
	      display: (OGKDisplay*)display
{
	of_log(@"Pressed: %d", event.keycode);
}
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
	case OGK_KEY_RIGHT:
		rotation.angle += M_PI / 128;
		break;
	case OGK_KEY_A:
		[self toggleAnimation];
		break;
	case OGK_KEY_Q:
		running = NO;
		break;
	}
}

- (void)mouseWasMoved: (OGKMouseMovedEvent*)event
	      display: (OGKDisplay*)display
{







|







76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
	case OGK_KEY_RIGHT:
		rotation.angle += M_PI / 128;
		break;
	case OGK_KEY_A:
		[self toggleAnimation];
		break;
	case OGK_KEY_Q:
		[OFApplication terminate];
		break;
	}
}

- (void)mouseWasMoved: (OGKMouseMovedEvent*)event
	      display: (OGKDisplay*)display
{
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
	bitmap = [[OGKBitmap alloc] initWithFile: @"test.bmp"];
	position = of_point(display.size.width / 2, display.size.height / 2);
	scale = of_dimension(1, 1);
	rotation = ogk_rotation(bitmap.size.width / 2, bitmap.size.height / 2,
	    0);
	tint = ogk_color(1, 1, 1, 0);

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







|







187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
	bitmap = [[OGKBitmap alloc] initWithFile: @"test.bmp"];
	position = of_point(display.size.width / 2, display.size.height / 2);
	scale = of_dimension(1, 1);
	rotation = ogk_rotation(bitmap.size.width / 2, bitmap.size.height / 2,
	    0);
	tint = ogk_color(1, 1, 1, 0);

	for (;;) {
		@autoreleasepool {
			[self handleEvents];
			[self draw];
		}
	}
}
@end