Removing warnings in magic ripples nd rosette by finaiized
This commit is contained in:
parent
bd4b940374
commit
97d5871537
2 changed files with 84 additions and 36 deletions
|
|
@ -41,6 +41,31 @@ static Mix_Chunk * ripples_snd;
|
||||||
|
|
||||||
static int ripples_z, ripples_brite;
|
static int ripples_z, ripples_brite;
|
||||||
|
|
||||||
|
Uint32 ripples_api_version(void);
|
||||||
|
int ripples_init(magic_api * api);
|
||||||
|
int ripples_get_tool_count(magic_api * api);
|
||||||
|
SDL_Surface * ripples_get_icon(magic_api * api, int which);
|
||||||
|
char * ripples_get_name(magic_api * api, int which);
|
||||||
|
char * ripples_get_description(magic_api * api, int which, int mode);
|
||||||
|
void ripples_drag(magic_api * api, int which, SDL_Surface * canvas,
|
||||||
|
SDL_Surface * last, int ox, int oy, int x, int y,
|
||||||
|
SDL_Rect * update_rect);
|
||||||
|
static void ripples_linecb(void * ptr, int which,
|
||||||
|
SDL_Surface * canvas, SDL_Surface * last,
|
||||||
|
int x, int y);
|
||||||
|
void ripples_click(magic_api * api, int which, int mode,
|
||||||
|
SDL_Surface * canvas, SDL_Surface * last,
|
||||||
|
int x, int y, SDL_Rect * update_rect);
|
||||||
|
void ripples_release(magic_api * api, int which,
|
||||||
|
SDL_Surface * canvas, SDL_Surface * last,
|
||||||
|
int x, int y, SDL_Rect * update_rect);
|
||||||
|
void ripples_shutdown(magic_api * api);
|
||||||
|
void ripples_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b);
|
||||||
|
int ripples_requires_colors(magic_api * api, int which);
|
||||||
|
void ripples_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||||
|
void ripples_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||||
|
int ripples_modes(magic_api * api, int which);
|
||||||
|
|
||||||
Uint32 ripples_api_version(void) { return(TP_MAGIC_API_VERSION); }
|
Uint32 ripples_api_version(void) { return(TP_MAGIC_API_VERSION); }
|
||||||
|
|
||||||
#define deg_cos(x) cos((x) * M_PI / 180.0)
|
#define deg_cos(x) cos((x) * M_PI / 180.0)
|
||||||
|
|
@ -59,13 +84,13 @@ int ripples_init(magic_api * api)
|
||||||
}
|
}
|
||||||
|
|
||||||
// We have multiple tools:
|
// We have multiple tools:
|
||||||
int ripples_get_tool_count(magic_api * api)
|
int ripples_get_tool_count(magic_api * api ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load our icons:
|
// Load our icons:
|
||||||
SDL_Surface * ripples_get_icon(magic_api * api, int which)
|
SDL_Surface * ripples_get_icon(magic_api * api, int which ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
char fname[1024];
|
char fname[1024];
|
||||||
|
|
||||||
|
|
@ -76,25 +101,25 @@ SDL_Surface * ripples_get_icon(magic_api * api, int which)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return our names, localized:
|
// Return our names, localized:
|
||||||
char * ripples_get_name(magic_api * api, int which)
|
char * ripples_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
return(strdup(gettext_noop("Ripples")));
|
return(strdup(gettext_noop("Ripples")));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return our descriptions, localized:
|
// Return our descriptions, localized:
|
||||||
char * ripples_get_description(magic_api * api, int which, int mode)
|
char * ripples_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
return(strdup(gettext_noop("Click to make ripples appear over your picture.")));
|
return(strdup(gettext_noop("Click to make ripples appear over your picture.")));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Affect the canvas on drag:
|
// Affect the canvas on drag:
|
||||||
void ripples_drag(magic_api * api, int which, SDL_Surface * canvas,
|
void ripples_drag(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED,
|
||||||
SDL_Surface * last, int ox, int oy, int x, int y,
|
SDL_Surface * last ATTRIBUTE_UNUSED, int ox ATTRIBUTE_UNUSED, int oy ATTRIBUTE_UNUSED, int x ATTRIBUTE_UNUSED, int y ATTRIBUTE_UNUSED,
|
||||||
SDL_Rect * update_rect)
|
SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ripples_linecb(void * ptr, int which,
|
static void ripples_linecb(void * ptr, int which ATTRIBUTE_UNUSED,
|
||||||
SDL_Surface * canvas, SDL_Surface * last,
|
SDL_Surface * canvas, SDL_Surface * last,
|
||||||
int x, int y)
|
int x, int y)
|
||||||
{
|
{
|
||||||
|
|
@ -113,7 +138,7 @@ static void ripples_linecb(void * ptr, int which,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Affect the canvas on click:
|
// Affect the canvas on click:
|
||||||
void ripples_click(magic_api * api, int which, int mode,
|
void ripples_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED,
|
||||||
SDL_Surface * canvas, SDL_Surface * last,
|
SDL_Surface * canvas, SDL_Surface * last,
|
||||||
int x, int y, SDL_Rect * update_rect)
|
int x, int y, SDL_Rect * update_rect)
|
||||||
{
|
{
|
||||||
|
|
@ -153,39 +178,39 @@ void ripples_click(magic_api * api, int which, int mode,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Affect the canvas on release:
|
// Affect the canvas on release:
|
||||||
void ripples_release(magic_api * api, int which,
|
void ripples_release(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
|
||||||
SDL_Surface * canvas, SDL_Surface * last,
|
SDL_Surface * canvas ATTRIBUTE_UNUSED, SDL_Surface * last ATTRIBUTE_UNUSED,
|
||||||
int x, int y, SDL_Rect * update_rect)
|
int x ATTRIBUTE_UNUSED, int y ATTRIBUTE_UNUSED, SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// No setup happened:
|
// No setup happened:
|
||||||
void ripples_shutdown(magic_api * api)
|
void ripples_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
if (ripples_snd != NULL)
|
if (ripples_snd != NULL)
|
||||||
Mix_FreeChunk(ripples_snd);
|
Mix_FreeChunk(ripples_snd);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Record the color from Tux Paint:
|
// Record the color from Tux Paint:
|
||||||
void ripples_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b)
|
void ripples_set_color(magic_api * api ATTRIBUTE_UNUSED, Uint8 r ATTRIBUTE_UNUSED, Uint8 g ATTRIBUTE_UNUSED, Uint8 b ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use colors:
|
// Use colors:
|
||||||
int ripples_requires_colors(magic_api * api, int which)
|
int ripples_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ripples_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
void ripples_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void ripples_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
void ripples_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int ripples_modes(magic_api * api, int which)
|
int ripples_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
return(MODE_ONECLICK);
|
return(MODE_ONECLICK);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,16 +48,39 @@ Mix_Chunk * rosette_snd;
|
||||||
|
|
||||||
// Housekeeping functions
|
// Housekeeping functions
|
||||||
|
|
||||||
|
Uint32 rosette_api_version(void);
|
||||||
|
void rosette_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b);
|
||||||
|
int rosette_init(magic_api * api);
|
||||||
|
int rosette_get_tool_count(magic_api * api);
|
||||||
|
SDL_Surface * rosette_get_icon(magic_api * api, int which);
|
||||||
|
char * rosette_get_name(magic_api * api, int which);
|
||||||
|
char * rosette_get_description(magic_api * api, int which, int mode);
|
||||||
|
int rosette_requires_colors(magic_api * api, int which);
|
||||||
|
void rosette_release(magic_api * api, int which,
|
||||||
|
SDL_Surface * canvas, SDL_Surface * snapshot,
|
||||||
|
int x, int y, SDL_Rect * update_rect);
|
||||||
|
void rosette_shutdown(magic_api * api);
|
||||||
|
void rosette_draw(void * ptr, int which, SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y);
|
||||||
void rosette_drag(magic_api * api, int which, SDL_Surface * canvas,
|
void rosette_drag(magic_api * api, int which, SDL_Surface * canvas,
|
||||||
SDL_Surface * snapshot, int ox, int oy, int x, int y,
|
SDL_Surface * snapshot, int ox, int oy, int x, int y,
|
||||||
SDL_Rect * update_rect);
|
SDL_Rect * update_rect);
|
||||||
|
|
||||||
|
void rosette_click(magic_api * api, int which, int mode,
|
||||||
|
SDL_Surface * canvas, SDL_Surface * last,
|
||||||
|
int x, int y, SDL_Rect * update_rect);
|
||||||
|
void rosette_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||||
|
void rosette_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||||
|
int rosette_modes(magic_api * api, int which);
|
||||||
|
void rosette_circle(void * ptr, int which,
|
||||||
|
SDL_Surface * canvas, SDL_Surface * snapshot,
|
||||||
|
int x, int y);
|
||||||
|
|
||||||
Uint32 rosette_api_version(void)
|
Uint32 rosette_api_version(void)
|
||||||
{
|
{
|
||||||
return(TP_MAGIC_API_VERSION);
|
return(TP_MAGIC_API_VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
void rosette_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b) //get the colors from API and store it in structure
|
void rosette_set_color(magic_api * api ATTRIBUTE_UNUSED, Uint8 r, Uint8 g, Uint8 b) //get the colors from API and store it in structure
|
||||||
{
|
{
|
||||||
rosette_colors.r=r;
|
rosette_colors.r=r;
|
||||||
rosette_colors.g=g;
|
rosette_colors.g=g;
|
||||||
|
|
@ -74,7 +97,7 @@ int rosette_init(magic_api * api)
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int rosette_get_tool_count(magic_api * api)
|
int rosette_get_tool_count(magic_api * api ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
@ -90,9 +113,9 @@ SDL_Surface * rosette_get_icon(magic_api * api, int which)
|
||||||
return(IMG_Load(fname));
|
return(IMG_Load(fname));
|
||||||
}
|
}
|
||||||
|
|
||||||
char * rosette_get_name(magic_api * api, int which) { if (!which) return strdup(gettext_noop("Rosette")); else return strdup(gettext_noop("Picasso"));}
|
char * rosette_get_name(magic_api * api ATTRIBUTE_UNUSED, int which) { if (!which) return strdup(gettext_noop("Rosette")); else return strdup(gettext_noop("Picasso"));}
|
||||||
|
|
||||||
char * rosette_get_description(magic_api * api, int which, int mode)
|
char * rosette_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
if (!which)
|
if (!which)
|
||||||
return strdup(gettext_noop("Click and start drawing your rosette.")); //just k'scope with 3 bits?
|
return strdup(gettext_noop("Click and start drawing your rosette.")); //just k'scope with 3 bits?
|
||||||
|
|
@ -100,20 +123,20 @@ char * rosette_get_description(magic_api * api, int which, int mode)
|
||||||
return strdup(gettext_noop("You can draw just like Picasso!")); //what is this actually doing?
|
return strdup(gettext_noop("You can draw just like Picasso!")); //what is this actually doing?
|
||||||
}
|
}
|
||||||
|
|
||||||
int rosette_requires_colors(magic_api * api, int which) { return 1; }
|
int rosette_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED) { return 1; }
|
||||||
|
|
||||||
void rosette_release(magic_api * api, int which,
|
void rosette_release(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
|
||||||
SDL_Surface * canvas, SDL_Surface * snapshot,
|
SDL_Surface * canvas ATTRIBUTE_UNUSED, SDL_Surface * snapshot ATTRIBUTE_UNUSED,
|
||||||
int x, int y, SDL_Rect * update_rect)
|
int x ATTRIBUTE_UNUSED, int y ATTRIBUTE_UNUSED, SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void rosette_shutdown(magic_api * api)
|
void rosette_shutdown(magic_api * api ATTRIBUTE_UNUSED) { Mix_FreeChunk(rosette_snd); }
|
||||||
{ Mix_FreeChunk(rosette_snd); }
|
|
||||||
|
|
||||||
// Interactivity functions
|
// Interactivity functions
|
||||||
|
|
||||||
void rosette_circle(void * ptr, int which,
|
void rosette_circle(void * ptr, int which ATTRIBUTE_UNUSED,
|
||||||
SDL_Surface * canvas, SDL_Surface * snapshot,
|
SDL_Surface * canvas, SDL_Surface * snapshot ATTRIBUTE_UNUSED,
|
||||||
int x, int y)
|
int x, int y)
|
||||||
{
|
{
|
||||||
magic_api * api = (magic_api *) ptr;
|
magic_api * api = (magic_api *) ptr;
|
||||||
|
|
@ -131,7 +154,7 @@ void rosette_draw(void * ptr, int which, SDL_Surface * canvas, SDL_Surface * sna
|
||||||
{
|
{
|
||||||
magic_api * api = (magic_api *) ptr;
|
magic_api * api = (magic_api *) ptr;
|
||||||
|
|
||||||
double angle, angle_ph;
|
double angle;
|
||||||
double xx, yy; //distance to the center of the image
|
double xx, yy; //distance to the center of the image
|
||||||
int x1, y1, x2, y2;
|
int x1, y1, x2, y2;
|
||||||
|
|
||||||
|
|
@ -184,25 +207,25 @@ void rosette_drag(magic_api * api, int which, SDL_Surface * canvas,
|
||||||
update_rect->h=canvas->h;
|
update_rect->h=canvas->h;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rosette_click(magic_api * api, int which, int mode,
|
void rosette_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED,
|
||||||
SDL_Surface * canvas, SDL_Surface * last,
|
SDL_Surface * canvas, SDL_Surface * last,
|
||||||
int x, int y, SDL_Rect * update_rect)
|
int x, int y, SDL_Rect * update_rect)
|
||||||
{
|
{
|
||||||
rosette_drag(api, which, canvas, last, x, y, x, y, update_rect);
|
rosette_drag(api, which, canvas, last, x, y, x, y, update_rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
void rosette_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
void rosette_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
xmid=canvas->w/2;
|
xmid=canvas->w/2;
|
||||||
ymid=canvas->h/2;
|
ymid=canvas->h/2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rosette_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
void rosette_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int rosette_modes(magic_api * api, int which)
|
int rosette_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
return(MODE_PAINT);
|
return(MODE_PAINT);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue