indent waves.c
This commit is contained in:
parent
cc7dd8e3c9
commit
5a88d476c8
1 changed files with 80 additions and 72 deletions
|
|
@ -45,14 +45,11 @@ SDL_Surface * waves_get_icon(magic_api * api, int which);
|
||||||
char *waves_get_name(magic_api * api, int which);
|
char *waves_get_name(magic_api * api, int which);
|
||||||
char *waves_get_description(magic_api * api, int which, int mode);
|
char *waves_get_description(magic_api * api, int which, int mode);
|
||||||
void waves_drag(magic_api * api, int which, SDL_Surface * canvas,
|
void waves_drag(magic_api * api, int which, SDL_Surface * canvas,
|
||||||
SDL_Surface * last, int ox, int oy, int x, int y,
|
SDL_Surface * last, int ox, int oy, int x, int y, SDL_Rect * update_rect);
|
||||||
SDL_Rect * update_rect);
|
|
||||||
void waves_click(magic_api * api, int which, int mode,
|
void waves_click(magic_api * api, int which, int mode,
|
||||||
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);
|
|
||||||
void waves_release(magic_api * api, int which,
|
void waves_release(magic_api * api, int which,
|
||||||
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);
|
|
||||||
void waves_shutdown(magic_api * api);
|
void waves_shutdown(magic_api * api);
|
||||||
void waves_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b);
|
void waves_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b);
|
||||||
int waves_requires_colors(magic_api * api, int which);
|
int waves_requires_colors(magic_api * api, int which);
|
||||||
|
|
@ -60,7 +57,10 @@ void waves_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||||
void waves_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
void waves_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||||
int waves_modes(magic_api * api, int which);
|
int waves_modes(magic_api * api, int which);
|
||||||
|
|
||||||
Uint32 waves_api_version(void) { return(TP_MAGIC_API_VERSION); }
|
Uint32 waves_api_version(void)
|
||||||
|
{
|
||||||
|
return (TP_MAGIC_API_VERSION);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// No setup required:
|
// No setup required:
|
||||||
|
|
@ -68,12 +68,10 @@ int waves_init(magic_api * api)
|
||||||
{
|
{
|
||||||
char fname[1024];
|
char fname[1024];
|
||||||
|
|
||||||
snprintf(fname, sizeof(fname), "%s/sounds/magic/waves.ogg",
|
snprintf(fname, sizeof(fname), "%s/sounds/magic/waves.ogg", api->data_directory);
|
||||||
api->data_directory);
|
|
||||||
waves_snd[0] = Mix_LoadWAV(fname);
|
waves_snd[0] = Mix_LoadWAV(fname);
|
||||||
|
|
||||||
snprintf(fname, sizeof(fname), "%s/sounds/magic/wavelet.ogg",
|
snprintf(fname, sizeof(fname), "%s/sounds/magic/wavelet.ogg", api->data_directory);
|
||||||
api->data_directory);
|
|
||||||
waves_snd[1] = Mix_LoadWAV(fname);
|
waves_snd[1] = Mix_LoadWAV(fname);
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -91,8 +89,10 @@ SDL_Surface * waves_get_icon(magic_api * api, int which)
|
||||||
{
|
{
|
||||||
char fname[1024];
|
char fname[1024];
|
||||||
|
|
||||||
if (!which) snprintf(fname, sizeof(fname), "%s/images/magic/waves.png", api->data_directory);
|
if (!which)
|
||||||
else snprintf(fname, sizeof(fname), "%s/images/magic/wavelet.png", api->data_directory);
|
snprintf(fname, sizeof(fname), "%s/images/magic/waves.png", api->data_directory);
|
||||||
|
else
|
||||||
|
snprintf(fname, sizeof(fname), "%s/images/magic/wavelet.png", api->data_directory);
|
||||||
|
|
||||||
return (IMG_Load(fname));
|
return (IMG_Load(fname));
|
||||||
}
|
}
|
||||||
|
|
@ -100,16 +100,22 @@ SDL_Surface * waves_get_icon(magic_api * api, int which)
|
||||||
// Return our names, localized:
|
// Return our names, localized:
|
||||||
char *waves_get_name(magic_api * api ATTRIBUTE_UNUSED, int which)
|
char *waves_get_name(magic_api * api ATTRIBUTE_UNUSED, int which)
|
||||||
{
|
{
|
||||||
if (!which) return(strdup(gettext_noop("Waves")));
|
if (!which)
|
||||||
else return strdup(gettext_noop("Wavelets"));
|
return (strdup(gettext_noop("Waves")));
|
||||||
|
else
|
||||||
|
return strdup(gettext_noop("Wavelets"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return our descriptions, localized:
|
// Return our descriptions, localized:
|
||||||
char *waves_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode ATTRIBUTE_UNUSED)
|
char *waves_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
if (!which)
|
if (!which)
|
||||||
return(strdup(gettext_noop("Click to make the picture horizontally wavy. Click toward the top for shorter waves, the bottom for taller waves, the left for small waves, and the right for long waves.")));
|
return (strdup
|
||||||
return strdup(gettext_noop("Click to make the picture vertically wavy. Click toward the top for shorter waves, the bottom for taller waves, the left for small waves, and the right for long waves."));
|
(gettext_noop
|
||||||
|
("Click to make the picture horizontally wavy. Click toward the top for shorter waves, the bottom for taller waves, the left for small waves, and the right for long waves.")));
|
||||||
|
return
|
||||||
|
strdup(gettext_noop
|
||||||
|
("Click to make the picture vertically wavy. Click toward the top for shorter waves, the bottom for taller waves, the left for small waves, and the right for long waves."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -173,8 +179,7 @@ void waves_drag(magic_api * api ATTRIBUTE_UNUSED, int which, SDL_Surface * canva
|
||||||
|
|
||||||
// Affect the canvas on click:
|
// Affect the canvas on click:
|
||||||
void waves_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED,
|
void waves_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)
|
|
||||||
{
|
{
|
||||||
waves_drag(api, which, canvas, last, x, y, x, y, update_rect);
|
waves_drag(api, which, canvas, last, x, y, x, y, update_rect);
|
||||||
api->playsound(waves_snd[which], 128, 255);
|
api->playsound(waves_snd[which], 128, 255);
|
||||||
|
|
@ -197,7 +202,8 @@ void waves_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Record the color from Tux Paint:
|
// Record the color from Tux Paint:
|
||||||
void waves_set_color(magic_api * api ATTRIBUTE_UNUSED, Uint8 r ATTRIBUTE_UNUSED, Uint8 g ATTRIBUTE_UNUSED, Uint8 b ATTRIBUTE_UNUSED)
|
void waves_set_color(magic_api * api ATTRIBUTE_UNUSED, Uint8 r ATTRIBUTE_UNUSED, Uint8 g ATTRIBUTE_UNUSED,
|
||||||
|
Uint8 b ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -207,11 +213,13 @@ int waves_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void waves_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
void waves_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
|
||||||
|
SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void waves_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
void waves_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
|
||||||
|
SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue