Added Magic tool API version API.
This commit is contained in:
parent
abf6a2a1bb
commit
73b8464b75
22 changed files with 85 additions and 172 deletions
8
Makefile
8
Makefile
|
|
@ -7,7 +7,7 @@
|
||||||
# bill@newbreedsoftware.com
|
# bill@newbreedsoftware.com
|
||||||
# http://www.tuxpaint.org/
|
# http://www.tuxpaint.org/
|
||||||
|
|
||||||
# June 14, 2002 - July 4, 2007
|
# June 14, 2002 - July 8, 2007
|
||||||
|
|
||||||
|
|
||||||
# The version number, for release:
|
# The version number, for release:
|
||||||
|
|
@ -15,6 +15,8 @@
|
||||||
VER_VERSION=0.9.18
|
VER_VERSION=0.9.18
|
||||||
VER_DATE=`date +"%Y-%m-%d"`
|
VER_DATE=`date +"%Y-%m-%d"`
|
||||||
|
|
||||||
|
MAGIC_API_VERSION=0x00000002
|
||||||
|
|
||||||
|
|
||||||
# Where to install things:
|
# Where to install things:
|
||||||
|
|
||||||
|
|
@ -139,6 +141,7 @@ DEFS=-DDATA_PREFIX=\"$(DATA_PREFIX)/\" \
|
||||||
-DCONFDIR=\"$(CONFDIR)/\" \
|
-DCONFDIR=\"$(CONFDIR)/\" \
|
||||||
-DMAGIC_PREFIX=\"$(MAGIC_PREFIX)/\" \
|
-DMAGIC_PREFIX=\"$(MAGIC_PREFIX)/\" \
|
||||||
-DVER_VERSION=\"$(VER_VERSION)\" \
|
-DVER_VERSION=\"$(VER_VERSION)\" \
|
||||||
|
-DMAGICAPI_VERSION=$(MAGIC_API_VERSION) \
|
||||||
-DVER_DATE=\"$(VER_DATE)\" \
|
-DVER_DATE=\"$(VER_DATE)\" \
|
||||||
-D$(MAEMOFLAG)
|
-D$(MAEMOFLAG)
|
||||||
|
|
||||||
|
|
@ -335,6 +338,7 @@ install-magic-plugin-dev:
|
||||||
@echo "...Installing Magic Tool plug-in development files and docs..."
|
@echo "...Installing Magic Tool plug-in development files and docs..."
|
||||||
@-rm $(BIN_PREFIX)/tp-magic-config
|
@-rm $(BIN_PREFIX)/tp-magic-config
|
||||||
@sed src/tp-magic-config.sh -e s/__VERSION__/$(VER_VERSION)/ \
|
@sed src/tp-magic-config.sh -e s/__VERSION__/$(VER_VERSION)/ \
|
||||||
|
-e s/__APIVERSION__/$(MAGIC_API_VERSION)/ \
|
||||||
-e s=__INCLUDE__=$(INCLUDE_PREFIX)/tuxpaint= > \
|
-e s=__INCLUDE__=$(INCLUDE_PREFIX)/tuxpaint= > \
|
||||||
$(BIN_PREFIX)/tp-magic-config
|
$(BIN_PREFIX)/tp-magic-config
|
||||||
@chmod a+rx,g-w,o-w $(BIN_PREFIX)/tp-magic-config
|
@chmod a+rx,g-w,o-w $(BIN_PREFIX)/tp-magic-config
|
||||||
|
|
@ -898,7 +902,7 @@ obj/resource.o: visualc/resources.rc obj visualc/resource.h
|
||||||
# Go into 'magic' subdirectory and buld magic plug-ins
|
# Go into 'magic' subdirectory and buld magic plug-ins
|
||||||
|
|
||||||
magic-plugins:
|
magic-plugins:
|
||||||
@cd magic ; make
|
@cd magic ; make MAGIC_API_VERSION=$(MAGIC_API_VERSION)
|
||||||
|
|
||||||
# Make the "obj" directory to throw the object(s) into:
|
# Make the "obj" directory to throw the object(s) into:
|
||||||
# (not necessary any more; bjk 2006.02.20)
|
# (not necessary any more; bjk 2006.02.20)
|
||||||
|
|
|
||||||
|
|
@ -477,7 +477,7 @@ install-im:
|
||||||
@cp im/ko.im $(IM_PREFIX)/ko.im
|
@cp im/ko.im $(IM_PREFIX)/ko.im
|
||||||
@chmod 644 $(IM_PREFIX)/ko.im
|
@chmod 644 $(IM_PREFIX)/ko.im
|
||||||
@#
|
@#
|
||||||
@echo " ko ...Thai..."
|
@echo " th ...Thai..."
|
||||||
@cp im/th.im $(IM_PREFIX)/th.im
|
@cp im/th.im $(IM_PREFIX)/th.im
|
||||||
@chmod 644 $(IM_PREFIX)/th.im
|
@chmod 644 $(IM_PREFIX)/th.im
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,8 @@ SO_TYPE=so
|
||||||
TP_MAGIC_CFLAGS=$(shell sdl-config --cflags) \
|
TP_MAGIC_CFLAGS=$(shell sdl-config --cflags) \
|
||||||
-I../src/ \
|
-I../src/ \
|
||||||
$(shell tp-magic-config --cflags)
|
$(shell tp-magic-config --cflags)
|
||||||
CFLAGS=-g -Wall $(TP_MAGIC_CFLAGS)
|
CFLAGS=-g -Wall $(TP_MAGIC_CFLAGS) -DMAGICAPI_VERSION=$(MAGIC_API_VERSION)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
all: negative.$(SO_TYPE) \
|
all: negative.$(SO_TYPE) \
|
||||||
|
|
|
||||||
|
|
@ -113,6 +113,11 @@ Interfaces
|
||||||
palette. (It will be called whenever one of the plguin's Magic
|
palette. (It will be called whenever one of the plguin's Magic
|
||||||
tools that accept colors becomes active, or the user picks a new
|
tools that accept colors becomes active, or the user picks a new
|
||||||
color while such a tool is currently active.)
|
color while such a tool is currently active.)
|
||||||
|
* Uint32 api_version(void)
|
||||||
|
The plugin should return an integer value representing the version
|
||||||
|
of the Tux Paint 'Magic' tool plugin API it was built against.
|
||||||
|
Simply return TP_MAGIC_API_VERSION, which is defined in
|
||||||
|
"tp_magic_api.h", to satisfy this requirement.
|
||||||
* int init(magic_api * api)
|
* int init(magic_api * api)
|
||||||
The plugin should do any initialization here. This function is
|
The plugin should do any initialization here. This function is
|
||||||
called once, at Tux Paint startup. Return '1' if initialization
|
called once, at Tux Paint startup. Return '1' if initialization
|
||||||
|
|
|
||||||
|
|
@ -143,6 +143,12 @@ would have functions whose names begin with "blur_").</p>
|
||||||
Magic tools that accept colors becomes active, or the user picks a new
|
Magic tools that accept colors becomes active, or the user picks a new
|
||||||
color while such a tool is currently active.)
|
color while such a tool is currently active.)
|
||||||
|
|
||||||
|
<li>Uint32 api_version(void)<br>
|
||||||
|
The plugin should return an integer value representing the version of
|
||||||
|
the Tux Paint 'Magic' tool plugin API it was built against.
|
||||||
|
Simply return TP_MAGIC_API_VERSION, which is defined in
|
||||||
|
"tp_magic_api.h", to satisfy this requirement.
|
||||||
|
|
||||||
<li>int init(magic_api * api)<br>
|
<li>int init(magic_api * api)<br>
|
||||||
The plugin should do any initialization here. This function is called once,
|
The plugin should do any initialization here. This function is called once,
|
||||||
at Tux Paint startup. Return '1' if initialization was successful,
|
at Tux Paint startup. Return '1' if initialization was successful,
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,9 @@ Mix_Chunk * snd_effect[NUM_TOOLS];
|
||||||
Uint8 example_r, example_g, example_b;
|
Uint8 example_r, example_g, example_b;
|
||||||
|
|
||||||
|
|
||||||
|
Uint32 example_api_version(void) { return(TP_MAGIC_API_VERSION); }
|
||||||
|
|
||||||
|
|
||||||
// No setup required:
|
// No setup required:
|
||||||
int example_init(magic_api * api)
|
int example_init(magic_api * api)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ enum {
|
||||||
Mix_Chunk * snd_effect[NUM_TOOLS];
|
Mix_Chunk * snd_effect[NUM_TOOLS];
|
||||||
|
|
||||||
|
|
||||||
// No setup required:
|
|
||||||
int blocks_chalk_drip_init(magic_api * api)
|
int blocks_chalk_drip_init(magic_api * api)
|
||||||
{
|
{
|
||||||
char fname[1024];
|
char fname[1024];
|
||||||
|
|
@ -39,6 +38,9 @@ int blocks_chalk_drip_init(magic_api * api)
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Uint32 blocks_chalk_drip_api_version(void) { return(TP_MAGIC_API_VERSION); }
|
||||||
|
|
||||||
|
|
||||||
// We have multiple tools:
|
// We have multiple tools:
|
||||||
int blocks_chalk_drip_get_tool_count(magic_api * api)
|
int blocks_chalk_drip_get_tool_count(magic_api * api)
|
||||||
{
|
{
|
||||||
|
|
@ -100,8 +102,9 @@ char * blocks_chalk_drip_get_description(magic_api * api, int which)
|
||||||
|
|
||||||
// Do the effect:
|
// Do the effect:
|
||||||
|
|
||||||
void do_example(void * ptr, int which, SDL_Surface * canvas, SDL_Surface * last,
|
void blocks_chalk_drip_linecb(void * ptr, int which,
|
||||||
int x, int y)
|
SDL_Surface * canvas, SDL_Surface * last,
|
||||||
|
int x, int y)
|
||||||
{
|
{
|
||||||
magic_api * api = (magic_api *) ptr;
|
magic_api * api = (magic_api *) ptr;
|
||||||
int xx, yy;
|
int xx, yy;
|
||||||
|
|
@ -210,7 +213,7 @@ void do_example(void * ptr, int which, SDL_Surface * canvas, SDL_Surface * last,
|
||||||
void blocks_chalk_drip_drag(magic_api * api, int which, SDL_Surface * canvas,
|
void blocks_chalk_drip_drag(magic_api * api, int which, SDL_Surface * canvas,
|
||||||
SDL_Surface * last, int ox, int oy, int x, int y)
|
SDL_Surface * last, int ox, int oy, int x, int y)
|
||||||
{
|
{
|
||||||
api->line(which, canvas, last, ox, oy, x, y, 1, do_example);
|
api->line(which, canvas, last, ox, oy, x, y, 1, blocks_chalk_drip_linecb);
|
||||||
|
|
||||||
api->playsound(snd_effect[which], (x * 255) / canvas->w, 255);
|
api->playsound(snd_effect[which], (x * 255) / canvas->w, 255);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@ int blur_init(magic_api * api)
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Uint32 blur_api_version(void) { return(TP_MAGIC_API_VERSION); }
|
||||||
|
|
||||||
int blur_get_tool_count(magic_api * api)
|
int blur_get_tool_count(magic_api * api)
|
||||||
{
|
{
|
||||||
return(1);
|
return(1);
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,8 @@ int bricks_init(magic_api * api)
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Uint32 bricks_api_version(void) { return(TP_MAGIC_API_VERSION); }
|
||||||
|
|
||||||
// We have multiple tools:
|
// We have multiple tools:
|
||||||
int bricks_get_tool_count(magic_api * api)
|
int bricks_get_tool_count(magic_api * api)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,8 @@ int cartoon_init(magic_api * api)
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Uint32 cartoon_api_version(void) { return(TP_MAGIC_API_VERSION); }
|
||||||
|
|
||||||
// We have multiple tools:
|
// We have multiple tools:
|
||||||
int cartoon_get_tool_count(magic_api * api)
|
int cartoon_get_tool_count(magic_api * api)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
156
magic/src/drip.c
156
magic/src/drip.c
|
|
@ -1,156 +0,0 @@
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <libintl.h>
|
|
||||||
#include "tp_magic_api.h"
|
|
||||||
#include "SDL_image.h"
|
|
||||||
#include "SDL_mixer.h"
|
|
||||||
|
|
||||||
/* What tools we contain: */
|
|
||||||
|
|
||||||
enum {
|
|
||||||
TOOL_ONE,
|
|
||||||
TOOL_TWO,
|
|
||||||
NUM_TOOLS
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/* Our globals: */
|
|
||||||
|
|
||||||
Mix_Chunk * snd_effect[NUM_TOOLS];
|
|
||||||
Uint8 example_r, example_g, example_b;
|
|
||||||
|
|
||||||
|
|
||||||
// No setup required:
|
|
||||||
int example_init(magic_api * api)
|
|
||||||
{
|
|
||||||
char fname[1024];
|
|
||||||
|
|
||||||
snprintf(fname, sizeof(fname), "%s/sounds/magic/one.wav",
|
|
||||||
api->data_directory);
|
|
||||||
snd_effect[0] = Mix_LoadWAV(fname);
|
|
||||||
|
|
||||||
snprintf(fname, sizeof(fname), "%s/sounds/magic/two.wav",
|
|
||||||
api->data_directory);
|
|
||||||
snd_effect[1] = Mix_LoadWAV(fname);
|
|
||||||
|
|
||||||
return(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// We have multiple tools:
|
|
||||||
int example_get_tool_count(magic_api * api)
|
|
||||||
{
|
|
||||||
return(NUM_TOOLS);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load our icons:
|
|
||||||
SDL_Surface * example_get_icon(magic_api * api, int which)
|
|
||||||
{
|
|
||||||
char fname[1024];
|
|
||||||
|
|
||||||
if (which == TOOL_ONE)
|
|
||||||
{
|
|
||||||
snprintf(fname, sizeof(fname), "%s/images/magic/one.png",
|
|
||||||
api->data_directory);
|
|
||||||
}
|
|
||||||
else if (which == TOOL_TWO)
|
|
||||||
{
|
|
||||||
snprintf(fname, sizeof(fname), "%s/images/magic/two.png",
|
|
||||||
api->data_directory);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(IMG_Load(fname));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return our names, localized:
|
|
||||||
char * example_get_name(magic_api * api, int which)
|
|
||||||
{
|
|
||||||
if (which == TOOL_ONE)
|
|
||||||
return(strdup(gettext("One")));
|
|
||||||
else if (which == TOOL_TWO)
|
|
||||||
return(strdup(gettext("Two")));
|
|
||||||
|
|
||||||
return(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return our descriptions, localized:
|
|
||||||
char * example_get_description(magic_api * api, int which)
|
|
||||||
{
|
|
||||||
if (which == TOOL_ONE)
|
|
||||||
return(strdup(gettext("Tool one.")));
|
|
||||||
else
|
|
||||||
return(strdup(gettext("Tool two.")));
|
|
||||||
|
|
||||||
return(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Do the effect:
|
|
||||||
|
|
||||||
void do_example(void * ptr, int which, SDL_Surface * canvas, SDL_Surface * last,
|
|
||||||
int x, int y)
|
|
||||||
{
|
|
||||||
magic_api * api = (magic_api *) ptr;
|
|
||||||
int xx, yy;
|
|
||||||
|
|
||||||
if (which == TOOL_ONE)
|
|
||||||
{
|
|
||||||
api->putpixel(canvas, x, y, SDL_MapRGB(canvas->format,
|
|
||||||
example_r,
|
|
||||||
example_g,
|
|
||||||
example_b));
|
|
||||||
}
|
|
||||||
else if (which == TOOL_TWO)
|
|
||||||
{
|
|
||||||
for (yy = -4; yy < 4; yy++)
|
|
||||||
{
|
|
||||||
for (xx = -4; xx < 4; xx++)
|
|
||||||
{
|
|
||||||
api->putpixel(canvas, x + xx, y + yy,
|
|
||||||
api->getpixel(last,
|
|
||||||
canvas->w - x - xx,
|
|
||||||
canvas->h - y - yy));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Affect the canvas on drag:
|
|
||||||
void example_drag(magic_api * api, int which, SDL_Surface * canvas,
|
|
||||||
SDL_Surface * last, int ox, int oy, int x, int y)
|
|
||||||
{
|
|
||||||
api->line(which, canvas, last, ox, oy, x, y, 1, do_example);
|
|
||||||
|
|
||||||
api->playsound(snd_effect[which], (x * 255) / canvas->w, 255);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Affect the canvas on click:
|
|
||||||
void example_click(magic_api * api, int which,
|
|
||||||
SDL_Surface * canvas, SDL_Surface * last,
|
|
||||||
int x, int y)
|
|
||||||
{
|
|
||||||
example_drag(api, which, canvas, last, x, y, x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
// No setup happened:
|
|
||||||
void example_shutdown(magic_api * api)
|
|
||||||
{
|
|
||||||
if (snd_effect[0] != NULL)
|
|
||||||
Mix_FreeChunk(snd_effect[0]);
|
|
||||||
|
|
||||||
if (snd_effect[1] != NULL)
|
|
||||||
Mix_FreeChunk(snd_effect[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Record the color from Tux Paint:
|
|
||||||
void example_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b)
|
|
||||||
{
|
|
||||||
example_r = r;
|
|
||||||
example_g = g;
|
|
||||||
example_b = b;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Use colors:
|
|
||||||
int example_requires_colors(magic_api * api, int which)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -29,6 +29,8 @@ int fade_darken_init(magic_api * api)
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Uint32 fade_darken_api_version(void) { return(TP_MAGIC_API_VERSION); }
|
||||||
|
|
||||||
// Multiple tools:
|
// Multiple tools:
|
||||||
int fade_darken_get_tool_count(magic_api * api)
|
int fade_darken_get_tool_count(magic_api * api)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,8 @@ int fill_init(magic_api * api)
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Uint32 fill_api_version(void) { return(TP_MAGIC_API_VERSION); }
|
||||||
|
|
||||||
// We have multiple tools:
|
// We have multiple tools:
|
||||||
int fill_get_tool_count(magic_api * api)
|
int fill_get_tool_count(magic_api * api)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,8 @@ int grass_init(magic_api * api)
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Uint32 grass_api_version(void) { return(TP_MAGIC_API_VERSION); }
|
||||||
|
|
||||||
// We have multiple tools:
|
// We have multiple tools:
|
||||||
int grass_get_tool_count(magic_api * api)
|
int grass_get_tool_count(magic_api * api)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,8 @@ int mirror_flip_init(magic_api * api)
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Uint32 mirror_flip_api_version(void) { return(TP_MAGIC_API_VERSION); }
|
||||||
|
|
||||||
// We have multiple tools:
|
// We have multiple tools:
|
||||||
int mirror_flip_get_tool_count(magic_api * api)
|
int mirror_flip_get_tool_count(magic_api * api)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,8 @@ int negative_init(magic_api * api)
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Uint32 negative_api_version(void) { return(TP_MAGIC_API_VERSION); }
|
||||||
|
|
||||||
// Only one tool:
|
// Only one tool:
|
||||||
int negative_get_tool_count(magic_api * api)
|
int negative_get_tool_count(magic_api * api)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,8 @@ int rainbow_init(magic_api * api)
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Uint32 rainbow_api_version(void) { return(TP_MAGIC_API_VERSION); }
|
||||||
|
|
||||||
// We have multiple tools:
|
// We have multiple tools:
|
||||||
int rainbow_get_tool_count(magic_api * api)
|
int rainbow_get_tool_count(magic_api * api)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,8 @@ int smudge_init(magic_api * api)
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Uint32 smudge_api_version(void) { return(TP_MAGIC_API_VERSION); }
|
||||||
|
|
||||||
// We have multiple tools:
|
// We have multiple tools:
|
||||||
int smudge_get_tool_count(magic_api * api)
|
int smudge_get_tool_count(magic_api * api)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,8 @@ int tint_init(magic_api * api)
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Uint32 tint_api_version(void) { return(TP_MAGIC_API_VERSION); }
|
||||||
|
|
||||||
// We have multiple tools:
|
// We have multiple tools:
|
||||||
int tint_get_tool_count(magic_api * api)
|
int tint_get_tool_count(magic_api * api)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
# in Tux Paint's Makefile, via 'sed', by the 'make install-magic-plugin-dev'
|
# in Tux Paint's Makefile, via 'sed', by the 'make install-magic-plugin-dev'
|
||||||
# target.
|
# target.
|
||||||
|
|
||||||
# July 5, 2007 - July 5, 2007
|
# July 5, 2007 - July 8, 2007
|
||||||
|
|
||||||
|
|
||||||
if [ $# -ne 0 ]; then
|
if [ $# -ne 0 ]; then
|
||||||
|
|
@ -37,15 +37,15 @@ if [ $# -ne 0 ]; then
|
||||||
echo "__VERSION__"
|
echo "__VERSION__"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
if [ $1 = "--apiversion" ]; then
|
||||||
|
echo "__APIVERSION__"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
if [ $1 = "--cflags" ]; then
|
if [ $1 = "--cflags" ]; then
|
||||||
echo `sdl-config --cflags` -I__INCLUDE__
|
echo `sdl-config --cflags` -I__INCLUDE__
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
if [ $1 = "--libs" ]; then
|
|
||||||
echo `sdl-config --libs`
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Usage: tp-magic-config [--version] [--cflags] [--libs]"
|
echo "Usage: tp-magic-config [--apiversion] [--version] [--cflags]"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,5 +44,7 @@ typedef struct magic_api_t {
|
||||||
void (*hsvtorgb)(float, float, float, Uint8 *, Uint8 *, Uint8 *);
|
void (*hsvtorgb)(float, float, float, Uint8 *, Uint8 *, Uint8 *);
|
||||||
} magic_api;
|
} magic_api;
|
||||||
|
|
||||||
|
#define TP_MAGIC_API_VERSION MAGICAPI_VERSION
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
(See COPYING.txt)
|
(See COPYING.txt)
|
||||||
|
|
||||||
June 14, 2002 - July 5, 2007
|
June 14, 2002 - July 8, 2007
|
||||||
$Id$
|
$Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -858,6 +858,7 @@ typedef struct magic_funcs_s {
|
||||||
int (*requires_colors)(magic_api *, int);
|
int (*requires_colors)(magic_api *, int);
|
||||||
void (*set_color)(magic_api *, Uint8, Uint8, Uint8);
|
void (*set_color)(magic_api *, Uint8, Uint8, Uint8);
|
||||||
int (*init)(magic_api *);
|
int (*init)(magic_api *);
|
||||||
|
Uint32 (*api_version)(void);
|
||||||
void (*shutdown)(magic_api *);
|
void (*shutdown)(magic_api *);
|
||||||
void (*click)(magic_api *, int, SDL_Surface *, SDL_Surface *, int, int);
|
void (*click)(magic_api *, int, SDL_Surface *, SDL_Surface *, int, int);
|
||||||
void (*drag)(magic_api *, int, SDL_Surface *, SDL_Surface *, int, int, int, int);
|
void (*drag)(magic_api *, int, SDL_Surface *, SDL_Surface *, int, int, int, int);
|
||||||
|
|
@ -8974,6 +8975,9 @@ static void reset_avail_tools(void)
|
||||||
if (num_stamps[0] == 0)
|
if (num_stamps[0] == 0)
|
||||||
tool_avail[TOOL_STAMP] = 0;
|
tool_avail[TOOL_STAMP] = 0;
|
||||||
|
|
||||||
|
if (num_magics == 0)
|
||||||
|
tool_avail[TOOL_MAGIC] = 0;
|
||||||
|
|
||||||
|
|
||||||
/* Disable quit? */
|
/* Disable quit? */
|
||||||
|
|
||||||
|
|
@ -15867,6 +15871,11 @@ void load_magic_plugins(void)
|
||||||
magic_funcs[num_plugin_files].init =
|
magic_funcs[num_plugin_files].init =
|
||||||
SDL_LoadFunction(magic_handle[num_plugin_files], funcname);
|
SDL_LoadFunction(magic_handle[num_plugin_files], funcname);
|
||||||
|
|
||||||
|
snprintf(funcname, sizeof(funcname), "%s_%s", objname,
|
||||||
|
"api_version");
|
||||||
|
magic_funcs[num_plugin_files].api_version =
|
||||||
|
SDL_LoadFunction(magic_handle[num_plugin_files], funcname);
|
||||||
|
|
||||||
snprintf(funcname, sizeof(funcname), "%s_%s", objname,
|
snprintf(funcname, sizeof(funcname), "%s_%s", objname,
|
||||||
"shutdown");
|
"shutdown");
|
||||||
magic_funcs[num_plugin_files].shutdown =
|
magic_funcs[num_plugin_files].shutdown =
|
||||||
|
|
@ -15897,6 +15906,8 @@ void load_magic_plugins(void)
|
||||||
(int) magic_funcs[num_plugin_files].set_color);
|
(int) magic_funcs[num_plugin_files].set_color);
|
||||||
printf("init = 0x%x\n",
|
printf("init = 0x%x\n",
|
||||||
(int) magic_funcs[num_plugin_files].init);
|
(int) magic_funcs[num_plugin_files].init);
|
||||||
|
printf("api_version = 0x%x\n",
|
||||||
|
(int) magic_funcs[num_plugin_files].api_version);
|
||||||
printf("shutdown = 0x%x\n",
|
printf("shutdown = 0x%x\n",
|
||||||
(int) magic_funcs[num_plugin_files].shutdown);
|
(int) magic_funcs[num_plugin_files].shutdown);
|
||||||
printf("click = 0x%x\n",
|
printf("click = 0x%x\n",
|
||||||
|
|
@ -15967,7 +15978,19 @@ void load_magic_plugins(void)
|
||||||
fname);
|
fname);
|
||||||
err = 1;
|
err = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (magic_funcs[num_plugin_files].api_version == NULL)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Error: plugin %s is missing api_version\n",
|
||||||
|
fname);
|
||||||
|
err = 1;
|
||||||
|
}
|
||||||
|
else if (magic_funcs[num_plugin_files].api_version() != TP_MAGIC_API_VERSION)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Warning: plugin %s uses Tux Paint 'Magic' tool API version %x,\nbut Tux Paint needs version %x.\n", fname, magic_funcs[num_plugin_files].api_version(), TP_MAGIC_API_VERSION);
|
||||||
|
err = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
SDL_UnloadObject(magic_handle[num_plugin_files]);
|
SDL_UnloadObject(magic_handle[num_plugin_files]);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue