mirror of
https://gitlab.com/dosowisko.net/libsuperderpy.git
synced 2024-12-05 00:38:00 +01:00
utils: Add helpers for memory bitmaps
This commit is contained in:
parent
c36050a920
commit
5ecea298f0
2 changed files with 22 additions and 0 deletions
16
src/utils.c
16
src/utils.c
|
@ -207,6 +207,22 @@ SYMBOL_EXPORT ALLEGRO_BITMAP* LoadScaledBitmap(struct Game* game, char* filename
|
|||
return target;
|
||||
}
|
||||
|
||||
SYMBOL_EXPORT ALLEGRO_BITMAP* LoadMemoryBitmap(const char* filename) {
|
||||
int flags = al_get_new_bitmap_flags();
|
||||
al_set_new_bitmap_flags((flags | ALLEGRO_MEMORY_BITMAP) & ~(ALLEGRO_VIDEO_BITMAP | ALLEGRO_CONVERT_BITMAP));
|
||||
ALLEGRO_BITMAP* bitmap = al_load_bitmap(filename);
|
||||
al_set_new_bitmap_flags(flags);
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
SYMBOL_EXPORT ALLEGRO_BITMAP* CreateMemoryBitmap(int width, int height) {
|
||||
int flags = al_get_new_bitmap_flags();
|
||||
al_set_new_bitmap_flags((flags | ALLEGRO_MEMORY_BITMAP) & ~(ALLEGRO_VIDEO_BITMAP | ALLEGRO_CONVERT_BITMAP));
|
||||
ALLEGRO_BITMAP* bitmap = al_create_bitmap(width, height);
|
||||
al_set_new_bitmap_flags(flags);
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
SYMBOL_EXPORT void FatalErrorWithContext(struct Game* game, int line, const char* file, const char* func, bool exit, char* format, ...) {
|
||||
char text[1024] = {0};
|
||||
PrintConsole(game, "Fatal Error, displaying Blue Screen of Derp...");
|
||||
|
|
|
@ -52,6 +52,12 @@ void ScaleBitmap(ALLEGRO_BITMAP* source, int width, int height);
|
|||
/*! \brief Loads bitmap into memory and scales it with software linear filtering. */
|
||||
ALLEGRO_BITMAP* LoadScaledBitmap(struct Game* game, char* filename, int width, int height);
|
||||
|
||||
/*! \brief Creates a memory bitmap loaded from a file. */
|
||||
ALLEGRO_BITMAP* LoadMemoryBitmap(const char* filename);
|
||||
|
||||
/*! \brief Creates a memory bitmap with specified dimensions. */
|
||||
ALLEGRO_BITMAP* CreateMemoryBitmap(int width, int height);
|
||||
|
||||
/*! \brief Finds the path for data file. Returns NULL when the file can't be found, or ephemeral string otherwise. */
|
||||
const char* FindDataFilePath(struct Game* game, const char* filename);
|
||||
/*! \brief Finds the path for data file. Triggers BSOD and quits when the file can't be found, returns ephemeral string otherwise. */
|
||||
|
|
Loading…
Reference in a new issue