Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

xSKOTTIEx

passing pointer of function?

This topic is 5220 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i am using the HGE game engine to make my next game, but the function that you have to call to set the framefuction (the function that it calls every frame), is giving me an INTERNAL COMPILER ERROR when i try to pass the function as the parameter. does it have anything to do with the function pointer being a method in the same class the function is being called from? hgeBase::hgeBase(bool windowed, char* title) { //Creates Game Engine Object hge = hgeCreate(HGE_VERSION); //Sets System states //THIS LINE, FRAMEFUNC is the POINTER TO FUNCTION hge->System_SetState(HGE_FRAMEFUNC, FrameFunc); hge->System_SetState(HGE_WINDOWED, windowed); hge->System_SetState(HGE_USESOUND, false); hge->System_SetState(HGE_TITLE, title); } //frameFunction bool hgeBase::FrameFunc() { if (hge->Input_GetKeyState(HGEK_ESCAPE)) return true; return false; } any insight?

Share this post


Link to post
Share on other sites
Advertisement
Yes, troubles arise when passing member functions. Making it a friend should work (Way I did it). But I think using hgeBase::FrameFunc may also work.

[edited by - MetaCipher on June 5, 2004 12:13:38 AM]

Share this post


Link to post
Share on other sites
If you use VC6, install the latest service pack. That should take care of the internal error and give you a ''normal'' error instead.

I believe that the function you are calling wants an ordinary function pointer (a pointer to a global function or a static member function)

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!