Color Shift (alien): Accept sizes

(Also, remove a debug printf() from Googly Eyes)
This commit is contained in:
Bill Kendrick 2023-04-18 22:16:41 -07:00
parent 6c44ff6d3d
commit 8218dbdba2
2 changed files with 23 additions and 7 deletions

View file

@ -25,7 +25,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
Last updated: January 25, 2023
Last updated: April 18, 2023
*/
#include <stdio.h>
@ -45,7 +45,7 @@
static const double alien_ANGLE[] = { 0, 0, 0 };
static const double alien_FREQUENCY[] = { 1, 1, 1 };
static const int alien_RADIUS = 16;
static int alien_RADIUS = 16;
enum
{
@ -79,7 +79,7 @@ const char *alien_descs[alien_NUM_TOOLS][2] = {
// Prototypes
Uint32 alien_api_version(void);
int alien_init(magic_api * api);
int alien_init(magic_api * api, Uint32 disabled_features);
int alien_get_tool_count(magic_api * api);
SDL_Surface *alien_get_icon(magic_api * api, int which);
char *alien_get_name(magic_api * api, int which);
@ -98,6 +98,8 @@ void alien_shutdown(magic_api * api);
void alien_set_color(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * last, Uint8 r, Uint8 g, Uint8 b, SDL_Rect * update_rect);
int alien_requires_colors(magic_api * api, int which);
Uint8 alien_accepted_sizes(magic_api * api, int which, int mode);
Uint8 alien_default_size(magic_api * api, int which, int mode);
void alien_switchin(magic_api * api, int which, int mode,
SDL_Surface * canvas);
void alien_switchout(magic_api * api, int which, int mode,
@ -111,7 +113,7 @@ Uint32 alien_api_version(void)
}
//Load sounds
int alien_init(magic_api * api)
int alien_init(magic_api * api, Uint32 disabled_features ATTRIBUTE_UNUSED)
{
int i;
char fname[1024];
@ -324,6 +326,22 @@ int alien_requires_colors(magic_api * api ATTRIBUTE_UNUSED,
return 0;
}
Uint8 alien_accepted_sizes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
{
return 6;
}
Uint8 alien_default_size(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
{
return 4;
}
void alien_set_size(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
SDL_Surface * canvas ATTRIBUTE_UNUSED, SDL_Surface * last ATTRIBUTE_UNUSED,
Uint8 size, SDL_Rect * update_rect ATTRIBUTE_UNUSED) {
alien_RADIUS = size * 4;
}
void alien_switchin(magic_api * api ATTRIBUTE_UNUSED,
int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
SDL_Surface * canvas ATTRIBUTE_UNUSED)

View file

@ -3,7 +3,7 @@
Draws a googly eye at the click position, and looks
towards where you drag+release.
Last updated: April 12, 2023
Last updated: April 18, 2023
*/
#include <stdio.h>
@ -143,8 +143,6 @@ int googlyeyes_init(magic_api * api, Uint32 disabled_features)
size = (100 * (googlyeyes_sizes - i)) / googlyeyes_sizes;
}
printf("%d -> %d%%\n", i, size);
googlyeyes_img_bkgd[i] = api->scale(googlyeyes_img_bkgd[0],
(googlyeyes_img_bkgd[0]->w * size) / 100,
(googlyeyes_img_bkgd[0]->h * size) / 100,