Jump to content
  • Advertisement

Archived

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

nightsonic

Direct Input 8 woes....

This topic is 5997 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 trying to write some DirectX Wrappers and I am having trouble..... I am still new to the whole programming thing so any help would be apreciated... here is my problem.... I have a class called WinterDreamsInput In WinterDreamsInput I have a function that looks like this // This is what I will use to init the joystick bool WinterDreamsInput::DirectInputInitJoystick(HWND Main_Window_Handle); and a function that looks like this // This is a function the Direct input docs say you have to // have.... WinterDreamsInput::BOOL CALLBACK EnumJoysticksCallback(const DIDEVICEINSTANCE* pdidInstance, VOID* pContext) bool WinterDreamsInput::DirectInputInitJoystick(HWND Main_Window_Handle) { //First step enum devices if(dinputobject->EnumDevices(DI8DEVCLASS_GAMECTRL, EnumJoysticksCallback, NULL, DIEDFL_ATTACHEDONLY) != DI_OK) return false; return true; } Ok here is my problem.... I already set the Callback function up but when I compile i get this error.... c:\test\winterdreamsinput.cpp(66) : error C2664: ''EnumDevices'' : cannot convert parameter 2 from ''int (const struct DIDEVICEINSTANCEA *,void *)'' to ''int (__stdcall *)(const struct DIDEVICEINSTANCEA *,void *)'' Can anyone help me out and tell me why I get this error? Thanks!

Share this post


Link to post
Share on other sites
Advertisement
i dont really understand callback functions that well, but it seems as if your problem is having a function pointer as a member function, and you can search the forums for some threads on them

Share this post


Link to post
Share on other sites
You need to use __stdcall modifier. You can get it another way by using WINAPI, which is #defined to __stdcall:

bool __stdcall SomeFn(...);
bool WINAPI SomeFn(...);

I think the second way is the recommended one.

Share this post


Link to post
Share on other sites
Psybr should be right, you can''t pass a non static method to a callback that expects a non member function. Has been disussed sveral times.

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!