[Tuxpaint-devel] plug-in API changes
An award-winning drawing program for children of all ages
Brought to you by:
wkendrick
|
From: Albert C. <aca...@gm...> - 2008-05-11 21:42:47
|
I'm planning to change things as follows. I hope it
does not cause trouble for anybody. Let me know
if you see any problems.
//////////////////////////////////////////
static int bigbricks_click(int x, int y, SDL_Rect * update_rect){
....
}
static int smallbricks_click(int x, int y, SDL_Rect * update_rect){
....
}
static int bigbricks_release(int x, int y, SDL_Rect * update_rect){
....
}
static int smallbricks_release(int x, int y, SDL_Rect * update_rect){
....
}
static struct fns{
.click = bigbricks_click;
.release = bigbricks_release;
...
}bigbricks;
static struct fns{
.click = smallbricks_click;
.release = smallbricks_release;
...
}smallbricks;
// see below for what PLUG_FUNCTION is about
void PLUG_FUNCTION init(...){
register_magic(&bigbricks);
register_magic(&smallbricks);
}
////////////////////////////////////////
Note that left-out functions become NULL. The core
can substitute do-nothing functions as required, or
just check for NULL. (checking at every call is messier
there, but would allow for a const struct that can be
directly used)
The tools call directly into the core. To enable this,
various core functions are marked for export, essentially
like this:
#ifdef WIN32
__declspec(dllexport)
#else
__attribute__((visibility(default)))
#endif
(with a proper define of course, under Makefile control)
That should allow hidden visibility to work, which will
slightly improve start-up performance.
The real goal here is to simplify the problem of making
it possible to build Tux Paint with all the tools compiled in.
|