in C++ it's possible to pass a pointer from a function (above main() tree) to a class and have the class operate the function, the keyword "using" is used.
class Animation
{
public:
using FunctionPtr = void (*)(int x, int y, const Surface& s);
FunctionPtr DrawPointer;
...
..
.
}
in that same class, i can operate the function lower down in the three, above "main()".
void Animation::Draw(const Vei2 &pos) const{
RectI temp = frames[iCurrentFrame];
assert(DrawPointer == nullptr);
//assert(DrawPointer == nullptr && "no pointer for drawing");
if (DrawPointer2!= nullptr)
{
DrawPointer2(pos.x,pos.y,frames[iCurrentFrame], screensize, sprite); // function above main();
}
else{
//assert(std::cout << "no pointer for drawing.\n" );
}
}
can that be done also in C?