Index: src/OGKDisplay.h ================================================================== --- src/OGKDisplay.h +++ src/OGKDisplay.h @@ -25,11 +25,16 @@ @interface OGKDisplay: OFObject { ALLEGRO_DISPLAY *display; } +@property (assign) of_point_t windowPosition; +@property (assign) of_dimension_t size; + - initWithSize: (of_dimension_t)size + position: (of_point_t)position fullscreen: (BOOL)fullscreen resizable: (BOOL)resizable; +- (void)setWindowTitle: (OFString*)title; - (void)update; - (ALLEGRO_DISPLAY*)OGK_allegroDisplay; @end Index: src/OGKDisplay.m ================================================================== --- src/OGKDisplay.m +++ src/OGKDisplay.m @@ -30,10 +30,11 @@ @throw [OFInitializationFailedException exceptionWithClass: self]; } - initWithSize: (of_dimension_t)size + position: (of_point_t)position fullscreen: (BOOL)fullscreen resizable: (BOOL)resizable { int flags = 0; @@ -42,10 +43,12 @@ #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; @@ -63,10 +66,42 @@ - (void)dealloc { if (display != NULL) al_destroy_display(display); } + +- (void)setWindowTitle: (OFString*)title +{ + al_set_window_title(display, + [title cStringWithEncoding: OF_STRING_ENCODING_NATIVE]); +} + +- (void)setWindowPosition: (of_point_t)position +{ + al_set_window_position(display, position.x, position.y); +} + +- (of_point_t)windowPosition +{ + int x, y; + + al_get_window_position(display, &x, &y); + + return of_point(x, y); +} + +- (void)setSize: (of_dimension_t)size +{ + al_resize_display(display, size.width, size.height); +} + +- (of_dimension_t)size +{ + return of_dimension( + al_get_display_width(display), + al_get_display_height(display)); +} - (void)update { al_flip_display(); } Index: test/TestMain.m ================================================================== --- test/TestMain.m +++ test/TestMain.m @@ -78,12 +78,21 @@ } - (void)applicationDidFinishLaunching { display = [[OGKDisplay alloc] initWithSize: of_dimension(640, 480) + position: of_point(200, 200) fullscreen: NO resizable: NO]; + display.size = of_dimension(800, 600); + display.windowPosition = of_point(100, 100); + display.windowTitle = @"ObjGameKit test"; + + of_log(@"Display is %.fx%.f at (%.f, %.f)", + display.size.width, display.size.height, + display.windowPosition.x, display.windowPosition.y); + eventQueue = [[OGKEventQueue alloc] init]; eventQueue.delegate = self; [eventQueue registerDisplay: display]; [eventQueue registerKeyboard];