//This class sets up a camera and uses DirectInput
//to rotate, and move the camera
#include<dinput.h>
#include<windows.h>
#define DXERRORCHK(function,type) if(FAILED(function)){MessageBox(NULL,type,"Error",MB_OK); return false;}
class CCamera
{
public:
bool Initialize(HINSTANCE hInstance);
private:
IDirectInput8 *p_iDInput8; //Create a pointer to an instance of a dinput object
IDirectInputDevice8 *p_iDInputDevice8;
};
bool CCamera::Initialize(HINSTANCE hInstance)
{
//Create the dinput object
DirectInput8Create(hInstance, DIRECTINPUT_VERSION, IID_DirectInput8,
(VOID**)p_iDInput8,NULL);
//Create our keyboard device
DXERRORCHK(p_iDInput->CreateDevice(GUID_SysKeyboard,&p_iDInputDevice8,NULL),
"Failed to create keyboard device");
//Set data format
DXERRORCHK(p_iDInputDevice8->SetFormat(&c_dfDIKeyboard),
"Failed to set keyboard format");
}
Bad Monkey Productions
Compile error /dinput)
Okay, I know this is kinda stupid but I get a "missing ; before *" error when I run this code. I´m linking dinput8.lib and the header dinput.h (as you can see below). I´m really tired so plz don´t hit me for asking what I´ve missed.
Just a thought, but if you''re providing the paths to the DirectX SDK by using the Tools->Options->Directories tab (in vc6 at least), make sure the SDK entries are above the visual studio directories.
If you don''t, the compiler includes the DirectX files that came with VC6, which will be DirectX v3, which won''t have any DInput8 stuff.
Of course, if you''re not using visual studio, this is all guff...
If you don''t, the compiler includes the DirectX files that came with VC6, which will be DirectX v3, which won''t have any DInput8 stuff.
Of course, if you''re not using visual studio, this is all guff...
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement