mirror of
https://github.com/libretro/retroluxury.git
synced 2024-11-23 07:39:47 +00:00
moved global translation to rl_image
This commit is contained in:
parent
f7276abc98
commit
636ec2a9a5
@ -2,10 +2,21 @@
|
||||
#include <rl_memory.h>
|
||||
#include <rl_backgrnd.h>
|
||||
|
||||
#include <rl_endian.c>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
static int tslt_x, tslt_y;
|
||||
|
||||
void rl_image_init( void )
|
||||
{
|
||||
tslt_x = tslt_y = 0;
|
||||
}
|
||||
|
||||
void rl_image_translate( int x, int y )
|
||||
{
|
||||
tslt_x = x;
|
||||
tslt_y = y;
|
||||
}
|
||||
|
||||
const rl_image_t* rl_image_create( const rl_imagedata_t* imagedata, int check_transp, uint16_t transparent )
|
||||
{
|
||||
size_t size;
|
||||
@ -44,6 +55,9 @@ const rl_image_t* rl_image_create( const rl_imagedata_t* imagedata, int check_tr
|
||||
|
||||
void rl_image_blit_nobg( const rl_image_t* image, int x, int y )
|
||||
{
|
||||
x += tslt_x;
|
||||
y += tslt_y;
|
||||
|
||||
int x0 = 0;
|
||||
int y0 = 0;
|
||||
int x1 = image->width;
|
||||
@ -174,6 +188,9 @@ void rl_image_blit_nobg( const rl_image_t* image, int x, int y )
|
||||
|
||||
uint16_t* rl_image_blit( const rl_image_t* image, int x, int y, uint16_t* bg_ )
|
||||
{
|
||||
x += tslt_x;
|
||||
y += tslt_y;
|
||||
|
||||
int x0 = 0;
|
||||
int y0 = 0;
|
||||
int x1 = image->width;
|
||||
@ -315,6 +332,9 @@ uint16_t* rl_image_blit( const rl_image_t* image, int x, int y, uint16_t* bg_ )
|
||||
|
||||
void rl_image_unblit( const rl_image_t* image, int x, int y, const uint16_t* bg_ )
|
||||
{
|
||||
x += tslt_x;
|
||||
y += tslt_y;
|
||||
|
||||
int x0 = 0;
|
||||
int y0 = 0;
|
||||
int x1 = image->width;
|
||||
|
@ -31,6 +31,9 @@ typedef struct
|
||||
}
|
||||
rl_image_t;
|
||||
|
||||
void rl_image_init( void );
|
||||
void rl_image_translate( int x, int y );
|
||||
|
||||
/* Creates an image from a rl_imagedata_t. */
|
||||
const rl_image_t* rl_image_create( const rl_imagedata_t* imagedata, int check_transp, uint16_t transparent );
|
||||
/* Destroys an image. */
|
||||
|
@ -30,8 +30,6 @@ static item_t* free_list;
|
||||
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;
|
||||
|
||||
@ -46,7 +44,6 @@ void rl_sprite_init( void )
|
||||
free_list = items;
|
||||
|
||||
num_sprites = num_visible = 0;
|
||||
x0 = y0 = 0;
|
||||
}
|
||||
|
||||
rl_sprite_t* rl_sprite_create( void )
|
||||
@ -67,12 +64,6 @@ rl_sprite_t* rl_sprite_create( void )
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void rl_sprites_translate( int x, int y )
|
||||
{
|
||||
x0 = x;
|
||||
y0 = y;
|
||||
}
|
||||
|
||||
static int compare( const void* e1, const void* e2 )
|
||||
{
|
||||
const spt_t* s1 = (const spt_t*)e1;
|
||||
@ -105,7 +96,7 @@ void rl_sprites_blit_nobg( void )
|
||||
|
||||
qsort( (void*)sprites, num_sprites, sizeof( spt_t ), compare );
|
||||
|
||||
item_t guard = { 0 };
|
||||
item_t guard = { { { { { 0 } } } } }; /* Ugh */
|
||||
guard.sprite.flags = RL_SPRITE_UNUSED;
|
||||
sprites[ num_sprites ].item = &guard;
|
||||
|
||||
@ -117,7 +108,7 @@ void rl_sprites_blit_nobg( void )
|
||||
{
|
||||
do
|
||||
{
|
||||
rl_image_blit_nobg( sptptr->item->sprite.image, x0 + sptptr->item->sprite.x, y0 + sptptr->item->sprite.y );
|
||||
rl_image_blit_nobg( sptptr->item->sprite.image, sptptr->item->sprite.x, sptptr->item->sprite.y );
|
||||
sptptr++;
|
||||
}
|
||||
while ( sptptr->item->sprite.flags == 0 );
|
||||
@ -174,7 +165,7 @@ void rl_sprites_blit( void )
|
||||
|
||||
qsort( (void*)sprites, num_sprites, sizeof( spt_t ), compare );
|
||||
|
||||
item_t guard = { 0 };
|
||||
item_t guard = { { { { { 0 } } } } }; /* Ugh */
|
||||
guard.sprite.flags = RL_SPRITE_UNUSED;
|
||||
sprites[ num_sprites ].item = &guard;
|
||||
|
||||
@ -188,7 +179,7 @@ void rl_sprites_blit( void )
|
||||
do
|
||||
{
|
||||
sptptr->item->bg = saved_ptr;
|
||||
saved_ptr = rl_image_blit( sptptr->item->sprite.image, x0 + sptptr->item->sprite.x, y0 + sptptr->item->sprite.y, saved_ptr );
|
||||
saved_ptr = rl_image_blit( sptptr->item->sprite.image, sptptr->item->sprite.x, sptptr->item->sprite.y, saved_ptr );
|
||||
sptptr++;
|
||||
}
|
||||
while ( sptptr->item->sprite.flags == 0 );
|
||||
@ -236,7 +227,7 @@ void rl_sprites_unblit( void )
|
||||
{
|
||||
do
|
||||
{
|
||||
rl_image_unblit( sptptr->item->sprite.image, x0 + sptptr->item->sprite.x, y0 + sptptr->item->sprite.y, sptptr->item->bg );
|
||||
rl_image_unblit( sptptr->item->sprite.image, sptptr->item->sprite.x, sptptr->item->sprite.y, sptptr->item->bg );
|
||||
sptptr--;
|
||||
}
|
||||
while ( sptptr >= sprites );
|
||||
|
@ -36,8 +36,6 @@ void rl_sprite_init( void );
|
||||
rl_sprite_t* rl_sprite_create( void );
|
||||
#define rl_sprite_destroy( sprite ) do { ( sprite )->flags |= RL_SPRITE_UNUSED; } while ( 0 )
|
||||
|
||||
void rl_sprites_translate( int x0, int y0 );
|
||||
|
||||
void rl_sprites_blit_nobg( void );
|
||||
|
||||
void rl_sprites_blit( void );
|
||||
|
Loading…
Reference in New Issue
Block a user