Unfortunately, we can't overload functions in C. If we could, we would only have to had a
#define graphlib_put_sprite_custom graphlib__0001 in the .h file, without writing any line of assembly.
[edit] : Oups, I wrote an imbecility.
But I thought about another way to use graphlib functions with an additional parameter :
In your .h file :
#define USE_CUSTOM_GRAPHLIB \
#undef graphlib__0000 // fill \
#undef graphlib__0017 // line \
void graphlib__0000(unsigned short x asm("d0"), unsigned short y asm("d1"), unsigned short width asm("d2"), unsigned short height asm("d3"), unsigned short color asm("d4"),void *dest asm("%a1")); \
void graphlib__0017(unsigned short x1 asm("d0"), unsigned short y1 asm("d1"), unsigned short x2 asm("d2"), unsigned short y2 asm("d3"), void *screen asm("a0"),void *dest asm("%a1"));
#define END_USE_CUSTOM_GRAPHLIB \
#undef graphlib__0000 // fill \
#undef graphlib__0017 // line \
void graphlib__0000(unsigned short x asm("d0"), unsigned short y asm("d1"), unsigned short width asm("d2"), unsigned short height asm("d3"), unsigned short color asm("d4")); \
void graphlib__0017(unsigned short x1 asm("d0"), unsigned short y1 asm("d1"), unsigned short x2 asm("d2"), unsigned short y2 asm("d3"), void *screen asm("a0"));
In your .c files :
drawSomeThing(prameters..., void * screen) {
graphlib_choose = 1;
USE_CUSTOM_GRAPHLIB;
.....
graphlib_line(.....);
.....
graphlib_line(.....);
.....
graphlib_fill(....);
END_USE_CUSTOM_GRAPHLIB;
}
(note : I didn't test it)