mirror of
https://gitlab.com/dosowisko.net/libsuperderpy.git
synced 2025-02-01 02:56:43 +01:00
clean up a duplicated framebuffer of the loading gamestate
This commit is contained in:
parent
2333ff1187
commit
9006427278
4 changed files with 6 additions and 15 deletions
|
@ -59,7 +59,7 @@ SYMBOL_INTERNAL void DrawGamestates(struct Game* game) {
|
|||
|
||||
if (game->loading.shown) {
|
||||
// same as above, but for the loading gamestate
|
||||
game->_priv.current_gamestate = NULL;
|
||||
game->_priv.current_gamestate = game->_priv.loading.gamestate;
|
||||
SetFramebufferAsTarget(game);
|
||||
if (game->_priv.params.handlers.compositor) {
|
||||
al_reset_clipping_rectangle();
|
||||
|
@ -77,7 +77,7 @@ SYMBOL_INTERNAL void DrawGamestates(struct Game* game) {
|
|||
al_reset_clipping_rectangle();
|
||||
|
||||
if (game->_priv.params.handlers.compositor) {
|
||||
game->_priv.params.handlers.compositor(game, game->_priv.gamestates, game->_priv.loading.fb);
|
||||
game->_priv.params.handlers.compositor(game, game->_priv.gamestates, game->_priv.loading.gamestate->fb);
|
||||
}
|
||||
|
||||
if (game->_priv.params.handlers.postdraw) {
|
||||
|
@ -167,11 +167,11 @@ SYMBOL_INTERNAL void ResizeGamestates(struct Game* game) {
|
|||
}
|
||||
tmp = tmp->next;
|
||||
}
|
||||
al_destroy_bitmap(game->_priv.loading.fb);
|
||||
al_destroy_bitmap(game->_priv.loading.gamestate->fb);
|
||||
if (game->_priv.params.handlers.compositor) {
|
||||
game->_priv.loading.fb = CreateNotPreservedBitmap(game->clip_rect.w, game->clip_rect.h);
|
||||
game->_priv.loading.gamestate->fb = CreateNotPreservedBitmap(game->clip_rect.w, game->clip_rect.h);
|
||||
} else {
|
||||
game->_priv.loading.fb = al_create_sub_bitmap(al_get_backbuffer(game->display), game->clip_rect.x, game->clip_rect.y, game->clip_rect.w, game->clip_rect.h);
|
||||
game->_priv.loading.gamestate->fb = al_create_sub_bitmap(al_get_backbuffer(game->display), game->clip_rect.x, game->clip_rect.y, game->clip_rect.w, game->clip_rect.h);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -313,12 +313,6 @@ SYMBOL_EXPORT struct Game* libsuperderpy_init(int argc, char** argv, const char*
|
|||
|
||||
game->loading.progress = 0;
|
||||
|
||||
if (game->_priv.params.handlers.compositor) {
|
||||
game->_priv.loading.fb = CreateNotPreservedBitmap(game->clip_rect.w, game->clip_rect.h);
|
||||
} else {
|
||||
game->_priv.loading.fb = al_create_sub_bitmap(al_get_backbuffer(game->display), game->clip_rect.x, game->clip_rect.y, game->clip_rect.w, game->clip_rect.h);
|
||||
}
|
||||
|
||||
return game;
|
||||
}
|
||||
|
||||
|
@ -359,6 +353,7 @@ SYMBOL_EXPORT int libsuperderpy_start(struct Game* game) {
|
|||
return 2;
|
||||
}
|
||||
game->_priv.loading.gamestate->data = (*game->_priv.loading.gamestate->api->load)(game, NULL);
|
||||
game->_priv.loading.gamestate->loaded = true;
|
||||
PrintConsole(game, "Loading screen registered.");
|
||||
|
||||
ReloadShaders(game, false);
|
||||
|
|
|
@ -219,7 +219,6 @@ struct Game {
|
|||
volatile bool in_progress;
|
||||
bool lock;
|
||||
double time;
|
||||
ALLEGRO_BITMAP* fb;
|
||||
} loading;
|
||||
|
||||
struct Gamestate* current_gamestate;
|
||||
|
|
|
@ -532,9 +532,6 @@ SYMBOL_EXPORT void WindowCoordsToViewport(struct Game* game, int* x, int* y) {
|
|||
}
|
||||
|
||||
SYMBOL_EXPORT ALLEGRO_BITMAP* GetFramebuffer(struct Game* game) {
|
||||
if (!game->_priv.current_gamestate) {
|
||||
return game->_priv.loading.fb;
|
||||
}
|
||||
return game->_priv.current_gamestate->fb;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue