Syncing tp_magic_example.c (indent & transliteration)

This commit is contained in:
Bill Kendrick 2024-05-10 01:29:05 -07:00
parent bd10e955a1
commit 51d47d554e
14 changed files with 2058 additions and 1988 deletions

View file

@ -144,7 +144,8 @@ released, aka deallocated) when the user quits Tux Paint, when our
example_shutdown() function is called.
*/
int example_init(magic_api * api, Uint8 disabled_features, Uint8 complexity_level)
int example_init(magic_api * api, Uint8 disabled_features,
Uint8 complexity_level)
{
int i;
char filename[1024];
@ -159,8 +160,8 @@ int example_init(magic_api * api, Uint8 disabled_features, Uint8 complexity_leve
"tp-magic-config --dataprefix" command would have told us when we installed
our plugin and its data.)
*/
snprintf(filename, sizeof(filename), "%ssounds/magic/%s", api->data_directory,
sound_filenames[i]);
snprintf(filename, sizeof(filename), "%ssounds/magic/%s",
api->data_directory, sound_filenames[i]);
printf("Trying to load %s sound file\n", filename);
@ -420,8 +421,7 @@ example_click(magic_api * api, int which, int mode,
void
example_drag(magic_api * api, int which,
SDL_Surface * canvas, SDL_Surface * snapshot,
int old_x, int old_y, int x, int y,
SDL_Rect * update_rect)
int old_x, int old_y, int x, int y, SDL_Rect * update_rect)
{
/*
Call Tux Paint's "line()" (line-traversing) function.
@ -436,8 +436,7 @@ example_drag(magic_api * api, int which,
SDL_LockSurface(canvas);
api->line((void *) api, which, canvas, snapshot,
old_x, old_y, x, y, 1,
example_line_callback);
old_x, old_y, x, y, 1, example_line_callback);
SDL_UnlockSurface(canvas);
SDL_UnlockSurface(snapshot);
@ -471,12 +470,15 @@ example_drag(magic_api * api, int which,
canvas has been modified and should be updated.
*/
if (which == TOOL_ONE) {
if (which == TOOL_ONE)
{
update_rect->x = old_x;
update_rect->y = old_y;
update_rect->w = (x - old_x) + 1;
update_rect->h = (y - old_y) + 1;
} else {
}
else
{
update_rect->x = old_x - example_size;
update_rect->y = old_y - example_size;
update_rect->w = (x + example_size) - update_rect->x + 1;
@ -494,9 +496,8 @@ example_drag(magic_api * api, int which,
what speaker to play the sound in. (So the sound will pan from speaker
to speaker as you drag the mouse around the canvas!)
*/
api->playsound(sound_effects[which],
(x * 255) / canvas->w, /* Left/right pan */
255 /* Near/far distance (loudness) */);
api->playsound(sound_effects[which], (x * 255) / canvas->w, /* Left/right pan */
255 /* Near/far distance (loudness) */ );
}
@ -526,7 +527,9 @@ changes their chosen, we'll be informed of that as well.
The color comes in as RGB (red, green, and blue) values from 0 (darkest) to
255 (brightest).
*/
void example_set_color(magic_api * api, int which, SDL_Surface * canvas, SDL_Surface * snapshot, Uint8 r, Uint8 g, Uint8 b, SDL_Rect * update_rect)
void example_set_color(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * snapshot, Uint8 r, Uint8 g, Uint8 b,
SDL_Rect * update_rect)
{
/*
We simply store the RGB values in the global variables we declared at
@ -551,7 +554,9 @@ that as well.
The size comes in as an unsigned integer (Uint8) between 1 and the value
returned by our example_accepted_sizes() function during setup.
*/
void example_set_size(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * snapshot, Uint8 size, SDL_Rect * update_rect)
void example_set_size(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * snapshot,
Uint8 size, SDL_Rect * update_rect)
{
/*
Store the new size into the global variable we declared at the top of

View file

@ -144,7 +144,8 @@ released, aka deallocated) when the user quits Tux Paint, when our
example_shutdown() function is called.
*/
int example_init(magic_api * api, Uint8 disabled_features, Uint8 complexity_level)
int example_init(magic_api * api, Uint8 disabled_features,
Uint8 complexity_level)
{
int i;
char filename[1024];
@ -159,8 +160,8 @@ int example_init(magic_api * api, Uint8 disabled_features, Uint8 complexity_leve
"tp-magic-config --dataprefix" command would have told us when we installed
our plugin and its data.)
*/
snprintf(filename, sizeof(filename), "%ssounds/magic/%s", api->data_directory,
sound_filenames[i]);
snprintf(filename, sizeof(filename), "%ssounds/magic/%s",
api->data_directory, sound_filenames[i]);
printf("Trying to load %s sound file\n", filename);
@ -420,8 +421,7 @@ example_click(magic_api * api, int which, int mode,
void
example_drag(magic_api * api, int which,
SDL_Surface * canvas, SDL_Surface * snapshot,
int old_x, int old_y, int x, int y,
SDL_Rect * update_rect)
int old_x, int old_y, int x, int y, SDL_Rect * update_rect)
{
/*
Call Tux Paint's "line()" (line-traversing) function.
@ -436,8 +436,7 @@ example_drag(magic_api * api, int which,
SDL_LockSurface(canvas);
api->line((void *) api, which, canvas, snapshot,
old_x, old_y, x, y, 1,
example_line_callback);
old_x, old_y, x, y, 1, example_line_callback);
SDL_UnlockSurface(canvas);
SDL_UnlockSurface(snapshot);
@ -471,12 +470,15 @@ example_drag(magic_api * api, int which,
canvas has been modified and should be updated.
*/
if (which == TOOL_ONE) {
if (which == TOOL_ONE)
{
update_rect->x = old_x;
update_rect->y = old_y;
update_rect->w = (x - old_x) + 1;
update_rect->h = (y - old_y) + 1;
} else {
}
else
{
update_rect->x = old_x - example_size;
update_rect->y = old_y - example_size;
update_rect->w = (x + example_size) - update_rect->x + 1;
@ -494,9 +496,8 @@ example_drag(magic_api * api, int which,
what speaker to play the sound in. (So the sound will pan from speaker
to speaker as you drag the mouse around the canvas!)
*/
api->playsound(sound_effects[which],
(x * 255) / canvas->w, /* Left/right pan */
255 /* Near/far distance (loudness) */);
api->playsound(sound_effects[which], (x * 255) / canvas->w, /* Left/right pan */
255 /* Near/far distance (loudness) */ );
}
@ -526,7 +527,9 @@ changes their chosen, we'll be informed of that as well.
The color comes in as RGB (red, green, and blue) values from 0 (darkest) to
255 (brightest).
*/
void example_set_color(magic_api * api, int which, SDL_Surface * canvas, SDL_Surface * snapshot, Uint8 r, Uint8 g, Uint8 b, SDL_Rect * update_rect)
void example_set_color(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * snapshot, Uint8 r, Uint8 g, Uint8 b,
SDL_Rect * update_rect)
{
/*
We simply store the RGB values in the global variables we declared at
@ -551,7 +554,9 @@ that as well.
The size comes in as an unsigned integer (Uint8) between 1 and the value
returned by our example_accepted_sizes() function during setup.
*/
void example_set_size(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * snapshot, Uint8 size, SDL_Rect * update_rect)
void example_set_size(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * snapshot,
Uint8 size, SDL_Rect * update_rect)
{
/*
Store the new size into the global variable we declared at the top of

View file

@ -144,7 +144,8 @@ released, aka deallocated) when the user quits Tux Paint, when our
example_shutdown() function is called.
*/
int example_init(magic_api * api, Uint8 disabled_features, Uint8 complexity_level)
int example_init(magic_api * api, Uint8 disabled_features,
Uint8 complexity_level)
{
int i;
char filename[1024];
@ -159,8 +160,8 @@ int example_init(magic_api * api, Uint8 disabled_features, Uint8 complexity_leve
"tp-magic-config --dataprefix" command would have told us when we installed
our plugin and its data.)
*/
snprintf(filename, sizeof(filename), "%ssounds/magic/%s", api->data_directory,
sound_filenames[i]);
snprintf(filename, sizeof(filename), "%ssounds/magic/%s",
api->data_directory, sound_filenames[i]);
printf("Trying to load %s sound file\n", filename);
@ -420,8 +421,7 @@ example_click(magic_api * api, int which, int mode,
void
example_drag(magic_api * api, int which,
SDL_Surface * canvas, SDL_Surface * snapshot,
int old_x, int old_y, int x, int y,
SDL_Rect * update_rect)
int old_x, int old_y, int x, int y, SDL_Rect * update_rect)
{
/*
Call Tux Paint's "line()" (line-traversing) function.
@ -436,8 +436,7 @@ example_drag(magic_api * api, int which,
SDL_LockSurface(canvas);
api->line((void *) api, which, canvas, snapshot,
old_x, old_y, x, y, 1,
example_line_callback);
old_x, old_y, x, y, 1, example_line_callback);
SDL_UnlockSurface(canvas);
SDL_UnlockSurface(snapshot);
@ -471,12 +470,15 @@ example_drag(magic_api * api, int which,
canvas has been modified and should be updated.
*/
if (which == TOOL_ONE) {
if (which == TOOL_ONE)
{
update_rect->x = old_x;
update_rect->y = old_y;
update_rect->w = (x - old_x) + 1;
update_rect->h = (y - old_y) + 1;
} else {
}
else
{
update_rect->x = old_x - example_size;
update_rect->y = old_y - example_size;
update_rect->w = (x + example_size) - update_rect->x + 1;
@ -494,9 +496,8 @@ example_drag(magic_api * api, int which,
what speaker to play the sound in. (So the sound will pan from speaker
to speaker as you drag the mouse around the canvas!)
*/
api->playsound(sound_effects[which],
(x * 255) / canvas->w, /* Left/right pan */
255 /* Near/far distance (loudness) */);
api->playsound(sound_effects[which], (x * 255) / canvas->w, /* Left/right pan */
255 /* Near/far distance (loudness) */ );
}
@ -526,7 +527,9 @@ changes their chosen, we'll be informed of that as well.
The color comes in as RGB (red, green, and blue) values from 0 (darkest) to
255 (brightest).
*/
void example_set_color(magic_api * api, int which, SDL_Surface * canvas, SDL_Surface * snapshot, Uint8 r, Uint8 g, Uint8 b, SDL_Rect * update_rect)
void example_set_color(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * snapshot, Uint8 r, Uint8 g, Uint8 b,
SDL_Rect * update_rect)
{
/*
We simply store the RGB values in the global variables we declared at
@ -551,7 +554,9 @@ that as well.
The size comes in as an unsigned integer (Uint8) between 1 and the value
returned by our example_accepted_sizes() function during setup.
*/
void example_set_size(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * snapshot, Uint8 size, SDL_Rect * update_rect)
void example_set_size(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * snapshot,
Uint8 size, SDL_Rect * update_rect)
{
/*
Store the new size into the global variable we declared at the top of

View file

@ -144,7 +144,8 @@ released, aka deallocated) when the user quits Tux Paint, when our
example_shutdown() function is called.
*/
int example_init(magic_api * api, Uint8 disabled_features, Uint8 complexity_level)
int example_init(magic_api * api, Uint8 disabled_features,
Uint8 complexity_level)
{
int i;
char filename[1024];
@ -159,8 +160,8 @@ int example_init(magic_api * api, Uint8 disabled_features, Uint8 complexity_leve
"tp-magic-config --dataprefix" command would have told us when we installed
our plugin and its data.)
*/
snprintf(filename, sizeof(filename), "%ssounds/magic/%s", api->data_directory,
sound_filenames[i]);
snprintf(filename, sizeof(filename), "%ssounds/magic/%s",
api->data_directory, sound_filenames[i]);
printf("Trying to load %s sound file\n", filename);
@ -420,8 +421,7 @@ example_click(magic_api * api, int which, int mode,
void
example_drag(magic_api * api, int which,
SDL_Surface * canvas, SDL_Surface * snapshot,
int old_x, int old_y, int x, int y,
SDL_Rect * update_rect)
int old_x, int old_y, int x, int y, SDL_Rect * update_rect)
{
/*
Call Tux Paint's "line()" (line-traversing) function.
@ -436,8 +436,7 @@ example_drag(magic_api * api, int which,
SDL_LockSurface(canvas);
api->line((void *) api, which, canvas, snapshot,
old_x, old_y, x, y, 1,
example_line_callback);
old_x, old_y, x, y, 1, example_line_callback);
SDL_UnlockSurface(canvas);
SDL_UnlockSurface(snapshot);
@ -471,12 +470,15 @@ example_drag(magic_api * api, int which,
canvas has been modified and should be updated.
*/
if (which == TOOL_ONE) {
if (which == TOOL_ONE)
{
update_rect->x = old_x;
update_rect->y = old_y;
update_rect->w = (x - old_x) + 1;
update_rect->h = (y - old_y) + 1;
} else {
}
else
{
update_rect->x = old_x - example_size;
update_rect->y = old_y - example_size;
update_rect->w = (x + example_size) - update_rect->x + 1;
@ -494,9 +496,8 @@ example_drag(magic_api * api, int which,
what speaker to play the sound in. (So the sound will pan from speaker
to speaker as you drag the mouse around the canvas!)
*/
api->playsound(sound_effects[which],
(x * 255) / canvas->w, /* Left/right pan */
255 /* Near/far distance (loudness) */);
api->playsound(sound_effects[which], (x * 255) / canvas->w, /* Left/right pan */
255 /* Near/far distance (loudness) */ );
}
@ -526,7 +527,9 @@ changes their chosen, we'll be informed of that as well.
The color comes in as RGB (red, green, and blue) values from 0 (darkest) to
255 (brightest).
*/
void example_set_color(magic_api * api, int which, SDL_Surface * canvas, SDL_Surface * snapshot, Uint8 r, Uint8 g, Uint8 b, SDL_Rect * update_rect)
void example_set_color(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * snapshot, Uint8 r, Uint8 g, Uint8 b,
SDL_Rect * update_rect)
{
/*
We simply store the RGB values in the global variables we declared at
@ -551,7 +554,9 @@ that as well.
The size comes in as an unsigned integer (Uint8) between 1 and the value
returned by our example_accepted_sizes() function during setup.
*/
void example_set_size(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * snapshot, Uint8 size, SDL_Rect * update_rect)
void example_set_size(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * snapshot,
Uint8 size, SDL_Rect * update_rect)
{
/*
Store the new size into the global variable we declared at the top of

View file

@ -144,7 +144,8 @@ released, aka deallocated) when the user quits Tux Paint, when our
example_shutdown() function is called.
*/
int example_init(magic_api * api, Uint8 disabled_features, Uint8 complexity_level)
int example_init(magic_api * api, Uint8 disabled_features,
Uint8 complexity_level)
{
int i;
char filename[1024];
@ -159,8 +160,8 @@ int example_init(magic_api * api, Uint8 disabled_features, Uint8 complexity_leve
"tp-magic-config --dataprefix" command would have told us when we installed
our plugin and its data.)
*/
snprintf(filename, sizeof(filename), "%ssounds/magic/%s", api->data_directory,
sound_filenames[i]);
snprintf(filename, sizeof(filename), "%ssounds/magic/%s",
api->data_directory, sound_filenames[i]);
printf("Trying to load %s sound file\n", filename);
@ -420,8 +421,7 @@ example_click(magic_api * api, int which, int mode,
void
example_drag(magic_api * api, int which,
SDL_Surface * canvas, SDL_Surface * snapshot,
int old_x, int old_y, int x, int y,
SDL_Rect * update_rect)
int old_x, int old_y, int x, int y, SDL_Rect * update_rect)
{
/*
Call Tux Paint's "line()" (line-traversing) function.
@ -436,8 +436,7 @@ example_drag(magic_api * api, int which,
SDL_LockSurface(canvas);
api->line((void *) api, which, canvas, snapshot,
old_x, old_y, x, y, 1,
example_line_callback);
old_x, old_y, x, y, 1, example_line_callback);
SDL_UnlockSurface(canvas);
SDL_UnlockSurface(snapshot);
@ -471,12 +470,15 @@ example_drag(magic_api * api, int which,
canvas has been modified and should be updated.
*/
if (which == TOOL_ONE) {
if (which == TOOL_ONE)
{
update_rect->x = old_x;
update_rect->y = old_y;
update_rect->w = (x - old_x) + 1;
update_rect->h = (y - old_y) + 1;
} else {
}
else
{
update_rect->x = old_x - example_size;
update_rect->y = old_y - example_size;
update_rect->w = (x + example_size) - update_rect->x + 1;
@ -494,9 +496,8 @@ example_drag(magic_api * api, int which,
what speaker to play the sound in. (So the sound will pan from speaker
to speaker as you drag the mouse around the canvas!)
*/
api->playsound(sound_effects[which],
(x * 255) / canvas->w, /* Left/right pan */
255 /* Near/far distance (loudness) */);
api->playsound(sound_effects[which], (x * 255) / canvas->w, /* Left/right pan */
255 /* Near/far distance (loudness) */ );
}
@ -526,7 +527,9 @@ changes their chosen, we'll be informed of that as well.
The color comes in as RGB (red, green, and blue) values from 0 (darkest) to
255 (brightest).
*/
void example_set_color(magic_api * api, int which, SDL_Surface * canvas, SDL_Surface * snapshot, Uint8 r, Uint8 g, Uint8 b, SDL_Rect * update_rect)
void example_set_color(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * snapshot, Uint8 r, Uint8 g, Uint8 b,
SDL_Rect * update_rect)
{
/*
We simply store the RGB values in the global variables we declared at
@ -551,7 +554,9 @@ that as well.
The size comes in as an unsigned integer (Uint8) between 1 and the value
returned by our example_accepted_sizes() function during setup.
*/
void example_set_size(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * snapshot, Uint8 size, SDL_Rect * update_rect)
void example_set_size(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * snapshot,
Uint8 size, SDL_Rect * update_rect)
{
/*
Store the new size into the global variable we declared at the top of

View file

@ -144,7 +144,8 @@ released, aka deallocated) when the user quits Tux Paint, when our
example_shutdown() function is called.
*/
int example_init(magic_api * api, Uint8 disabled_features, Uint8 complexity_level)
int example_init(magic_api * api, Uint8 disabled_features,
Uint8 complexity_level)
{
int i;
char filename[1024];
@ -159,8 +160,8 @@ int example_init(magic_api * api, Uint8 disabled_features, Uint8 complexity_leve
"tp-magic-config --dataprefix" command would have told us when we installed
our plugin and its data.)
*/
snprintf(filename, sizeof(filename), "%ssounds/magic/%s", api->data_directory,
sound_filenames[i]);
snprintf(filename, sizeof(filename), "%ssounds/magic/%s",
api->data_directory, sound_filenames[i]);
printf("Trying to load %s sound file\n", filename);
@ -420,8 +421,7 @@ example_click(magic_api * api, int which, int mode,
void
example_drag(magic_api * api, int which,
SDL_Surface * canvas, SDL_Surface * snapshot,
int old_x, int old_y, int x, int y,
SDL_Rect * update_rect)
int old_x, int old_y, int x, int y, SDL_Rect * update_rect)
{
/*
Call Tux Paint's "line()" (line-traversing) function.
@ -436,8 +436,7 @@ example_drag(magic_api * api, int which,
SDL_LockSurface(canvas);
api->line((void *) api, which, canvas, snapshot,
old_x, old_y, x, y, 1,
example_line_callback);
old_x, old_y, x, y, 1, example_line_callback);
SDL_UnlockSurface(canvas);
SDL_UnlockSurface(snapshot);
@ -471,12 +470,15 @@ example_drag(magic_api * api, int which,
canvas has been modified and should be updated.
*/
if (which == TOOL_ONE) {
if (which == TOOL_ONE)
{
update_rect->x = old_x;
update_rect->y = old_y;
update_rect->w = (x - old_x) + 1;
update_rect->h = (y - old_y) + 1;
} else {
}
else
{
update_rect->x = old_x - example_size;
update_rect->y = old_y - example_size;
update_rect->w = (x + example_size) - update_rect->x + 1;
@ -494,9 +496,8 @@ example_drag(magic_api * api, int which,
what speaker to play the sound in. (So the sound will pan from speaker
to speaker as you drag the mouse around the canvas!)
*/
api->playsound(sound_effects[which],
(x * 255) / canvas->w, /* Left/right pan */
255 /* Near/far distance (loudness) */);
api->playsound(sound_effects[which], (x * 255) / canvas->w, /* Left/right pan */
255 /* Near/far distance (loudness) */ );
}
@ -526,7 +527,9 @@ changes their chosen, we'll be informed of that as well.
The color comes in as RGB (red, green, and blue) values from 0 (darkest) to
255 (brightest).
*/
void example_set_color(magic_api * api, int which, SDL_Surface * canvas, SDL_Surface * snapshot, Uint8 r, Uint8 g, Uint8 b, SDL_Rect * update_rect)
void example_set_color(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * snapshot, Uint8 r, Uint8 g, Uint8 b,
SDL_Rect * update_rect)
{
/*
We simply store the RGB values in the global variables we declared at
@ -551,7 +554,9 @@ that as well.
The size comes in as an unsigned integer (Uint8) between 1 and the value
returned by our example_accepted_sizes() function during setup.
*/
void example_set_size(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * snapshot, Uint8 size, SDL_Rect * update_rect)
void example_set_size(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * snapshot,
Uint8 size, SDL_Rect * update_rect)
{
/*
Store the new size into the global variable we declared at the top of

View file

@ -144,7 +144,8 @@ released, aka deallocated) when the user quits Tux Paint, when our
example_shutdown() function is called.
*/
int example_init(magic_api * api, Uint8 disabled_features, Uint8 complexity_level)
int example_init(magic_api * api, Uint8 disabled_features,
Uint8 complexity_level)
{
int i;
char filename[1024];
@ -159,8 +160,8 @@ int example_init(magic_api * api, Uint8 disabled_features, Uint8 complexity_leve
"tp-magic-config --dataprefix" command would have told us when we installed
our plugin and its data.)
*/
snprintf(filename, sizeof(filename), "%ssounds/magic/%s", api->data_directory,
sound_filenames[i]);
snprintf(filename, sizeof(filename), "%ssounds/magic/%s",
api->data_directory, sound_filenames[i]);
printf("Trying to load %s sound file\n", filename);
@ -420,8 +421,7 @@ example_click(magic_api * api, int which, int mode,
void
example_drag(magic_api * api, int which,
SDL_Surface * canvas, SDL_Surface * snapshot,
int old_x, int old_y, int x, int y,
SDL_Rect * update_rect)
int old_x, int old_y, int x, int y, SDL_Rect * update_rect)
{
/*
Call Tux Paint's "line()" (line-traversing) function.
@ -436,8 +436,7 @@ example_drag(magic_api * api, int which,
SDL_LockSurface(canvas);
api->line((void *) api, which, canvas, snapshot,
old_x, old_y, x, y, 1,
example_line_callback);
old_x, old_y, x, y, 1, example_line_callback);
SDL_UnlockSurface(canvas);
SDL_UnlockSurface(snapshot);
@ -471,12 +470,15 @@ example_drag(magic_api * api, int which,
canvas has been modified and should be updated.
*/
if (which == TOOL_ONE) {
if (which == TOOL_ONE)
{
update_rect->x = old_x;
update_rect->y = old_y;
update_rect->w = (x - old_x) + 1;
update_rect->h = (y - old_y) + 1;
} else {
}
else
{
update_rect->x = old_x - example_size;
update_rect->y = old_y - example_size;
update_rect->w = (x + example_size) - update_rect->x + 1;
@ -494,9 +496,8 @@ example_drag(magic_api * api, int which,
what speaker to play the sound in. (So the sound will pan from speaker
to speaker as you drag the mouse around the canvas!)
*/
api->playsound(sound_effects[which],
(x * 255) / canvas->w, /* Left/right pan */
255 /* Near/far distance (loudness) */);
api->playsound(sound_effects[which], (x * 255) / canvas->w, /* Left/right pan */
255 /* Near/far distance (loudness) */ );
}
@ -526,7 +527,9 @@ changes their chosen, we'll be informed of that as well.
The color comes in as RGB (red, green, and blue) values from 0 (darkest) to
255 (brightest).
*/
void example_set_color(magic_api * api, int which, SDL_Surface * canvas, SDL_Surface * snapshot, Uint8 r, Uint8 g, Uint8 b, SDL_Rect * update_rect)
void example_set_color(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * snapshot, Uint8 r, Uint8 g, Uint8 b,
SDL_Rect * update_rect)
{
/*
We simply store the RGB values in the global variables we declared at
@ -551,7 +554,9 @@ that as well.
The size comes in as an unsigned integer (Uint8) between 1 and the value
returned by our example_accepted_sizes() function during setup.
*/
void example_set_size(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * snapshot, Uint8 size, SDL_Rect * update_rect)
void example_set_size(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * snapshot,
Uint8 size, SDL_Rect * update_rect)
{
/*
Store the new size into the global variable we declared at the top of

View file

@ -144,7 +144,8 @@ released, aka deallocated) when the user quits Tux Paint, when our
example_shutdown() function is called.
*/
int example_init(magic_api * api, Uint8 disabled_features, Uint8 complexity_level)
int example_init(magic_api * api, Uint8 disabled_features,
Uint8 complexity_level)
{
int i;
char filename[1024];
@ -159,8 +160,8 @@ int example_init(magic_api * api, Uint8 disabled_features, Uint8 complexity_leve
"tp-magic-config --dataprefix" command would have told us when we installed
our plugin and its data.)
*/
snprintf(filename, sizeof(filename), "%ssounds/magic/%s", api->data_directory,
sound_filenames[i]);
snprintf(filename, sizeof(filename), "%ssounds/magic/%s",
api->data_directory, sound_filenames[i]);
printf("Trying to load %s sound file\n", filename);
@ -420,8 +421,7 @@ example_click(magic_api * api, int which, int mode,
void
example_drag(magic_api * api, int which,
SDL_Surface * canvas, SDL_Surface * snapshot,
int old_x, int old_y, int x, int y,
SDL_Rect * update_rect)
int old_x, int old_y, int x, int y, SDL_Rect * update_rect)
{
/*
Call Tux Paint's "line()" (line-traversing) function.
@ -436,8 +436,7 @@ example_drag(magic_api * api, int which,
SDL_LockSurface(canvas);
api->line((void *) api, which, canvas, snapshot,
old_x, old_y, x, y, 1,
example_line_callback);
old_x, old_y, x, y, 1, example_line_callback);
SDL_UnlockSurface(canvas);
SDL_UnlockSurface(snapshot);
@ -471,12 +470,15 @@ example_drag(magic_api * api, int which,
canvas has been modified and should be updated.
*/
if (which == TOOL_ONE) {
if (which == TOOL_ONE)
{
update_rect->x = old_x;
update_rect->y = old_y;
update_rect->w = (x - old_x) + 1;
update_rect->h = (y - old_y) + 1;
} else {
}
else
{
update_rect->x = old_x - example_size;
update_rect->y = old_y - example_size;
update_rect->w = (x + example_size) - update_rect->x + 1;
@ -494,9 +496,8 @@ example_drag(magic_api * api, int which,
what speaker to play the sound in. (So the sound will pan from speaker
to speaker as you drag the mouse around the canvas!)
*/
api->playsound(sound_effects[which],
(x * 255) / canvas->w, /* Left/right pan */
255 /* Near/far distance (loudness) */);
api->playsound(sound_effects[which], (x * 255) / canvas->w, /* Left/right pan */
255 /* Near/far distance (loudness) */ );
}
@ -526,7 +527,9 @@ changes their chosen, we'll be informed of that as well.
The color comes in as RGB (red, green, and blue) values from 0 (darkest) to
255 (brightest).
*/
void example_set_color(magic_api * api, int which, SDL_Surface * canvas, SDL_Surface * snapshot, Uint8 r, Uint8 g, Uint8 b, SDL_Rect * update_rect)
void example_set_color(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * snapshot, Uint8 r, Uint8 g, Uint8 b,
SDL_Rect * update_rect)
{
/*
We simply store the RGB values in the global variables we declared at
@ -551,7 +554,9 @@ that as well.
The size comes in as an unsigned integer (Uint8) between 1 and the value
returned by our example_accepted_sizes() function during setup.
*/
void example_set_size(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * snapshot, Uint8 size, SDL_Rect * update_rect)
void example_set_size(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * snapshot,
Uint8 size, SDL_Rect * update_rect)
{
/*
Store the new size into the global variable we declared at the top of

View file

@ -144,7 +144,8 @@ released, aka deallocated) when the user quits Tux Paint, when our
example_shutdown() function is called.
*/
int example_init(magic_api * api, Uint8 disabled_features, Uint8 complexity_level)
int example_init(magic_api * api, Uint8 disabled_features,
Uint8 complexity_level)
{
int i;
char filename[1024];
@ -159,8 +160,8 @@ int example_init(magic_api * api, Uint8 disabled_features, Uint8 complexity_leve
"tp-magic-config --dataprefix" command would have told us when we installed
our plugin and its data.)
*/
snprintf(filename, sizeof(filename), "%ssounds/magic/%s", api->data_directory,
sound_filenames[i]);
snprintf(filename, sizeof(filename), "%ssounds/magic/%s",
api->data_directory, sound_filenames[i]);
printf("Trying to load %s sound file\n", filename);
@ -420,8 +421,7 @@ example_click(magic_api * api, int which, int hamur,
void
example_drag(magic_api * api, int which,
SDL_Surface * canvas, SDL_Surface * skjamynd,
int old_x, int old_y, int x, int y,
SDL_Rect * update_rect)
int old_x, int old_y, int x, int y, SDL_Rect * update_rect)
{
/*
Call Tux Paint's "line()" (line-traversing) function.
@ -436,8 +436,7 @@ example_drag(magic_api * api, int which,
SDL_LockSurface(canvas);
api->line((void *) api, which, canvas, skjamynd,
old_x, old_y, x, y, 1,
example_line_callback);
old_x, old_y, x, y, 1, example_line_callback);
SDL_UnlockSurface(canvas);
SDL_UnlockSurface(skjamynd);
@ -471,12 +470,15 @@ example_drag(magic_api * api, int which,
canvas has been modified and should be updated.
*/
if (which == TOOL_ONE) {
if (which == TOOL_ONE)
{
update_rect->x = old_x;
update_rect->y = old_y;
update_rect->w = (x - old_x) + 1;
update_rect->h = (y - old_y) + 1;
} else {
}
else
{
update_rect->x = old_x - example_staerd;
update_rect->y = old_y - example_staerd;
update_rect->w = (x + example_staerd) - update_rect->x + 1;
@ -494,9 +496,8 @@ example_drag(magic_api * api, int which,
what speaker to play the sound in. (So the sound will pan from speaker
to speaker as you drag the mouse around the canvas!)
*/
api->playsound(sound_effects[which],
(x * 255) / canvas->w, /* vinstri/hægri hliðrun */
255 /* Near/far distance (loudness) */);
api->playsound(sound_effects[which], (x * 255) / canvas->w, /* vinstri/hægri hliðrun */
255 /* Near/far distance (loudness) */ );
}
@ -526,7 +527,9 @@ changes their chosen, we'll be informed of that as well.
The color comes in as RGB (red, green, and blue) values from 0 (darkest) to
255 (brightest).
*/
void example_set_color(magic_api * api, int which, SDL_Surface * canvas, SDL_Surface * skjamynd, Uint8 r, Uint8 g, Uint8 b, SDL_Rect * update_rect)
void example_set_color(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * skjamynd, Uint8 r, Uint8 g, Uint8 b,
SDL_Rect * update_rect)
{
/*
We simply store the RGB values in the global variables we declared at
@ -551,7 +554,9 @@ that as well.
The size comes in as an unsigned integer (Uint8) between 1 and the value
returned by our example_accepted_sizes() function during setup.
*/
void example_set_size(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * skjamynd, Uint8 staerd, SDL_Rect * update_rect)
void example_set_size(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * skjamynd,
Uint8 staerd, SDL_Rect * update_rect)
{
/*
Store the new size into the global variable we declared at the top of

View file

@ -144,7 +144,8 @@ released, aka deallocated) when the user quits Tux Paint, when our
example_shutdown() function is called.
*/
int example_init(magic_api * api, Uint8 disabled_features, Uint8 complexity_level)
int example_init(magic_api * api, Uint8 disabled_features,
Uint8 complexity_level)
{
int i;
char filename[1024];
@ -159,8 +160,8 @@ int example_init(magic_api * api, Uint8 disabled_features, Uint8 complexity_leve
"tp-magic-config --dataprefix" command would have told us when we installed
our plugin and its data.)
*/
snprintf(filename, sizeof(filename), "%ssounds/magic/%s", api->data_directory,
sound_filenames[i]);
snprintf(filename, sizeof(filename), "%ssounds/magic/%s",
api->data_directory, sound_filenames[i]);
printf("Trying to load %s sound file\n", filename);
@ -420,8 +421,7 @@ example_click(magic_api * api, int which, int hamur,
void
example_drag(magic_api * api, int which,
SDL_Surface * canvas, SDL_Surface * skjamynd,
int old_x, int old_y, int x, int y,
SDL_Rect * update_rect)
int old_x, int old_y, int x, int y, SDL_Rect * update_rect)
{
/*
Call Tux Paint's "line()" (line-traversing) function.
@ -436,8 +436,7 @@ example_drag(magic_api * api, int which,
SDL_LockSurface(canvas);
api->line((void *) api, which, canvas, skjamynd,
old_x, old_y, x, y, 1,
example_line_callback);
old_x, old_y, x, y, 1, example_line_callback);
SDL_UnlockSurface(canvas);
SDL_UnlockSurface(skjamynd);
@ -471,12 +470,15 @@ example_drag(magic_api * api, int which,
canvas has been modified and should be updated.
*/
if (which == TOOL_ONE) {
if (which == TOOL_ONE)
{
update_rect->x = old_x;
update_rect->y = old_y;
update_rect->w = (x - old_x) + 1;
update_rect->h = (y - old_y) + 1;
} else {
}
else
{
update_rect->x = old_x - example_staerd;
update_rect->y = old_y - example_staerd;
update_rect->w = (x + example_staerd) - update_rect->x + 1;
@ -494,9 +496,8 @@ example_drag(magic_api * api, int which,
what speaker to play the sound in. (So the sound will pan from speaker
to speaker as you drag the mouse around the canvas!)
*/
api->playsound(sound_effects[which],
(x * 255) / canvas->w, /* vinstri/hægri hliðrun */
255 /* Near/far distance (loudness) */);
api->playsound(sound_effects[which], (x * 255) / canvas->w, /* vinstri/hægri hliðrun */
255 /* Near/far distance (loudness) */ );
}
@ -526,7 +527,9 @@ changes their chosen, we'll be informed of that as well.
The color comes in as RGB (red, green, and blue) values from 0 (darkest) to
255 (brightest).
*/
void example_set_color(magic_api * api, int which, SDL_Surface * canvas, SDL_Surface * skjamynd, Uint8 r, Uint8 g, Uint8 b, SDL_Rect * update_rect)
void example_set_color(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * skjamynd, Uint8 r, Uint8 g, Uint8 b,
SDL_Rect * update_rect)
{
/*
We simply store the RGB values in the global variables we declared at
@ -551,7 +554,9 @@ that as well.
The size comes in as an unsigned integer (Uint8) between 1 and the value
returned by our example_accepted_sizes() function during setup.
*/
void example_set_size(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * skjamynd, Uint8 staerd, SDL_Rect * update_rect)
void example_set_size(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * skjamynd,
Uint8 staerd, SDL_Rect * update_rect)
{
/*
Store the new size into the global variable we declared at the top of

View file

@ -144,7 +144,8 @@ released, aka deallocated) when the user quits Tux Paint, when our
example_shutdown() function is called.
*/
int example_init(magic_api * api, Uint8 disabled_features, Uint8 complexity_level)
int example_init(magic_api * api, Uint8 disabled_features,
Uint8 complexity_level)
{
int i;
char filename[1024];
@ -159,8 +160,8 @@ int example_init(magic_api * api, Uint8 disabled_features, Uint8 complexity_leve
"tp-magic-config --dataprefix" command would have told us when we installed
our plugin and its data.)
*/
snprintf(filename, sizeof(filename), "%ssounds/magic/%s", api->data_directory,
sound_filenames[i]);
snprintf(filename, sizeof(filename), "%ssounds/magic/%s",
api->data_directory, sound_filenames[i]);
printf("Trying to load %s sound file\n", filename);
@ -420,8 +421,7 @@ example_click(magic_api * api, int which, int mode,
void
example_drag(magic_api * api, int which,
SDL_Surface * canvas, SDL_Surface * snapshot,
int old_x, int old_y, int x, int y,
SDL_Rect * update_rect)
int old_x, int old_y, int x, int y, SDL_Rect * update_rect)
{
/*
Call Tux Paint's "line()" (line-traversing) function.
@ -436,8 +436,7 @@ example_drag(magic_api * api, int which,
SDL_LockSurface(canvas);
api->line((void *) api, which, canvas, snapshot,
old_x, old_y, x, y, 1,
example_line_callback);
old_x, old_y, x, y, 1, example_line_callback);
SDL_UnlockSurface(canvas);
SDL_UnlockSurface(snapshot);
@ -471,12 +470,15 @@ example_drag(magic_api * api, int which,
canvas has been modified and should be updated.
*/
if (which == TOOL_ONE) {
if (which == TOOL_ONE)
{
update_rect->x = old_x;
update_rect->y = old_y;
update_rect->w = (x - old_x) + 1;
update_rect->h = (y - old_y) + 1;
} else {
}
else
{
update_rect->x = old_x - example_size;
update_rect->y = old_y - example_size;
update_rect->w = (x + example_size) - update_rect->x + 1;
@ -494,9 +496,8 @@ example_drag(magic_api * api, int which,
what speaker to play the sound in. (So the sound will pan from speaker
to speaker as you drag the mouse around the canvas!)
*/
api->playsound(sound_effects[which],
(x * 255) / canvas->w, /* Left/right pan */
255 /* Near/far distance (loudness) */);
api->playsound(sound_effects[which], (x * 255) / canvas->w, /* Left/right pan */
255 /* Near/far distance (loudness) */ );
}
@ -526,7 +527,9 @@ changes their chosen, we'll be informed of that as well.
The color comes in as RGB (red, green, and blue) values from 0 (darkest) to
255 (brightest).
*/
void example_set_color(magic_api * api, int which, SDL_Surface * canvas, SDL_Surface * snapshot, Uint8 r, Uint8 g, Uint8 b, SDL_Rect * update_rect)
void example_set_color(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * snapshot, Uint8 r, Uint8 g, Uint8 b,
SDL_Rect * update_rect)
{
/*
We simply store the RGB values in the global variables we declared at
@ -551,7 +554,9 @@ that as well.
The size comes in as an unsigned integer (Uint8) between 1 and the value
returned by our example_accepted_sizes() function during setup.
*/
void example_set_size(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * snapshot, Uint8 size, SDL_Rect * update_rect)
void example_set_size(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * snapshot,
Uint8 size, SDL_Rect * update_rect)
{
/*
Store the new size into the global variable we declared at the top of

View file

@ -144,7 +144,8 @@ released, aka deallocated) when the user quits Tux Paint, when our
example_shutdown() function is called.
*/
int example_init(magic_api * api, Uint8 disabled_features, Uint8 complexity_level)
int example_init(magic_api * api, Uint8 disabled_features,
Uint8 complexity_level)
{
int i;
char filename[1024];
@ -159,8 +160,8 @@ int example_init(magic_api * api, Uint8 disabled_features, Uint8 complexity_leve
"tp-magic-config --dataprefix" command would have told us when we installed
our plugin and its data.)
*/
snprintf(filename, sizeof(filename), "%ssounds/magic/%s", api->data_directory,
sound_filenames[i]);
snprintf(filename, sizeof(filename), "%ssounds/magic/%s",
api->data_directory, sound_filenames[i]);
printf("Trying to load %s sound file\n", filename);
@ -420,8 +421,7 @@ example_click(magic_api * api, int which, int mode,
void
example_drag(magic_api * api, int which,
SDL_Surface * canvas, SDL_Surface * snapshot,
int old_x, int old_y, int x, int y,
SDL_Rect * update_rect)
int old_x, int old_y, int x, int y, SDL_Rect * update_rect)
{
/*
Call Tux Paint's "line()" (line-traversing) function.
@ -436,8 +436,7 @@ example_drag(magic_api * api, int which,
SDL_LockSurface(canvas);
api->line((void *) api, which, canvas, snapshot,
old_x, old_y, x, y, 1,
example_line_callback);
old_x, old_y, x, y, 1, example_line_callback);
SDL_UnlockSurface(canvas);
SDL_UnlockSurface(snapshot);
@ -471,12 +470,15 @@ example_drag(magic_api * api, int which,
canvas has been modified and should be updated.
*/
if (which == TOOL_ONE) {
if (which == TOOL_ONE)
{
update_rect->x = old_x;
update_rect->y = old_y;
update_rect->w = (x - old_x) + 1;
update_rect->h = (y - old_y) + 1;
} else {
}
else
{
update_rect->x = old_x - example_size;
update_rect->y = old_y - example_size;
update_rect->w = (x + example_size) - update_rect->x + 1;
@ -494,9 +496,8 @@ example_drag(magic_api * api, int which,
what speaker to play the sound in. (So the sound will pan from speaker
to speaker as you drag the mouse around the canvas!)
*/
api->playsound(sound_effects[which],
(x * 255) / canvas->w, /* Left/right pan */
255 /* Near/far distance (loudness) */);
api->playsound(sound_effects[which], (x * 255) / canvas->w, /* Left/right pan */
255 /* Near/far distance (loudness) */ );
}
@ -526,7 +527,9 @@ changes their chosen, we'll be informed of that as well.
The color comes in as RGB (red, green, and blue) values from 0 (darkest) to
255 (brightest).
*/
void example_set_color(magic_api * api, int which, SDL_Surface * canvas, SDL_Surface * snapshot, Uint8 r, Uint8 g, Uint8 b, SDL_Rect * update_rect)
void example_set_color(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * snapshot, Uint8 r, Uint8 g, Uint8 b,
SDL_Rect * update_rect)
{
/*
We simply store the RGB values in the global variables we declared at
@ -551,7 +554,9 @@ that as well.
The size comes in as an unsigned integer (Uint8) between 1 and the value
returned by our example_accepted_sizes() function during setup.
*/
void example_set_size(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * snapshot, Uint8 size, SDL_Rect * update_rect)
void example_set_size(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * snapshot,
Uint8 size, SDL_Rect * update_rect)
{
/*
Store the new size into the global variable we declared at the top of

View file

@ -144,7 +144,8 @@ released, aka deallocated) when the user quits Tux Paint, when our
example_shutdown() function is called.
*/
int example_init(magic_api * api, Uint8 disabled_features, Uint8 complexity_level)
int example_init(magic_api * api, Uint8 disabled_features,
Uint8 complexity_level)
{
int i;
char filename[1024];
@ -159,8 +160,8 @@ int example_init(magic_api * api, Uint8 disabled_features, Uint8 complexity_leve
"tp-magic-config --dataprefix" command would have told us when we installed
our plugin and its data.)
*/
snprintf(filename, sizeof(filename), "%ssounds/magic/%s", api->data_directory,
sound_filenames[i]);
snprintf(filename, sizeof(filename), "%ssounds/magic/%s",
api->data_directory, sound_filenames[i]);
printf("Trying to load %s sound file\n", filename);
@ -420,8 +421,7 @@ example_click(magic_api * api, int which, int mode,
void
example_drag(magic_api * api, int which,
SDL_Surface * canvas, SDL_Surface * snapshot,
int old_x, int old_y, int x, int y,
SDL_Rect * update_rect)
int old_x, int old_y, int x, int y, SDL_Rect * update_rect)
{
/*
Call Tux Paint's "line()" (line-traversing) function.
@ -436,8 +436,7 @@ example_drag(magic_api * api, int which,
SDL_LockSurface(canvas);
api->line((void *) api, which, canvas, snapshot,
old_x, old_y, x, y, 1,
example_line_callback);
old_x, old_y, x, y, 1, example_line_callback);
SDL_UnlockSurface(canvas);
SDL_UnlockSurface(snapshot);
@ -471,12 +470,15 @@ example_drag(magic_api * api, int which,
canvas has been modified and should be updated.
*/
if (which == TOOL_ONE) {
if (which == TOOL_ONE)
{
update_rect->x = old_x;
update_rect->y = old_y;
update_rect->w = (x - old_x) + 1;
update_rect->h = (y - old_y) + 1;
} else {
}
else
{
update_rect->x = old_x - example_size;
update_rect->y = old_y - example_size;
update_rect->w = (x + example_size) - update_rect->x + 1;
@ -494,9 +496,8 @@ example_drag(magic_api * api, int which,
what speaker to play the sound in. (So the sound will pan from speaker
to speaker as you drag the mouse around the canvas!)
*/
api->playsound(sound_effects[which],
(x * 255) / canvas->w, /* Left/right pan */
255 /* Near/far distance (loudness) */);
api->playsound(sound_effects[which], (x * 255) / canvas->w, /* Left/right pan */
255 /* Near/far distance (loudness) */ );
}
@ -526,7 +527,9 @@ changes their chosen, we'll be informed of that as well.
The color comes in as RGB (red, green, and blue) values from 0 (darkest) to
255 (brightest).
*/
void example_set_color(magic_api * api, int which, SDL_Surface * canvas, SDL_Surface * snapshot, Uint8 r, Uint8 g, Uint8 b, SDL_Rect * update_rect)
void example_set_color(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * snapshot, Uint8 r, Uint8 g, Uint8 b,
SDL_Rect * update_rect)
{
/*
We simply store the RGB values in the global variables we declared at
@ -551,7 +554,9 @@ that as well.
The size comes in as an unsigned integer (Uint8) between 1 and the value
returned by our example_accepted_sizes() function during setup.
*/
void example_set_size(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * snapshot, Uint8 size, SDL_Rect * update_rect)
void example_set_size(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * snapshot,
Uint8 size, SDL_Rect * update_rect)
{
/*
Store the new size into the global variable we declared at the top of

View file

@ -144,7 +144,8 @@ released, aka deallocated) when the user quits Tux Paint, when our
example_shutdown() function is called.
*/
int example_init(magic_api * api, Uint8 disabled_features, Uint8 complexity_level)
int example_init(magic_api * api, Uint8 disabled_features,
Uint8 complexity_level)
{
int i;
char filename[1024];
@ -159,8 +160,8 @@ int example_init(magic_api * api, Uint8 disabled_features, Uint8 complexity_leve
"tp-magic-config --dataprefix" command would have told us when we installed
our plugin and its data.)
*/
snprintf(filename, sizeof(filename), "%ssounds/magic/%s", api->data_directory,
sound_filenames[i]);
snprintf(filename, sizeof(filename), "%ssounds/magic/%s",
api->data_directory, sound_filenames[i]);
printf("Trying to load %s sound file\n", filename);
@ -420,8 +421,7 @@ example_click(magic_api * api, int which, int mode,
void
example_drag(magic_api * api, int which,
SDL_Surface * canvas, SDL_Surface * snapshot,
int old_x, int old_y, int x, int y,
SDL_Rect * update_rect)
int old_x, int old_y, int x, int y, SDL_Rect * update_rect)
{
/*
Call Tux Paint's "line()" (line-traversing) function.
@ -436,8 +436,7 @@ example_drag(magic_api * api, int which,
SDL_LockSurface(canvas);
api->line((void *) api, which, canvas, snapshot,
old_x, old_y, x, y, 1,
example_line_callback);
old_x, old_y, x, y, 1, example_line_callback);
SDL_UnlockSurface(canvas);
SDL_UnlockSurface(snapshot);
@ -471,12 +470,15 @@ example_drag(magic_api * api, int which,
canvas has been modified and should be updated.
*/
if (which == TOOL_ONE) {
if (which == TOOL_ONE)
{
update_rect->x = old_x;
update_rect->y = old_y;
update_rect->w = (x - old_x) + 1;
update_rect->h = (y - old_y) + 1;
} else {
}
else
{
update_rect->x = old_x - example_size;
update_rect->y = old_y - example_size;
update_rect->w = (x + example_size) - update_rect->x + 1;
@ -494,9 +496,8 @@ example_drag(magic_api * api, int which,
what speaker to play the sound in. (So the sound will pan from speaker
to speaker as you drag the mouse around the canvas!)
*/
api->playsound(sound_effects[which],
(x * 255) / canvas->w, /* Left/right pan */
255 /* Near/far distance (loudness) */);
api->playsound(sound_effects[which], (x * 255) / canvas->w, /* Left/right pan */
255 /* Near/far distance (loudness) */ );
}
@ -526,7 +527,9 @@ changes their chosen, we'll be informed of that as well.
The color comes in as RGB (red, green, and blue) values from 0 (darkest) to
255 (brightest).
*/
void example_set_color(magic_api * api, int which, SDL_Surface * canvas, SDL_Surface * snapshot, Uint8 r, Uint8 g, Uint8 b, SDL_Rect * update_rect)
void example_set_color(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * snapshot, Uint8 r, Uint8 g, Uint8 b,
SDL_Rect * update_rect)
{
/*
We simply store the RGB values in the global variables we declared at
@ -551,7 +554,9 @@ that as well.
The size comes in as an unsigned integer (Uint8) between 1 and the value
returned by our example_accepted_sizes() function during setup.
*/
void example_set_size(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * snapshot, Uint8 size, SDL_Rect * update_rect)
void example_set_size(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * snapshot,
Uint8 size, SDL_Rect * update_rect)
{
/*
Store the new size into the global variable we declared at the top of