Title says it all.Sorry for wrong title.
I am trying to create element POWR. It will obtain graphics function of its ctype.
//#TPT-Directive ElementHeader Element_POWR static int graphics(GRAPHICS_FUNC_ARGS)
int Element_POWR::graphics(GRAPHICS_FUNC_ARGS) {
if (cpart->ctype != 0) {
Element pElement = ren->sim->elements[cpart->ctype];
*colr = PIXR(pElement.Colour);
*colg = PIXG(pElement.Colour);
*colb = PIXB(pElement.Colour);
>>>>>> return (*(pElement.Graphics)(GRAPHICS_FUNC_SUBCALL_ARGS)); }
else return 0; ^
}
Got error: at >>>>>>: [column ^] error: invalid type argument of unary '*' (have 'int')
How to fix?
Thanks, but it creates a blue screen?
int Element_POWR::graphics(GRAPHICS_FUNC_ARGS)
{
if (cpart->ctype != 0)
{
//Create a temp. particle and do a subcall.
Particle tpart;
int t;
memset(&tpart, 0, sizeof(Particle));
tpart.type = cpart->ctype;
tpart.temp = cpart->temp;
tpart.life = cpart->life;
tpart.tmp = cpart->tmp;
tpart.ctype = 0;
if (tpart.type == PT_PHOT && tpart.ctype == 0x40000000)
tpart.ctype = 0x3FFFFFFF;
t = tpart.type;
if (ren->graphicscache[t].isready)
{
*pixel_mode = ren->graphicscache[t].pixel_mode;
*cola = ren->graphicscache[t].cola;
*colr = ren->graphicscache[t].colr;
*colg = ren->graphicscache[t].colg;
*colb = ren->graphicscache[t].colb;
*firea = ren->graphicscache[t].firea;
*firer = ren->graphicscache[t].firer;
*fireg = ren->graphicscache[t].fireg;
*fireb = ren->graphicscache[t].fireb;
}
else
{
*colr = PIXR(ren->sim->elements[t].Colour);
*colg = PIXG(ren->sim->elements[t].Colour);
*colb = PIXB(ren->sim->elements[t].Colour);
if (ren->sim->elements[t].Graphics)
{
return (*(ren->sim->elements[t].Graphics))(ren, &tpart, nx, ny, pixel_mode, cola, colr, colg, colb, firea, firer, fireg, fireb);
}
else
{
return Element::defaultGraphics(ren, &tpart, nx, ny, pixel_mode, cola, colr, colg, colb, firea, firer, fireg, fireb);
}
}
}
}