DrawCenteredScaled

This commit is contained in:
Sebastian Krzyszkowiak 2018-04-24 05:01:59 +02:00
parent 80f59dd749
commit 34a36c2038
3 changed files with 12 additions and 0 deletions

View file

@ -472,6 +472,12 @@ SYMBOL_EXPORT void DrawCharacter(struct Game* game, struct Character* character)
al_use_transform(&transform); al_use_transform(&transform);
al_draw_tinted_bitmap(character->frame->bitmap, character->tint, 0, 0, 0); al_draw_tinted_bitmap(character->frame->bitmap, character->tint, 0, 0, 0);
/* al_hold_bitmap_drawing(false);
al_draw_filled_rectangle(character->spritesheet->width * character->spritesheet->pivotX - 5,
character->spritesheet->height * character->spritesheet->pivotY - 5,
character->spritesheet->width * character->spritesheet->pivotX + 5,
character->spritesheet->height * character->spritesheet->pivotY + 5,
al_map_rgb(255, 255, 0));*/
al_use_transform(&current); al_use_transform(&current);
} }

View file

@ -121,6 +121,11 @@ SYMBOL_EXPORT void DrawCentered(ALLEGRO_BITMAP* bitmap, int x, int 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) {
al_draw_scaled_rotated_bitmap(bitmap, al_get_bitmap_width(bitmap) / 2.0, al_get_bitmap_height(bitmap) / 2.0,
x, y, sx, sy, 0, flags);
}
SYMBOL_EXPORT double DotProduct(const double v[], const double u[], int n) { SYMBOL_EXPORT double DotProduct(const double v[], const double u[], int n) {
float result = 0.0; float result = 0.0;
for (int i = 0; i < n; i++) { for (int i = 0; i < n; i++) {

View file

@ -53,6 +53,7 @@ int DrawWrappedText(ALLEGRO_FONT* font, ALLEGRO_COLOR color, float x, float y, i
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, int x, int y, int flags);
void DrawCenteredScaled(ALLEGRO_BITMAP* bitmap, int x, int y, double sx, double sy, int flags);
double DotProduct(const double v[], const double u[], int n); double DotProduct(const double v[], const double u[], int n);
double VectorLength(double x, double y, double z); double VectorLength(double x, double y, double z);