grass -- needs more work

This commit is contained in:
Albert Cahalan 2004-12-17 22:56:31 +00:00
parent fab3be3c6f
commit 25ac30c2c1
3 changed files with 44 additions and 18 deletions

View file

@ -34,6 +34,9 @@ http://www.newbreedsoftware.com/tuxpaint/
* "Smudge" (pushes the colors around like wet paint) * "Smudge" (pushes the colors around like wet paint)
Albert Cahalan <albert@users.sf.net> Albert Cahalan <albert@users.sf.net>
* "Grass" (makes grass, the painless way)
Albert Cahalan <albert@users.sf.net>
* "Darken" (opposite of "Fade"), * "Darken" (opposite of "Fade"),
* "Tint" (changes colors of parts of the picture), and * "Tint" (changes colors of parts of the picture), and
* "Cartoon" (makes parts of the picture look like a cartoon or comic) * "Cartoon" (makes parts of the picture look like a cartoon or comic)

View file

@ -15,11 +15,11 @@
/* What tools are available: */ /* What tools are available: */
enum { enum {
MAGIC_FILL,
MAGIC_GRASS,
MAGIC_RAINBOW, MAGIC_RAINBOW,
MAGIC_SPARKLES, MAGIC_SPARKLES,
MAGIC_MIRROR,
MAGIC_FLIP,
MAGIC_BLUR, MAGIC_BLUR,
MAGIC_SMUDGE, MAGIC_SMUDGE,
@ -38,8 +38,9 @@ enum {
MAGIC_DRIP, MAGIC_DRIP,
MAGIC_CARTOON, MAGIC_CARTOON,
MAGIC_FILL, MAGIC_MIRROR,
MAGIC_FLIP,
NUM_MAGICS NUM_MAGICS
}; };
@ -48,12 +49,12 @@ enum {
/* Magic tool names: */ /* Magic tool names: */
const char * const magic_names[NUM_MAGICS] = { const char * const magic_names[NUM_MAGICS] = {
gettext_noop("Fill"),
gettext_noop("Grass"),
gettext_noop("Rainbow"), gettext_noop("Rainbow"),
gettext_noop("Sparkles"), gettext_noop("Sparkles"),
gettext_noop("Mirror"),
gettext_noop("Flip"),
gettext_noop("Blur"), gettext_noop("Blur"),
gettext_noop("Smudge"), gettext_noop("Smudge"),
@ -72,19 +73,20 @@ const char * const magic_names[NUM_MAGICS] = {
gettext_noop("Drip"), gettext_noop("Drip"),
gettext_noop("Cartoon"), gettext_noop("Cartoon"),
gettext_noop("Fill") gettext_noop("Mirror"),
gettext_noop("Flip"),
}; };
/* Some text to write when each tool is selected: */ /* Some text to write when each tool is selected: */
const char * const magic_tips[NUM_MAGICS] = { const char * const magic_tips[NUM_MAGICS] = {
gettext_noop("Click in the picture to fill that area with color."),
gettext_noop("Click and move to draw grass."),
gettext_noop("You can draw in rainbow colors!"), gettext_noop("You can draw in rainbow colors!"),
gettext_noop("Click and move to draw sparkles."), gettext_noop("Click and move to draw sparkles."),
gettext_noop("Click to make a mirror image."),
gettext_noop("Click to flip the picture upside-down."),
gettext_noop("Click and move the mouse around to blur the picture."), gettext_noop("Click and move the mouse around to blur the picture."),
gettext_noop("Click and move the mouse around to smudge the picture."), gettext_noop("Click and move the mouse around to smudge the picture."),
@ -102,20 +104,21 @@ const char * const magic_tips[NUM_MAGICS] = {
gettext_noop("Click and move the mouse around to make the picture drip."), gettext_noop("Click and move the mouse around to make the picture drip."),
gettext_noop("Click and move the mouse around to turn the picture into a cartoon."), gettext_noop("Click and move the mouse around to turn the picture into a cartoon."),
gettext_noop("Click in the picture to fill that area with color.") gettext_noop("Click to make a mirror image."),
gettext_noop("Click to flip the picture upside-down."),
}; };
/* Tool icon filenames: */ /* Tool icon filenames: */
const char * const magic_img_fnames[NUM_MAGICS] = { const char * const magic_img_fnames[NUM_MAGICS] = {
DATA_PREFIX "images/magic/fill.png",
DATA_PREFIX "images/magic/grass.png",
DATA_PREFIX "images/magic/rainbow.png", DATA_PREFIX "images/magic/rainbow.png",
DATA_PREFIX "images/magic/sparkles.png", DATA_PREFIX "images/magic/sparkles.png",
DATA_PREFIX "images/magic/mirror.png",
DATA_PREFIX "images/magic/flip.png",
DATA_PREFIX "images/magic/blur.png", DATA_PREFIX "images/magic/blur.png",
DATA_PREFIX "images/magic/smudge.png", DATA_PREFIX "images/magic/smudge.png",
@ -134,7 +137,8 @@ const char * const magic_img_fnames[NUM_MAGICS] = {
DATA_PREFIX "images/magic/drip.png", DATA_PREFIX "images/magic/drip.png",
DATA_PREFIX "images/magic/cartoon.png", DATA_PREFIX "images/magic/cartoon.png",
DATA_PREFIX "images/magic/fill.png" DATA_PREFIX "images/magic/mirror.png",
DATA_PREFIX "images/magic/flip.png",
}; };

View file

@ -617,6 +617,7 @@ static SDL_Surface * img_paintcan;
static SDL_Surface * img_grow, * img_shrink; static SDL_Surface * img_grow, * img_shrink;
static SDL_Surface * img_sparkles; static SDL_Surface * img_sparkles;
static SDL_Surface * img_grass;
static SDL_Surface * img_title_on, * img_title_off, static SDL_Surface * img_title_on, * img_title_off,
* img_title_large_on, * img_title_large_off; * img_title_large_on, * img_title_large_off;
@ -4064,6 +4065,7 @@ static void magic_draw(int x1, int y1, int x2, int y2, int button_down)
/* FIXME: Need sounds for: /* FIXME: Need sounds for:
Smudge Smudge
Tint Tint
Grass (mower?)
Cartoon */ Cartoon */
@ -4481,6 +4483,21 @@ static void blit_magic(int x, int y, int button_down)
SDL_BlitSurface(img_sparkles, &src, canvas, &dest); SDL_BlitSurface(img_sparkles, &src, canvas, &dest);
} }
} }
else if (cur_magic == MAGIC_GRASS)
{
if ((rand() % 10) < 2)
{
src.x = 0;
src.y = (rand() % 4) * 32;
src.w = 32;
src.h = 32;
dest.x = x - 16;
dest.y = y - 16;
SDL_BlitSurface(img_grass, &src, canvas, &dest);
}
}
else if (cur_magic == MAGIC_FLIP) else if (cur_magic == MAGIC_FLIP)
{ {
/* Flip the canvas: */ /* Flip the canvas: */
@ -6162,6 +6179,7 @@ static void setup(int argc, char * argv[])
show_progress_bar(); show_progress_bar();
img_sparkles = loadimage(DATA_PREFIX "images/ui/sparkles.png"); img_sparkles = loadimage(DATA_PREFIX "images/ui/sparkles.png");
img_grass = loadimage(DATA_PREFIX "images/ui/grass.png");
/* Load brushes: */ /* Load brushes: */
@ -10317,6 +10335,7 @@ static void cleanup(void)
free_surface( &img_paintcan ); free_surface( &img_paintcan );
free_surface( &img_sparkles ); free_surface( &img_sparkles );
free_surface( &img_grass );
free_surface_array( undo_bufs, NUM_UNDO_BUFS ); free_surface_array( undo_bufs, NUM_UNDO_BUFS );
#ifndef LOW_QUALITY_COLOR_SELECTOR #ifndef LOW_QUALITY_COLOR_SELECTOR