Khaotic Engine Reborn
Loading...
Searching...
No Matches
input_class.h
1#ifndef _INPUTCLASS_H_
2#define _INPUTCLASS_H_
3
5// PRE-PROCESSING DIRECTIVES //
7#define DIRECTINPUT_VERSION 0x0800
8
10// LINKING //
12#pragma comment(lib, "dinput8.lib")
13#pragma comment(lib, "dxguid.lib")
14
16// INCLUDES //
18#include "Logger.h"
19#include <dinput.h>
20
22// Class name: input_class
25{
26public:
30
31 virtual bool Initialize(HINSTANCE, HWND, int, int);
32 virtual void Shutdown();
33 virtual bool Frame();
34
35 bool IsEscapePressed() const;
36 void GetMouseLocation(int&, int&) const;
37 bool IsLeftMousePressed() const;
38 bool IsRightMousePressed() const;
39 void KeyDown(unsigned int);
40 void KeyUp(unsigned int);
41 bool IsLeftArrowPressed() const;
42 bool IsRightArrowPressed() const;
43 bool IsScrollUp() const;
44 bool IsScrollDown() const;
45 bool IsUpArrowPressed() const;
46 bool IsDownArrowPressed() const;
47 bool IsAPressed() const;
48 bool IsDPressed() const;
49 bool IsWPressed() const;
50 bool IsSPressed() const;
51 bool IsQPressed() const;
52 bool IsEPressed()const;
53 bool IsKeyDown(unsigned int) const;
54 bool is_key_pressed(const unsigned int);
55
56private:
57 bool m_keys[256];
58
59 bool ReadKeyboard();
60 bool ReadMouse();
61 void ProcessInput();
62
63private:
64 IDirectInput8* m_directInput;
65 IDirectInputDevice8* m_keyboard;
66 IDirectInputDevice8* m_mouse;
67
68 unsigned char m_keyboardState[256];
69 DIMOUSESTATE m_mouseState;
70
71 int m_screenWidth, m_screenHeight, m_mouseX, m_mouseY;
72 bool m_previousTildeState;
73
74};
75
76#endif