diff --git a/src/rl_backgrnd.c b/src/rl_backgrnd.c index abafcbc..d551c53 100644 --- a/src/rl_backgrnd.c +++ b/src/rl_backgrnd.c @@ -7,9 +7,6 @@ static uint16_t* pixels; static int width, height; static uint16_t* fb; -static uint16_t saved_backgrnd[ RL_BG_SAVE_SIZE ]; -static uint16_t* saved_ptr; - int rl_backgrnd_create( int w, int h ) { pixels = (uint16_t*)rl_malloc( ( ( w + RL_BACKGRND_MARGIN ) * h + RL_BACKGRND_MARGIN ) * sizeof( uint16_t ) ); @@ -20,8 +17,6 @@ int rl_backgrnd_create( int w, int h ) height = h; fb = (uint16_t*)pixels + RL_BACKGRND_MARGIN; - saved_ptr = saved_backgrnd; - return 0; } @@ -99,13 +94,3 @@ uint16_t* rl_backgrnd_fb( int* w, int* h ) return fb; } - -uint16_t* rl_backgrnd_get_bgptr( void ) -{ - return saved_ptr; -} - -void rl_backgrnd_set_bgptr( uint16_t* bg_ptr ) -{ - saved_ptr = bg_ptr; -} diff --git a/src/rl_backgrnd.h b/src/rl_backgrnd.h index f029551..1df123f 100644 --- a/src/rl_backgrnd.h +++ b/src/rl_backgrnd.h @@ -10,7 +10,4 @@ void rl_backgrnd_clear( uint16_t color ); void rl_backgrnd_scroll( int dx, int dy ); uint16_t* rl_backgrnd_fb( int* width, int* height ); -uint16_t* rl_backgrnd_get_bgptr( void ); -void rl_backgrnd_set_bgptr( uint16_t* bg_ptr ); - #endif /* RL_BACKGRND_H */ diff --git a/src/rl_sprite.c b/src/rl_sprite.c index 50f614e..c84bf53 100644 --- a/src/rl_sprite.c +++ b/src/rl_sprite.c @@ -15,6 +15,9 @@ static spt_t sprites[ RL_MAX_SPRITES + 1 ]; static int num_sprites, num_visible; static int x0, y0; +static uint16_t saved_backgrnd[ RL_BG_SAVE_SIZE ]; +static uint16_t* saved_ptr; + void rl_sprite_init( void ) { num_sprites = num_visible = 0; @@ -137,7 +140,7 @@ void rl_sprites_blit( void ) sprites[ num_sprites ].sprite = &guard; /* guard */ sptptr = sprites; - uint16_t* saved_ptr = rl_backgrnd_get_bgptr(); + saved_ptr = saved_backgrnd; /* Iterate over active and visible sprites and blit them */ /* flags & 0x0007U == 0 */ @@ -166,7 +169,6 @@ void rl_sprites_blit( void ) } num_sprites = sptptr - sprites; - rl_backgrnd_set_bgptr( saved_ptr ); } void rl_sprites_unblit( void ) @@ -182,7 +184,5 @@ void rl_sprites_unblit( void ) sptptr--; } while ( sptptr >= sprites ); - - rl_backgrnd_set_bgptr( sptptr[ 1 ].bg ); } }