I've written a array function to draw openGL code outside without the need to add the function in the Windows' mainloop every time a new function has been made.
It works ok, but when I am pointing it to an public void function in another class, it is saying 'reference to non-static member function must be called'.
Code:
int main(int argc, const char * argv[])
{
Window* win = new Window(800, 600, "3D Game Engine");
Game game;
win->draw[0] = a;
win->draw[1] = game.render;
win->MainLoop();
delete win;
}
Draw function:
typedef void (*function_ptr)(int);
function_ptr *draw = (function_ptr*)malloc(sizeof(function_ptr));
Are there ways to call it?
Thanks
std::function.