Getting Xinput inside a C++ class
here its the class header file
#include <XInput.h>// new xinput
//--
// Name: class Controller
// Desc: Handles game input
//--
class Controller
{
public:
static VOID SetVibration( INT i, FLOAT fLeft, FLOAT fRight );
};
and the class file
#include ".\controller.h"
#include <XInput.h>// xinput class
VOID Controller::SetVibration( INT i, FLOAT fLeft, FLOAT fRight ) // static
{
XINPUT_VIBRATION vibration;
ZeroMemory( &vibration, sizeof(XINPUT_VIBRATION) );
vibration.wLeftMotorSpeed = 32000; // use any value between 0-65535 here
vibration.wRightMotorSpeed = 16000; // use any value between 0-65535 here
XInputSetState( i, &vibration );
}
and here are the error it produces
Compiling...
controller.cpp
c:\Program Files\Microsoft Platform SDK\Include\WinNT.h(3857) : error C2146: syntax error : missing ';' before identifier 'ContextRecord'
c:\Program Files\Microsoft Platform SDK\Include\WinNT.h(3857) : error C2501: '_EXCEPTION_POINTERS::PCONTEXT' : missing storage-class or type specifiers
c:\Program Files\Microsoft Platform SDK\Include\WinNT.h(3857) : error C2501: '_EXCEPTION_POINTERS::ContextRecord' : missing storage-class or type specifiers
c:\Program Files\Microsoft Platform SDK\Include\WinNT.h(8319) : error C2065: 'PCONTEXT' : undeclared identifier
c:\Program Files\Microsoft Platform SDK\Include\WinNT.h(8320) : error C2146: syntax error : missing ')' before identifier 'ContextRecord'
c:\Program Files\Microsoft Platform SDK\Include\WinNT.h(8320) : warning C4229: anachronism used : modifiers on data are ignored
c:\Program Files\Microsoft Platform SDK\Include\WinNT.h(8320) : error C2182: 'RtlCaptureContext' : illegal use of type 'void'
c:\Program Files\Microsoft Platform SDK\Include\WinNT.h(8320) : error C2491: 'RtlCaptureContext' : definition of dllimport data not allowed
c:\Program Files\Microsoft Platform SDK\Include\WinNT.h(8320) : error C2059: syntax error : ')'
c:\Program Files\Microsoft Platform SDK\Include\WinNT.h(9594) : error C3861: '__readfsdword': identifier not found, even with argument-dependent lookup
d:\Anner files\programming\Tools\dxsdk_jun2006\Samples\C++\XInput\RumbleController\controller.cpp(10) : error C3861: 'ZeroMemory': identifier not found, even with argument-dependent lookup

