New OGKDisplay methods.
This commit is contained in:
parent
96c5a44ae0
commit
7e755a78c9
3 changed files with 49 additions and 0 deletions
|
@ -27,9 +27,14 @@
|
|||
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
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
}
|
||||
|
||||
- initWithSize: (of_dimension_t)size
|
||||
position: (of_point_t)position
|
||||
fullscreen: (BOOL)fullscreen
|
||||
resizable: (BOOL)resizable
|
||||
{
|
||||
|
@ -45,6 +46,8 @@
|
|||
flags |= ALLEGRO_OPENGL_FORWARD_COMPATIBLE;
|
||||
#endif
|
||||
|
||||
al_set_new_window_position(position.x, position.y);
|
||||
|
||||
if (fullscreen)
|
||||
flags |= ALLEGRO_FULLSCREEN;
|
||||
else if (resizable)
|
||||
|
@ -66,6 +69,38 @@
|
|||
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();
|
||||
|
|
Reference in a new issue