diff --git a/src/OGKBitmap.m b/src/OGKBitmap.m index bf1026b..92d9326 100644 --- a/src/OGKBitmap.m +++ b/src/OGKBitmap.m @@ -132,7 +132,8 @@ ogk_color_to_allegro(ogk_color_t color) { al_draw_scaled_bitmap(bitmap, 0, 0, al_get_bitmap_width(bitmap), al_get_bitmap_height(bitmap), position.x, position.y, - scale.width, scale.height, 0); + scale.width * al_get_bitmap_width(bitmap), + scale.height * al_get_bitmap_height(bitmap), 0); } - (void)drawAtPosition: (of_point_t)position @@ -148,7 +149,8 @@ ogk_color_to_allegro(ogk_color_t color) { al_draw_scaled_bitmap(bitmap, region.origin.x, region.origin.y, region.size.width, region.size.height, position.x, position.y, - scale.width, scale.height, 0); + scale.width * al_get_bitmap_width(bitmap), + scale.height * al_get_bitmap_height(bitmap), 0); } - (void)drawAtPosition: (of_point_t)position @@ -164,7 +166,8 @@ ogk_color_to_allegro(ogk_color_t color) { al_draw_tinted_scaled_bitmap(bitmap, ogk_color_to_allegro(tint), 0, 0, al_get_bitmap_width(bitmap), al_get_bitmap_height(bitmap), - position.x, position.y, scale.width, scale.height, 0); + position.x, position.y, scale.width * al_get_bitmap_width(bitmap), + scale.height * al_get_bitmap_height(bitmap), 0); } - (void)drawAtPosition: (of_point_t)position @@ -183,8 +186,9 @@ ogk_color_to_allegro(ogk_color_t color) { al_draw_tinted_scaled_bitmap(bitmap, ogk_color_to_allegro(tint), region.origin.x, region.origin.y, region.size.width, - region.size.height, position.x, position.y, scale.width, - scale.height, 0); + region.size.height, position.x, position.y, + scale.width * al_get_bitmap_width(bitmap), + scale.height * al_get_bitmap_height(bitmap), 0); } - (ALLEGRO_BITMAP*)OGK_allegroBitmap diff --git a/tests/TestMain.m b/tests/TestMain.m index d9485c0..67d9497 100644 --- a/tests/TestMain.m +++ b/tests/TestMain.m @@ -73,8 +73,9 @@ OF_APPLICATION_DELEGATE(TestMain) event.wheel.y, event.deltaWheel.y); position = event.cursor; - scale = of_dimension(bitmap.size.width + event.wheel.x, - bitmap.size.height + event.wheel.y); + scale = of_dimension( + (bitmap.size.width + event.wheel.x) / bitmap.size.width, + (bitmap.size.height + event.wheel.y) / bitmap.size.height); } - (void)mouseButtonWasPressed: (OGKMouseButtonPressedEvent*)event @@ -133,7 +134,7 @@ OF_APPLICATION_DELEGATE(TestMain) bitmap = [[OGKBitmap alloc] initWithFile: @"test.bmp"]; position = of_point(display.size.width / 2, display.size.height / 2); - scale = bitmap.size; + scale = of_dimension(1, 1); tint = ogk_color(1, 1, 1, 0); for (running = YES; running;) {