Sign in to follow this  
JimmyRose

Joystick Problem

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this