N-pt perspective Magic tools: Sound effects!

This commit is contained in:
Bill Kendrick 2023-12-23 13:28:43 -08:00
parent 761c948962
commit 3e662b9edc
6 changed files with 59 additions and 25 deletions

View file

@ -6,7 +6,7 @@ Copyright (c) 2002-2023
Various contributors (see below, and CHANGES.txt)
https://tuxpaint.org/
June 17, 2002 - July 20, 2023
June 17, 2002 - December 23, 2023
* Design and Coding:
@ -147,6 +147,19 @@ June 17, 2002 - July 20, 2023
(https://freesound.org/people/kentnelson64/sounds/647221/)
Creative Commons 0 license by "kentnelson64"
1-point, 2-point, and 3-point Perspective tools
by Bill Kendrick <bill@newbreedsoftware.com>
Sounds:
+ Select: "Gummibandloop_121.wav"
(https://freesound.org/people/von_Gardener/sounds/473829/)
Creative Commons 0 by https://freesound.org/people/von_Gardener/
+ Click: "Rubber Band"
(https://freesound.org/people/IndigoRay/sounds/241869/)
Creative Commons 0 by https://freesound.org/people/IndigoRay/
+ Release: "Elastic band c note"
(https://freesound.org/people/mudflea2/sounds/708182/)
Creative Commons 0 by https://freesound.org/people/mudflea2/
3D Glasses, Color Sep., & Double Vision magic tools
by Bill Kendrick <bill@newbreedsoftware.com>

View file

@ -6,19 +6,31 @@ Copyright (c) 2002-2023
Various contributors (see below, and AUTHORS.txt)
https://tuxpaint.org/
2023.December.22 (0.9.32)
2023.December.23 (0.9.32)
* New Magic Tools:
----------------
* 1-point Perspective (vanishing point)
* Vanishing point magic tools:
+ 1-point Perspective ("1-Point Select" & "1-Point Draw")
Choose a vanishing point, and then draw lines that always
point towards it, or are vertical or horizontal.
Bill Kendrick <bill@newbreedsoftware.com>
* 2-point Perspective (vanishing point)
+ 2-point Perspective ("2-Point Select" & "2-Point Draw")
Choose two vanishing points, and then draw lines that always
point towards them, along the horizon defined by them,
or perpendicular to that horizon.
Bill Kendrick <bill@newbreedsoftware.com>
+ 3-point Perspective ("3-Point Select" & "3-Point Draw")
Choose three vanishing points, and then draw lines that always
point towards them, or along the horizon defined by the first two.
+ Code: Bill Kendrick <bill@newbreedsoftware.com>
+ Sounds:
- Select: "Gummibandloop_121.wav"
(https://freesound.org/people/von_Gardener/sounds/473829/)
Creative Commons 0 by von_Gardener
- Click: "Rubber Band"
(https://freesound.org/people/IndigoRay/sounds/241869/)
Creative Commons 0 by IndigoRay
- Release: "Elastic band c note"
(https://freesound.org/people/mudflea2/sounds/708182/)
Creative Commons 0 by mudflea2
* Improvements to "Text" & "Label" tools:
---------------------------------------

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -32,13 +32,17 @@ enum
};
const char *sound_filenames[NUM_TOOLS] = {
"", // FIXME
"", // FIXME
"", // FIXME
"", // FIXME
"", // FIXME
"", // FIXME
enum {
SND_SELECT,
SND_DRAW_CLICK,
SND_DRAW_RELEASE,
NUM_SNDS
};
const char *sound_filenames[NUM_SNDS] = {
"n_pt_persp_select.ogg",
"n_pt_persp_click.ogg",
"n_pt_persp_release.ogg",
};
const char *icon_filenames[NUM_TOOLS] = {
@ -140,7 +144,7 @@ int n_pt_persp_init(magic_api * api, Uint32 disabled_features ATTRIBUTE_UNUSED)
int i;
char filename[1024];
for (i = 0; i < NUM_TOOLS; i++)
for (i = 0; i < NUM_SNDS; i++)
{
snprintf(filename, sizeof(filename), "%s/sounds/magic/%s", api->data_directory,
sound_filenames[i]);
@ -258,7 +262,7 @@ void n_pt_persp_shutdown(magic_api * api ATTRIBUTE_UNUSED)
SDL_FreeSurface(n_pt_persp_snapshot);
}
for (i = 0; i < NUM_TOOLS; i++) {
for (i = 0; i < NUM_SNDS; i++) {
if (sound_effects[i] != NULL) {
Mix_FreeChunk(sound_effects[i]);
}
@ -318,6 +322,8 @@ void n_pt_persp_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED,
} else {
int i;
api->playsound(sound_effects[SND_DRAW_CLICK], (x * 255) / canvas->w, 255);
/* Start drawing a line */
SDL_BlitSurface(canvas, NULL, n_pt_persp_snapshot, NULL);
@ -380,6 +386,8 @@ void n_pt_persp_vanish_pt_moved(magic_api * api, int which, SDL_Surface * canvas
update_rect->y = 0;
update_rect->w = canvas->w;
update_rect->h = canvas->h;
api->playsound(sound_effects[SND_SELECT], 128, 255);
}
@ -655,8 +663,6 @@ void n_pt_persp_work(magic_api * api, int which,
update_rect->y = 0;
update_rect->w = canvas->w;
update_rect->h = canvas->h;
api->playsound(sound_effects[which], (x * 255) / canvas->w, 255);
}
@ -666,7 +672,7 @@ void n_pt_persp_release(magic_api * api, int which,
{
if (which == TOOL_1PT_SELECT) {
/* 1-point perspective - vanishing point drag released */
/* No-op */
api->stopsound();
} else if (which == TOOL_2PT_SELECT) {
/* 2-point perspective - vanishing point drag released */
if (abs(a2_pt_x[0] - a2_pt_x[1]) < SNAP) {
@ -678,12 +684,15 @@ void n_pt_persp_release(magic_api * api, int which,
a2_pt_x[1] -= (SNAP / 2);
}
}
api->stopsound();
} else if (which == TOOL_3PT_SELECT) {
/* 3-point perspective - vanishing point drag released */
/* FIXME */
api->stopsound();
} else {
/* Draw the line (for real) */
n_pt_persp_work(api, which, canvas, x, y, update_rect, 0);
api->playsound(sound_effects[SND_DRAW_RELEASE], (x * 255) / canvas->w, 255);
}
}