Jump to content
  • Advertisement
Sign in to follow this  
JimmyRose

Joystick Problem

This topic is 3068 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

Hello, I'm trying to use DirectInput to use a PS3 Controller in my game but I'm getting stuck I've had some help but I still don't understand it. Here's the code: BOOL CALLBACK EnumJoysticksCallback(const DIDEVICEINSTANCE* pdidInstance, VOID* pContext) { HRESULT hr; // Obtain an interface to the enumerated joystick. hr = din->CreateDevice(pdidInstance->guidInstance, &joystick, NULL); if(FAILED(hr)) return DIENUM_CONTINUE; return DIENUM_STOP; } // Look for the first simple joystick we can find. hr = din->EnumDevices( DI8DEVCLASS_GAMECTRL, EnumJoysticksCallback, this, DIEDFL_ATTACHEDONLY); // Make sure we got a joystick if (joystick == NULL) { printf("Joystick not found.\n"); } error C3867: 'CDirectX::EnumJoysticksCallback': function call missing argument list; use '&CDirectX::EnumJoysticksCallback' to create a pointer to member Can anyone help me please.

Share this post


Link to post
Share on other sites
Advertisement
After using some help from else where I got this and now it's a new problem.

In the header:
static BOOL CALLBACK EnumJoysticksCallback(const DIDEVICEINSTANCE* pDIInst, VOID* pContext);

In the cpp:
BOOL CDirectX::EnumJoysticksCallback(const DIDEVICEINSTANCE* pdidInstance, VOID* pContext)
{
CDirectX* pThis = (CDirectX*)pContext;


// Obtain an interface to the enumerated joystick.
if(FAILED (pThis->din->CreateDevice(pdidInstance->guidInstance, pThis->&joystick, NULL)))
{
//ONMESSAGE("cannont obtain joystick intefaces","error:dxinput");
return DIENUM_STOP;
}
return DIENUM_CONTINUE;

}


These are the errors I'm getting:

I know it starts all right here I have no idea why is wont recognize '&'

error C2059: syntax error : '&'
error C2143: syntax error : missing ';' before '{'
error C2039: 'HINSTANCE' : is not a member of 'CDirectX'see declaration of 'CDirectX'
error C2146: syntax error : missing ')' before identifier 'hInstance'
error C2761: 'void CDirectX::initDInput(HINSTANCE,HWND)' : member function redeclaration not allowed
error C2059: syntax error : ')'
error C2143: syntax error : missing ';' before '{'
error C2447: '{' : missing function header (old-style formal list?)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!