From d3f876097fa088bf759f539892e31bed12f8d5c1 Mon Sep 17 00:00:00 2001 From: Sebastian Krzyszkowiak Date: Sun, 7 May 2017 01:30:22 +0200 Subject: [PATCH] add CreateNotPreservedBitmap helper --- src/utils.c | 8 ++++++++ src/utils.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/src/utils.c b/src/utils.c index ef2ad0f..bdd1334 100644 --- a/src/utils.c +++ b/src/utils.c @@ -402,3 +402,11 @@ SYMBOL_EXPORT void WindowCoordsToViewport(struct Game *game, int *x, int *y) { *x /= clipWidth / (float)game->viewport.width; *y /= clipHeight / (float)game->viewport.height; } + +SYMBOL_EXPORT ALLEGRO_BITMAP* CreateNotPreservedBitmap(int width, int height) { + int flags = al_get_new_bitmap_flags(); + al_add_new_bitmap_flag(ALLEGRO_NO_PRESERVE_TEXTURE); + ALLEGRO_BITMAP *bitmap = al_create_bitmap(width, height); + al_set_new_bitmap_flags(flags); + return bitmap; +} diff --git a/src/utils.h b/src/utils.h index b8abf4e..1638226 100644 --- a/src/utils.h +++ b/src/utils.h @@ -71,4 +71,6 @@ void FatalError(struct Game *game, bool exit, char* format, ...); void SetupViewport(struct Game *game, struct Viewport config); void WindowCoordsToViewport(struct Game *game, int *x, int *y); + +ALLEGRO_BITMAP* CreateNotPreservedBitmap(int width, int height); #endif