I''ve got a working 3D Engine. Now the next thing to add was DirectInput functionality. In the beginning only for the keyboard. I''ve added the following code (which is important for the speed I think).
// Macros
#define KeyDown(data, n) ((data[n] & 0x80) ? true : false)
#define KeyUp(data, n) ((data[n] & 0x80) ? false : true)
// Globals
LPDIRECTINPUT lpdi;
LPDIRECTINPUTDEVICE m_keyboard;
unsigned char keystate[256];
This for the "initialisation part". Then I''ve ONLY added the following in the Render loop:
if (FAILED(m_keyboard->GetDeviceState(sizeof(unsigned char[256]), (LPVOID)keystate))) //{ return; }
if (KeyDown(keystate, DIK_LCONTROL)) { return; }
This 2 rules in the render loop, makes my framerate drop from 86fps to 71fps, a difference of 15fps! And as you can see, I''m not doing very much yet with the keyboard input.
Is this cause of DirectInput, or can I just not program? :D And what can I do about it
Thnx!