utils: Add DrawFullscreen function

This commit is contained in:
Sebastian Krzyszkowiak 2022-07-21 08:07:06 +02:00
parent 6d7f6c6450
commit 015b9dbaff
No known key found for this signature in database
GPG key ID: E8F235CF3BDBC3FF
2 changed files with 12 additions and 0 deletions

View file

@ -131,6 +131,17 @@ SYMBOL_EXPORT void DrawCenteredTintedScaled(ALLEGRO_BITMAP* bitmap, ALLEGRO_COLO
x, y, sx, sy, 0, flags);
}
SYMBOL_EXPORT void DrawFullscreen(ALLEGRO_BITMAP* bitmap, int flags) {
int x, y, w, h;
ALLEGRO_TRANSFORM transform, orig = *al_get_current_transform();
al_identity_transform(&transform);
al_get_clipping_rectangle(&x, &y, &w, &h);
al_use_transform(&transform);
al_draw_scaled_bitmap(bitmap, 0, 0, al_get_bitmap_width(bitmap), al_get_bitmap_height(bitmap),
x, y, w, h, flags);
al_use_transform(&orig);
}
SYMBOL_EXPORT void ClearToColor(struct Game* game, ALLEGRO_COLOR color) {
ALLEGRO_BITMAP* target = al_get_target_bitmap();
if (game->_priv.current_gamestate && GetFramebuffer(game) == target && al_get_parent_bitmap(target) == al_get_backbuffer(game->display)) {

View file

@ -46,6 +46,7 @@ int DrawWrappedTextWithShadow(ALLEGRO_FONT* font, ALLEGRO_COLOR color, float x,
void DrawCentered(ALLEGRO_BITMAP* bitmap, float x, float y, 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, float x, float y, double sx, double sy, int flags);
void DrawFullscreen(ALLEGRO_BITMAP* bitmap, int flags);
/*! \brief Clears the current target completely, without taking current clipping rectangle into account. */
void ClearToColor(struct Game* game, ALLEGRO_COLOR color);