More on SDL2. Now compiles, still needs a lot of cleaning and work to deal with SDL_DisplayFormat* from 1.2
This commit is contained in:
parent
75089ea473
commit
8693724975
10 changed files with 129 additions and 78 deletions
|
|
@ -134,10 +134,10 @@ void fisheye_draw(void * ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas,
|
|||
last_x = x;
|
||||
last_y = y;
|
||||
|
||||
oryg=SDL_CreateRGBSurface(SDL_ANYFORMAT, 80, 80, canvas->format->BitsPerPixel,
|
||||
oryg=SDL_CreateRGBSurface(SDL_SWSURFACE, 80, 80, canvas->format->BitsPerPixel,
|
||||
canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
||||
|
||||
output=SDL_CreateRGBSurface(SDL_ANYFORMAT, 80, 80, canvas->format->BitsPerPixel,
|
||||
output=SDL_CreateRGBSurface(SDL_SWSURFACE, 80, 80, canvas->format->BitsPerPixel,
|
||||
canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
||||
|
||||
rect.x=x-40;
|
||||
|
|
@ -149,7 +149,7 @@ void fisheye_draw(void * ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas,
|
|||
//do vertical fisheye
|
||||
for (i=0; i<40; i++)
|
||||
{
|
||||
temp_src=SDL_CreateRGBSurface(SDL_ANYFORMAT, 1, 80, canvas->format->BitsPerPixel,
|
||||
temp_src=SDL_CreateRGBSurface(SDL_SWSURFACE, 1, 80, canvas->format->BitsPerPixel,
|
||||
canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
||||
|
||||
//let's take a smooth bar of scaled bitmap and copy it to temp
|
||||
|
|
@ -160,7 +160,7 @@ void fisheye_draw(void * ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas,
|
|||
|
||||
SDL_BlitSurface(oryg, &rect, temp_src, NULL); //this bar is copied to temp_src
|
||||
|
||||
temp_dest=SDL_CreateRGBSurface(SDL_ANYFORMAT, 1, 80+2*i, canvas->format->BitsPerPixel,
|
||||
temp_dest=SDL_CreateRGBSurface(SDL_SWSURFACE, 1, 80+2*i, canvas->format->BitsPerPixel,
|
||||
canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
||||
|
||||
temp_dest=api->scale(temp_src, 1, 80+2*i, 0); //temp_dest stores scaled temp_src
|
||||
|
|
@ -186,10 +186,10 @@ void fisheye_draw(void * ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas,
|
|||
//do horizontal fisheye
|
||||
for (i=0; i<40; i++)
|
||||
{
|
||||
temp_src=SDL_CreateRGBSurface(SDL_ANYFORMAT, 80, 1, canvas->format->BitsPerPixel,
|
||||
temp_src=SDL_CreateRGBSurface(SDL_SWSURFACE, 80, 1, canvas->format->BitsPerPixel,
|
||||
canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
||||
|
||||
temp_dest=SDL_CreateRGBSurface(SDL_ANYFORMAT, 80+2*i, 1, canvas->format->BitsPerPixel,
|
||||
temp_dest=SDL_CreateRGBSurface(SDL_SWSURFACE, 80+2*i, 1, canvas->format->BitsPerPixel,
|
||||
canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
||||
|
||||
//upper side first
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ void fold_draw(magic_api * api, int which,
|
|||
int left_y, right_x;
|
||||
float w, h;
|
||||
SDL_Surface * temp;
|
||||
temp=SDL_CreateRGBSurface(SDL_ANYFORMAT, canvas->w, canvas->h, canvas->format->BitsPerPixel,
|
||||
temp=SDL_CreateRGBSurface(SDL_SWSURFACE, canvas->w, canvas->h, canvas->format->BitsPerPixel,
|
||||
canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
||||
SDL_BlitSurface(canvas,0,temp,0);
|
||||
|
||||
|
|
@ -207,10 +207,10 @@ SDL_Surface * rotate(magic_api * api, SDL_Surface * canvas, int angle)
|
|||
int a,b;
|
||||
|
||||
if (angle==180)
|
||||
temp=SDL_CreateRGBSurface(SDL_ANYFORMAT, canvas->w, canvas->h, canvas->format->BitsPerPixel,
|
||||
temp=SDL_CreateRGBSurface(SDL_SWSURFACE, canvas->w, canvas->h, canvas->format->BitsPerPixel,
|
||||
canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
||||
else
|
||||
temp=SDL_CreateRGBSurface(SDL_ANYFORMAT, canvas->h, canvas->w, canvas->format->BitsPerPixel,
|
||||
temp=SDL_CreateRGBSurface(SDL_SWSURFACE, canvas->h, canvas->w, canvas->format->BitsPerPixel,
|
||||
canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
||||
|
||||
switch (angle)
|
||||
|
|
|
|||
|
|
@ -217,7 +217,7 @@ void fretwork_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNU
|
|||
{
|
||||
//we've to compute the quantity of segments in each direction
|
||||
|
||||
canvas_backup=SDL_CreateRGBSurface(SDL_ANYFORMAT, canvas->w, canvas->h, canvas->format->BitsPerPixel,
|
||||
canvas_backup=SDL_CreateRGBSurface(SDL_SWSURFACE, canvas->w, canvas->h, canvas->format->BitsPerPixel,
|
||||
canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
||||
|
||||
SDL_BlitSurface(canvas, NULL, canvas_backup, NULL);
|
||||
|
|
@ -466,10 +466,10 @@ static void fretwork_draw(void * ptr, int which ATTRIBUTE_UNUSED, SDL_Surface *
|
|||
|
||||
fretwork_status_of_segments[segment]=image; //and write it to global table
|
||||
|
||||
result=SDL_CreateRGBSurface(SDL_ANYFORMAT, img_w, img_h, fretwork_one->format->BitsPerPixel,
|
||||
result=SDL_CreateRGBSurface(SDL_SWSURFACE, img_w, img_h, fretwork_one->format->BitsPerPixel,
|
||||
fretwork_one->format->Rmask, fretwork_one->format->Gmask, fretwork_one->format->Bmask, fretwork_one->format->Amask);
|
||||
|
||||
temp=SDL_CreateRGBSurface(SDL_ANYFORMAT, img_w, img_h, fretwork_one->format->BitsPerPixel,
|
||||
temp=SDL_CreateRGBSurface(SDL_SWSURFACE, img_w, img_h, fretwork_one->format->BitsPerPixel,
|
||||
fretwork_one->format->Rmask, fretwork_one->format->Gmask, fretwork_one->format->Bmask, fretwork_one->format->Amask);
|
||||
|
||||
SDL_BlitSurface(canvas_backup, &modification_rect, result, NULL);
|
||||
|
|
|
|||
|
|
@ -307,10 +307,10 @@ void halftone_switchin(magic_api * api, int which ATTRIBUTE_UNUSED,
|
|||
int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas)
|
||||
{
|
||||
if (canvas_backup == NULL)
|
||||
canvas_backup = SDL_CreateRGBSurface(SDL_ANYFORMAT, api->canvas_w, api->canvas_h, canvas->format->BitsPerPixel, canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
||||
canvas_backup = SDL_CreateRGBSurface(SDL_SWSURFACE, api->canvas_w, api->canvas_h, canvas->format->BitsPerPixel, canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
||||
|
||||
if (square == NULL)
|
||||
square = SDL_CreateRGBSurface(SDL_ANYFORMAT, 16, 16, canvas->format->BitsPerPixel, canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
||||
square = SDL_CreateRGBSurface(SDL_SWSURFACE, 16, 16, canvas->format->BitsPerPixel, canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
||||
|
||||
/* FIXME: What to do if they come back NULL!? :( */
|
||||
|
||||
|
|
|
|||
2
magic/src/puzzle.c
Executable file → Normal file
2
magic/src/puzzle.c
Executable file → Normal file
|
|
@ -145,7 +145,7 @@ void puzzle_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSE
|
|||
puzzle_gcd=RATIO*gcd(canvas->w, canvas->h);
|
||||
rects_w=(unsigned int)canvas->w/puzzle_gcd;
|
||||
rects_h=(unsigned int)canvas->h/puzzle_gcd;
|
||||
canvas_backup = SDL_CreateRGBSurface(SDL_ANYFORMAT,canvas->w, canvas->h, canvas->format->BitsPerPixel, canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
||||
canvas_backup = SDL_CreateRGBSurface(SDL_SWSURFACE,canvas->w, canvas->h, canvas->format->BitsPerPixel, canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
||||
}
|
||||
|
||||
void puzzle_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ void rails_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED
|
|||
{
|
||||
//we've to compute the quantity of segments in each direction
|
||||
|
||||
canvas_backup=SDL_CreateRGBSurface(SDL_ANYFORMAT, canvas->w, canvas->h, canvas->format->BitsPerPixel,
|
||||
canvas_backup=SDL_CreateRGBSurface(SDL_SWSURFACE, canvas->w, canvas->h, canvas->format->BitsPerPixel,
|
||||
canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
||||
|
||||
SDL_BlitSurface(canvas, NULL, canvas_backup, NULL);
|
||||
|
|
@ -392,10 +392,10 @@ static void rails_draw(void * ptr, int which ATTRIBUTE_UNUSED, ATTRIBUTE_UNUSED
|
|||
rails_status_of_segments[segment]=image; //and write it to global table
|
||||
|
||||
|
||||
result=SDL_CreateRGBSurface(SDL_ANYFORMAT, img_w, img_h, rails_one->format->BitsPerPixel,
|
||||
result=SDL_CreateRGBSurface(SDL_SWSURFACE, img_w, img_h, rails_one->format->BitsPerPixel,
|
||||
rails_one->format->Rmask, rails_one->format->Gmask, rails_one->format->Bmask, rails_one->format->Amask);
|
||||
|
||||
temp=SDL_CreateRGBSurface(SDL_ANYFORMAT, img_w, img_h, rails_one->format->BitsPerPixel,
|
||||
temp=SDL_CreateRGBSurface(SDL_SWSURFACE, img_w, img_h, rails_one->format->BitsPerPixel,
|
||||
rails_one->format->Rmask, rails_one->format->Gmask, rails_one->format->Bmask, rails_one->format->Amask);
|
||||
|
||||
SDL_BlitSurface(canvas_backup, &modification_rect, result, NULL);
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ void string_shutdown(__attribute__((unused)) magic_api * api)
|
|||
|
||||
void string_switchin(__attribute__((unused)) magic_api * api, __attribute__((unused)) int which, __attribute__((unused)) int mode, SDL_Surface * canvas, __attribute__((unused)) SDL_Surface * snapshot)
|
||||
{
|
||||
canvas_backup=SDL_CreateRGBSurface(SDL_ANYFORMAT, canvas->w, canvas->h, canvas->format->BitsPerPixel,
|
||||
canvas_backup=SDL_CreateRGBSurface(SDL_SWSURFACE, canvas->w, canvas->h, canvas->format->BitsPerPixel,
|
||||
canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue