Merge SDL-agnositc SDL_Rect member type to SDL2.0 branch
This commit is contained in:
parent
91a37acf1a
commit
16d79a323d
2 changed files with 12 additions and 10 deletions
|
|
@ -70,7 +70,8 @@ void fretwork_release(magic_api * api, int which,
|
||||||
void fretwork_shutdown(magic_api * api);
|
void fretwork_shutdown(magic_api * api);
|
||||||
void fretwork_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * snapshot);
|
void fretwork_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * snapshot);
|
||||||
void fretwork_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * snapshot);
|
void fretwork_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * snapshot);
|
||||||
inline void fretwork_extract_coords_from_segment(unsigned int segment, int * x, int * y);
|
#define POINT_TYPE typeof(((SDL_Rect *)NULL)->x)
|
||||||
|
inline void fretwork_extract_coords_from_segment(unsigned int segment, POINT_TYPE * x, POINT_TYPE * y);
|
||||||
void fretwork_click(magic_api * api, int which, int mode,
|
void fretwork_click(magic_api * api, int which, int mode,
|
||||||
SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y, SDL_Rect * update_rect);
|
SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y, SDL_Rect * update_rect);
|
||||||
|
|
||||||
|
|
@ -278,7 +279,7 @@ inline unsigned int fretwork_get_segment(int x, int y)
|
||||||
return (yy - 1) * fretwork_segments_x + xx;
|
return (yy - 1) * fretwork_segments_x + xx;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void fretwork_extract_coords_from_segment(unsigned int segment, int * x, int * y)
|
inline void fretwork_extract_coords_from_segment(unsigned int segment, POINT_TYPE * x, POINT_TYPE * y)
|
||||||
{
|
{
|
||||||
*x = ((segment % fretwork_segments_x) - 1) * img_w; //useful to set update_rect as small as possible
|
*x = ((segment % fretwork_segments_x) - 1) * img_w; //useful to set update_rect as small as possible
|
||||||
*y = (int)(segment / fretwork_segments_x) * img_h;
|
*y = (int)(segment / fretwork_segments_x) * img_h;
|
||||||
|
|
@ -288,7 +289,7 @@ inline void fretwork_extract_coords_from_segment(unsigned int segment, int * x,
|
||||||
/* { */
|
/* { */
|
||||||
/* magic_api * api = (magic_api *) ptr; */
|
/* magic_api * api = (magic_api *) ptr; */
|
||||||
|
|
||||||
/* Sint16 x, y; */
|
/* POINT_TYPE x, y; */
|
||||||
|
|
||||||
/* for (x=0; x<dest->w; x++) */
|
/* for (x=0; x<dest->w; x++) */
|
||||||
/* for (y=0; y<dest->h; y++) */
|
/* for (y=0; y<dest->h; y++) */
|
||||||
|
|
@ -298,7 +299,7 @@ inline void fretwork_extract_coords_from_segment(unsigned int segment, int * x,
|
||||||
static void fretwork_flip_flop(void *ptr, SDL_Surface * dest, SDL_Surface * src)
|
static void fretwork_flip_flop(void *ptr, SDL_Surface * dest, SDL_Surface * src)
|
||||||
{
|
{
|
||||||
magic_api *api = (magic_api *) ptr;
|
magic_api *api = (magic_api *) ptr;
|
||||||
Sint16 x, y;
|
POINT_TYPE x, y;
|
||||||
|
|
||||||
for (x = 0; x < dest->w; x++)
|
for (x = 0; x < dest->w; x++)
|
||||||
for (y = 0; y < dest->h; y++)
|
for (y = 0; y < dest->h; y++)
|
||||||
|
|
@ -309,7 +310,7 @@ static void fretwork_rotate(void *ptr, SDL_Surface * dest, SDL_Surface * src, _B
|
||||||
//src and dest must have same size
|
//src and dest must have same size
|
||||||
{
|
{
|
||||||
magic_api *api = (magic_api *) ptr;
|
magic_api *api = (magic_api *) ptr;
|
||||||
Sint16 x, y;
|
POINT_TYPE x, y;
|
||||||
|
|
||||||
if (direction) //rotate -90 degs
|
if (direction) //rotate -90 degs
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,8 @@ void rails_shutdown(magic_api * api);
|
||||||
void rails_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
void rails_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||||
void rails_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
void rails_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||||
inline unsigned int rails_get_segment(int x, int y);
|
inline unsigned int rails_get_segment(int x, int y);
|
||||||
inline void rails_extract_coords_from_segment(unsigned int segment, int * x, int * y);
|
#define POINT_TYPE typeof(((SDL_Rect *)NULL)->x)
|
||||||
|
inline void rails_extract_coords_from_segment(unsigned int segment, POINT_TYPE * x, POINT_TYPE * y);
|
||||||
static void rails_flip(void *ptr, SDL_Surface * dest, SDL_Surface * src);
|
static void rails_flip(void *ptr, SDL_Surface * dest, SDL_Surface * src);
|
||||||
static void rails_flip_flop(void *ptr, SDL_Surface * dest, SDL_Surface * src);
|
static void rails_flip_flop(void *ptr, SDL_Surface * dest, SDL_Surface * src);
|
||||||
static void rails_rotate(void *ptr, SDL_Surface * dest, SDL_Surface * src, unsigned int direction);
|
static void rails_rotate(void *ptr, SDL_Surface * dest, SDL_Surface * src, unsigned int direction);
|
||||||
|
|
@ -228,7 +229,7 @@ inline unsigned int rails_get_segment(int x, int y)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void rails_extract_coords_from_segment(unsigned int segment, int * x, int * y)
|
inline void rails_extract_coords_from_segment(unsigned int segment, POINT_TYPE * x, POINT_TYPE * y)
|
||||||
{ //extracts the coords of the beginning and the segment
|
{ //extracts the coords of the beginning and the segment
|
||||||
*x = ((segment % rails_segments_x) - 1) * img_w; //useful to set update_rect as small as possible
|
*x = ((segment % rails_segments_x) - 1) * img_w; //useful to set update_rect as small as possible
|
||||||
*y = (int)(segment / rails_segments_x) * img_h;
|
*y = (int)(segment / rails_segments_x) * img_h;
|
||||||
|
|
@ -238,7 +239,7 @@ static void rails_flip(void *ptr, SDL_Surface * dest, SDL_Surface * src)
|
||||||
{
|
{
|
||||||
magic_api *api = (magic_api *) ptr;
|
magic_api *api = (magic_api *) ptr;
|
||||||
|
|
||||||
Sint16 x, y;
|
POINT_TYPE x, y;
|
||||||
|
|
||||||
for (x = 0; x < dest->w; x++)
|
for (x = 0; x < dest->w; x++)
|
||||||
for (y = 0; y < dest->h; y++)
|
for (y = 0; y < dest->h; y++)
|
||||||
|
|
@ -248,7 +249,7 @@ static void rails_flip(void *ptr, SDL_Surface * dest, SDL_Surface * src)
|
||||||
static void rails_flip_flop(void *ptr, SDL_Surface * dest, SDL_Surface * src)
|
static void rails_flip_flop(void *ptr, SDL_Surface * dest, SDL_Surface * src)
|
||||||
{
|
{
|
||||||
magic_api *api = (magic_api *) ptr;
|
magic_api *api = (magic_api *) ptr;
|
||||||
Sint16 x, y;
|
POINT_TYPE x, y;
|
||||||
|
|
||||||
for (x = 0; x < dest->w; x++)
|
for (x = 0; x < dest->w; x++)
|
||||||
for (y = 0; y < dest->h; y++)
|
for (y = 0; y < dest->h; y++)
|
||||||
|
|
@ -259,7 +260,7 @@ static void rails_rotate(void *ptr, SDL_Surface * dest, SDL_Surface * src, unsig
|
||||||
//src and dest must have same size
|
//src and dest must have same size
|
||||||
{
|
{
|
||||||
magic_api *api = (magic_api *) ptr;
|
magic_api *api = (magic_api *) ptr;
|
||||||
Sint16 x, y;
|
POINT_TYPE x, y;
|
||||||
|
|
||||||
if (direction) //rotate -90 degs
|
if (direction) //rotate -90 degs
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue