added the desired aspect to rl_backgrnd_create

This commit is contained in:
Andre Leiradella 2015-05-19 22:47:32 -03:00
parent 16db263a3d
commit a4c039a40a
2 changed files with 16 additions and 9 deletions

View File

@ -7,17 +7,20 @@ static uint16_t* pixels;
static int width, height;
static uint16_t* fb;
int rl_backgrnd_create( int w, int h )
int rl_backgrnd_create( int w, int h, int aspect )
{
pixels = (uint16_t*)rl_malloc( ( ( w + RL_BACKGRND_MARGIN ) * h + RL_BACKGRND_MARGIN ) * sizeof( uint16_t ) );
if ( pixels )
if ( aspect == RL_BACKGRND_EXACT )
{
width = w;
height = h;
fb = (uint16_t*)pixels + RL_BACKGRND_MARGIN;
pixels = (uint16_t*)rl_malloc( ( ( w + RL_BACKGRND_MARGIN ) * h + RL_BACKGRND_MARGIN ) * sizeof( uint16_t ) );
return 0;
if ( pixels )
{
width = w;
height = h;
fb = (uint16_t*)pixels + RL_BACKGRND_MARGIN;
return 0;
}
}
return -1;

View File

@ -3,7 +3,11 @@
#include <stdint.h>
int rl_backgrnd_create( int width, int height );
#define RL_BACKGRND_EXACT 0
//#define RL_BACKGRND_STRETCH 1
//#define RL_BACKGRND_EXPAND 2
int rl_backgrnd_create( int width, int height, int aspect );
void rl_backgrnd_destroy( void );
void rl_backgrnd_clear( uint16_t color );