Metal Paint: Support sizes
This commit is contained in:
parent
37cf71bf07
commit
7cdfd9edf3
2 changed files with 30 additions and 9 deletions
|
|
@ -41,6 +41,7 @@ https://tuxpaint.org/
|
|||
+ Clone
|
||||
+ Confetti
|
||||
+ Googly Eyes
|
||||
+ Metal Paint
|
||||
+ Negative & Opposite
|
||||
+ Pixels
|
||||
+ Puzzle
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
(See COPYING.txt)
|
||||
|
||||
Last updated: February 12, 2023
|
||||
Last updated: April 20, 2023
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
|
@ -36,9 +36,10 @@
|
|||
|
||||
static Mix_Chunk *metalpaint_snd;
|
||||
static Uint8 metalpaint_r, metalpaint_g, metalpaint_b;
|
||||
static int metalpaint_size = 8;
|
||||
|
||||
Uint32 metalpaint_api_version(void);
|
||||
int metalpaint_init(magic_api * api);
|
||||
int metalpaint_init(magic_api * api, Uint32 disabled_features);
|
||||
int metalpaint_get_tool_count(magic_api * api);
|
||||
SDL_Surface *metalpaint_get_icon(magic_api * api, int which);
|
||||
char *metalpaint_get_name(magic_api * api, int which);
|
||||
|
|
@ -64,6 +65,9 @@ void metalpaint_switchin(magic_api * api, int which, int mode,
|
|||
void metalpaint_switchout(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas);
|
||||
int metalpaint_modes(magic_api * api, int which);
|
||||
Uint8 metalpaint_accepted_sizes(magic_api * api, int which, int mode);
|
||||
Uint8 metalpaint_default_size(magic_api * api, int which, int mode);
|
||||
void metalpaint_set_size(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * last, Uint8 size, SDL_Rect * update_rect);
|
||||
|
||||
|
||||
Uint32 metalpaint_api_version(void)
|
||||
|
|
@ -73,7 +77,7 @@ Uint32 metalpaint_api_version(void)
|
|||
|
||||
|
||||
// No setup required:
|
||||
int metalpaint_init(magic_api * api)
|
||||
int metalpaint_init(magic_api * api, Uint32 disabled_features)
|
||||
{
|
||||
char fname[1024];
|
||||
|
||||
|
|
@ -147,9 +151,9 @@ static void do_metalpaint(void *ptr, int which ATTRIBUTE_UNUSED,
|
|||
int n;
|
||||
Uint8 r, g, b;
|
||||
|
||||
for (yy = -8; yy < 8; yy++)
|
||||
for (yy = -metalpaint_size; yy < metalpaint_size; yy++)
|
||||
{
|
||||
for (xx = -8; xx < 8; xx++)
|
||||
for (xx = -metalpaint_size; xx < metalpaint_size; xx++)
|
||||
{
|
||||
n = metalpaint_gradient[((x + xx + y + yy) / 4) % METALPAINT_CYCLE];
|
||||
|
||||
|
|
@ -186,10 +190,10 @@ void metalpaint_drag(magic_api * api, int which, SDL_Surface * canvas,
|
|||
y = tmp;
|
||||
}
|
||||
|
||||
update_rect->x = ox - 8;
|
||||
update_rect->y = oy - 8;
|
||||
update_rect->w = (x + 8) - update_rect->x;
|
||||
update_rect->h = (y + 8) - update_rect->y;
|
||||
update_rect->x = ox - metalpaint_size;
|
||||
update_rect->y = oy - metalpaint_size;
|
||||
update_rect->w = (x + metalpaint_size) - update_rect->x;
|
||||
update_rect->h = (y + metalpaint_size) - update_rect->y;
|
||||
|
||||
api->playsound(metalpaint_snd, (x * 255) / canvas->w, 255);
|
||||
}
|
||||
|
|
@ -254,3 +258,19 @@ int metalpaint_modes(magic_api * api ATTRIBUTE_UNUSED,
|
|||
{
|
||||
return (MODE_PAINT);
|
||||
}
|
||||
|
||||
|
||||
Uint8 metalpaint_accepted_sizes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
|
||||
Uint8 metalpaint_default_size(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
void metalpaint_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)
|
||||
{
|
||||
metalpaint_size = size * 4;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue