params: Add ability to disable clear to color before Gamestate_Draw

This commit is contained in:
Sebastian Krzyszkowiak 2022-07-15 03:34:37 +02:00
parent e536a8bc4f
commit 29aefdb55c
No known key found for this signature in database
GPG key ID: E8F235CF3BDBC3FF
2 changed files with 4 additions and 3 deletions

View file

@ -46,7 +46,7 @@ SYMBOL_INTERNAL void SimpleCompositor(struct Game* game) {
}
SYMBOL_INTERNAL void DrawGamestates(struct Game* game) {
if (!game->_priv.params.handlers.compositor) {
if (!game->_priv.params.disable_bg_clear && !game->_priv.params.handlers.compositor) {
ClearScreen(game);
}
struct Gamestate* tmp = game->_priv.gamestates;
@ -57,7 +57,7 @@ SYMBOL_INTERNAL void DrawGamestates(struct Game* game) {
if ((tmp->loaded) && (tmp->started)) {
game->_priv.current_gamestate = tmp;
SetFramebufferAsTarget(game);
if (game->_priv.params.handlers.compositor) { // don't clear when uncomposited
if (!game->_priv.params.disable_bg_clear && game->_priv.params.handlers.compositor) { // don't clear when uncomposited
al_reset_clipping_rectangle();
al_clear_to_color(game->_priv.bg); // even if everything is going to be redrawn, it optimizes tiled rendering
}
@ -71,7 +71,7 @@ SYMBOL_INTERNAL void DrawGamestates(struct Game* game) {
// same as above, but for the loading gamestate
game->_priv.current_gamestate = game->_priv.loading.gamestate;
SetFramebufferAsTarget(game);
if (game->_priv.params.handlers.compositor) {
if (!game->_priv.params.disable_bg_clear && game->_priv.params.handlers.compositor) {
al_reset_clipping_rectangle();
al_clear_to_color(game->_priv.bg);
}

View file

@ -141,6 +141,7 @@ struct Params {
bool integer_scaling; /*!< Ensure that the viewport is zoomed only by integer factors. */
bool depth_buffer; /*!< Request a depth buffer for the framebuffer's render target. */
bool show_loading_on_launch; /*!< Whether the loading screen should be shown when loading the initial set of gamestates. */
bool disable_bg_clear; /*!< If set to true, the gamestate framebuffer won't be cleared to background color before calling Gamestate_Draw. */
bool fixed_size; /*!< If set to true, the game's window will not be resizable. */
bool no_autopause; /*!< If set to true, engine autopause is forced to be disabled. */
int samples; /*!< How many samples should be used for multisampling; 0 to disable. */