
implementation de l'acceleration, de la masse (je sais pas si c'est une bonne facon de faire mais on va dire oui) mouvements avec un code tres sale dans application class frame
71 lines
1.5 KiB
C++
71 lines
1.5 KiB
C++
#ifndef _INPUTCLASS_H_
|
|
#define _INPUTCLASS_H_
|
|
|
|
///////////////////////////////
|
|
// PRE-PROCESSING DIRECTIVES //
|
|
///////////////////////////////
|
|
#define DIRECTINPUT_VERSION 0x0800
|
|
|
|
/////////////
|
|
// LINKING //
|
|
/////////////
|
|
#pragma comment(lib, "dinput8.lib")
|
|
#pragma comment(lib, "dxguid.lib")
|
|
|
|
//////////////
|
|
// INCLUDES //
|
|
//////////////
|
|
#include <dinput.h>
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// Class name: InputClass
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
class InputClass
|
|
{
|
|
public:
|
|
InputClass();
|
|
InputClass(const InputClass&);
|
|
~InputClass();
|
|
|
|
bool Initialize(HINSTANCE, HWND, int, int);
|
|
void Shutdown();
|
|
bool Frame();
|
|
|
|
bool IsEscapePressed();
|
|
void GetMouseLocation(int&, int&);
|
|
bool IsLeftMousePressed();
|
|
bool IsRightMousePressed();
|
|
void KeyDown(unsigned int);
|
|
void KeyUp(unsigned int);
|
|
bool IsLeftArrowPressed();
|
|
bool IsRightArrowPressed();
|
|
bool IsUpArrowPressed();
|
|
bool IsDownArrowPressed();
|
|
bool IsAPressed();
|
|
bool IsDPressed();
|
|
bool IsWPressed();
|
|
bool IsSPressed();
|
|
bool IsQPressed();
|
|
bool IsEPressed();
|
|
|
|
bool IsKeyDown(unsigned int);
|
|
|
|
private:
|
|
bool m_keys[256];
|
|
|
|
bool ReadKeyboard();
|
|
bool ReadMouse();
|
|
void ProcessInput();
|
|
|
|
private:
|
|
IDirectInput8* m_directInput;
|
|
IDirectInputDevice8* m_keyboard;
|
|
IDirectInputDevice8* m_mouse;
|
|
|
|
unsigned char m_keyboardState[256];
|
|
DIMOUSESTATE m_mouseState;
|
|
|
|
int m_screenWidth, m_screenHeight, m_mouseX, m_mouseY;
|
|
};
|
|
|
|
#endif |