在一个简单的OpenGL程序我有下面这行:glutKeyboardfunc()回调函数参数
glutKeyboardFunc(keypressed);
问题是我的“的keyPressed”功能在另一个CPP文件中包含项目。我怎样才能从我的其他文件调用这个功能?
在main.cpp中:
main()
{
---
glutKeyboardFunc(keypressed);
---
}
在Motion.cpp:
void keypressed(unsigned char key, int x, int y){...}
事情我尝试(一切都给编译错误):
glutKeyboardFunc(keypressed);
glutKeyboardFunc(Motion::keypressed);
glutKeyboardFunc(&Motion::keypressed);
glutKeyboardFunc(&keypressed);
Motion mot;
glutKeyboardFunc(mot.keypressed);
有什么建议? (我使用freeglut.dll如果库问题的答案)
制作一个具有函数声明的'Motion.h'文件。 –