From 015b9dbaffdac869786ff0727287979cb5d26625 Mon Sep 17 00:00:00 2001 From: Sebastian Krzyszkowiak Date: Thu, 21 Jul 2022 08:07:06 +0200 Subject: [PATCH] utils: Add DrawFullscreen function --- src/utils.c | 11 +++++++++++ src/utils.h | 1 + 2 files changed, 12 insertions(+) diff --git a/src/utils.c b/src/utils.c index 3004f0b..48b182f 100644 --- a/src/utils.c +++ b/src/utils.c @@ -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)) { diff --git a/src/utils.h b/src/utils.h index 895d646..0197162 100644 --- a/src/utils.h +++ b/src/utils.h @@ -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);