From 10881623cffba00949bddc2345ffd8a353763a05 Mon Sep 17 00:00:00 2001 From: William Kendrick Date: Fri, 27 Jul 2007 02:22:24 +0000 Subject: [PATCH] Added Octagon shape. (Also means shape tool selector needed to scroll in 640x480, which has been done, too.) --- data/images/shapes/octagon.png | Bin 0 -> 274 bytes data/images/shapes/octagon_f.png | Bin 0 -> 249 bytes docs/CHANGES.txt | 4 ++ src/shapes.h | 42 ++++++++++++++++----- src/tuxpaint.c | 62 +++++++++++++++++++++++++------ 5 files changed, 87 insertions(+), 21 deletions(-) create mode 100644 data/images/shapes/octagon.png create mode 100644 data/images/shapes/octagon_f.png diff --git a/data/images/shapes/octagon.png b/data/images/shapes/octagon.png new file mode 100644 index 0000000000000000000000000000000000000000..a5208b1db4a8ea9298a0fd98d4e1056662c075e5 GIT binary patch literal 274 zcmeAS@N?(olHy`uVBq!ia0vp^8bB<^!3HGb?#A2&Qfx`y?k)`fL2$v|<&%LToCO|{ z#S9DrbAZ^Fao@XhSwKPd5>H=O_Ur7@OgwUnU+U}t3eER)aSVw#{Pu<+UxNY<>jing z2b>-54;1dze-h}+*<~Qf+Fg^wYoECI_QzXxab( literal 0 HcmV?d00001 diff --git a/data/images/shapes/octagon_f.png b/data/images/shapes/octagon_f.png new file mode 100644 index 0000000000000000000000000000000000000000..37d454ba3de56a37e71e2721c1979df4b240030b GIT binary patch literal 249 zcmeAS@N?(olHy`uVBq!ia0vp^8bB<^!3HGb?#A2&Qfx`y?k)`fL2$v|<&%LToCO|{ z#S9DrbAZ^Fao@XhSwKPd5>H=O_Ur7@Ogskl_KM{|p*Bw!$B>A_Z*Lg#H7M}3K8zQ) zowNA6J^S2(L}NF>s5LLWB|P_UTpuu>*TZ35&B{NaXQStEZW3MI^` 14 + TOOLOFFSET) { + off_y = 24; + max = 12 + TOOLOFFSET; + + dest.x = WINDOW_WIDTH - 96; + dest.y = 40; + + if (shape_scroll > 0) + { + SDL_BlitSurface(img_scroll_up, NULL, screen, &dest); + } + else + { + SDL_BlitSurface(img_scroll_up_off, NULL, screen, &dest); + } + + dest.x = WINDOW_WIDTH - 96; + dest.y = 40 + 24 + ((6 + TOOLOFFSET / 2) * 48); + + if (shape_scroll < NUM_SHAPES - 12 - TOOLOFFSET) + { + SDL_BlitSurface(img_scroll_down, NULL, screen, &dest); + } + else + { + SDL_BlitSurface(img_scroll_down_off, NULL, screen, &dest); + } + } + else + { + off_y = 0; + max = 14 + TOOLOFFSET; + } + + for (shape = shape_scroll; shape < shape_scroll + max; shape++) + { + i = shape - shape_scroll; + dest.x = ((i % 2) * 48) + WINDOW_WIDTH - 96; - dest.y = ((i / 2) * 48) + 40; + dest.y = ((i / 2) * 48) + 40 + off_y; - - if (i == cur_shape) + if (shape == cur_shape) { SDL_BlitSurface(img_btn_down, NULL, screen, &dest); } - else if (i < NUM_SHAPES) + else if (shape < NUM_SHAPES) { SDL_BlitSurface(img_btn_up, NULL, screen, &dest); } @@ -8401,18 +8438,19 @@ static void draw_shapes(void) } - if (i < NUM_SHAPES) + if (shape < NUM_SHAPES) { dest.x = ((i % 2) * 48) + 4 + WINDOW_WIDTH - 96; - dest.y = ((i / 2) * 48) + 40 + 4; + dest.y = ((i / 2) * 48) + 40 + 4 + off_y; - SDL_BlitSurface(img_shapes[i], NULL, screen, &dest); + SDL_BlitSurface(img_shapes[shape], NULL, screen, &dest); dest.x = ((i % 2) * 48) + 4 + WINDOW_WIDTH - 96 + - (40 - img_shape_names[i]->w) / 2; - dest.y = ((i / 2) * 48) + 40 + 4 + (44 - img_shape_names[i]->h); + (40 - img_shape_names[shape]->w) / 2; + dest.y = ((i / 2) * 48) + 40 + 4 + + (44 - img_shape_names[shape]->h) + off_y; - SDL_BlitSurface(img_shape_names[i], NULL, screen, &dest); + SDL_BlitSurface(img_shape_names[shape], NULL, screen, &dest); } } }