utils: fix DrawCentered* function to take float for bitmap position

This commit is contained in:
Sebastian Krzyszkowiak 2018-12-02 03:16:12 +01:00
parent 2e724c4ea5
commit 178b45968d
No known key found for this signature in database
GPG key ID: E8F235CF3BDBC3FF
2 changed files with 6 additions and 6 deletions

View file

@ -116,15 +116,15 @@ SYMBOL_EXPORT int DrawWrappedTextWithShadow(ALLEGRO_FONT* font, ALLEGRO_COLOR co
return DrawWrappedText(font, color, x, y, width, flags, text); return DrawWrappedText(font, color, x, y, width, flags, text);
} }
SYMBOL_EXPORT void DrawCentered(ALLEGRO_BITMAP* bitmap, int x, int y, int flags) { SYMBOL_EXPORT void DrawCentered(ALLEGRO_BITMAP* bitmap, float x, float y, int flags) {
al_draw_bitmap(bitmap, x - al_get_bitmap_width(bitmap) / 2.0, y - al_get_bitmap_height(bitmap) / 2.0, flags); al_draw_bitmap(bitmap, x - al_get_bitmap_width(bitmap) / 2.0, y - al_get_bitmap_height(bitmap) / 2.0, flags);
} }
SYMBOL_EXPORT void DrawCenteredScaled(ALLEGRO_BITMAP* bitmap, int x, int y, double sx, double sy, int flags) { SYMBOL_EXPORT void DrawCenteredScaled(ALLEGRO_BITMAP* bitmap, float x, float y, double sx, double sy, int flags) {
DrawCenteredTintedScaled(bitmap, al_map_rgb(255, 255, 255), x, y, sx, sy, flags); DrawCenteredTintedScaled(bitmap, al_map_rgb(255, 255, 255), x, y, sx, sy, flags);
} }
SYMBOL_EXPORT void DrawCenteredTintedScaled(ALLEGRO_BITMAP* bitmap, ALLEGRO_COLOR tint, int x, int y, double sx, double sy, int flags) { SYMBOL_EXPORT void DrawCenteredTintedScaled(ALLEGRO_BITMAP* bitmap, ALLEGRO_COLOR tint, float x, float y, double sx, double sy, int flags) {
al_draw_tinted_scaled_rotated_bitmap(bitmap, tint, al_get_bitmap_width(bitmap) / 2.0, al_get_bitmap_height(bitmap) / 2.0, al_draw_tinted_scaled_rotated_bitmap(bitmap, tint, al_get_bitmap_width(bitmap) / 2.0, al_get_bitmap_height(bitmap) / 2.0,
x, y, sx, sy, 0, flags); x, y, sx, sy, 0, flags);
} }

View file

@ -52,9 +52,9 @@ void DrawTextWithShadow(ALLEGRO_FONT* font, ALLEGRO_COLOR color, float x, float
int DrawWrappedText(ALLEGRO_FONT* font, ALLEGRO_COLOR color, float x, float y, int width, int flags, char const* text); int DrawWrappedText(ALLEGRO_FONT* font, ALLEGRO_COLOR color, float x, float y, int width, int flags, char const* text);
int DrawWrappedTextWithShadow(ALLEGRO_FONT* font, ALLEGRO_COLOR color, float x, float y, int width, int flags, char const* text); int DrawWrappedTextWithShadow(ALLEGRO_FONT* font, ALLEGRO_COLOR color, float x, float y, int width, int flags, char const* text);
void DrawCentered(ALLEGRO_BITMAP* bitmap, int x, int y, int flags); void DrawCentered(ALLEGRO_BITMAP* bitmap, float x, float y, int flags);
void DrawCenteredScaled(ALLEGRO_BITMAP* bitmap, int x, int y, double sx, double sy, int flags); void DrawCenteredScaled(ALLEGRO_BITMAP* bitmap, float x, float y, double sx, double sy, int flags);
void DrawCenteredTintedScaled(ALLEGRO_BITMAP* bitmap, ALLEGRO_COLOR tint, int x, int y, double sx, double sy, int flags); void DrawCenteredTintedScaled(ALLEGRO_BITMAP* bitmap, ALLEGRO_COLOR tint, float x, float y, double sx, double sy, int flags);
/*! \brief Clears the current target completely, without taking current clipping rectangle into account. */ /*! \brief Clears the current target completely, without taking current clipping rectangle into account. */
void ClearToColor(struct Game* game, ALLEGRO_COLOR color); void ClearToColor(struct Game* game, ALLEGRO_COLOR color);