-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathVirtualGamepad.hpp
More file actions
49 lines (37 loc) · 1.15 KB
/
Copy pathVirtualGamepad.hpp
File metadata and controls
49 lines (37 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#pragma once
//---------------------------------------------------------------------------------
// Written by Terence J. Grant - tjgrant [at] tatewake [dot] com
// Find the full tutorial at: http://gamedev.tutsplus.com/series/
//----------------------------------------------------------------------------------
class VirtualGamepad
: public tSingleton<VirtualGamepad>
{
public:
enum State
{
kCenter = 0x00,
kTop = 0x01,
kBottom = 0x02,
kLeft = 0x04,
kRight = 0x08,
kTopLeft = 0x05,
kTopRight = 0x09,
kBottomLeft = 0x06,
kBottomRight = 0x0a,
};
protected:
tPoint2f mLeftPoint;
tPoint2f mRightPoint;
int mLeftStick;
int mRightStick;
protected:
VirtualGamepad();
void DrawStickAtPoint(tSpriteBatch* spriteBatch, const tPoint2f& point, State state);
void UpdateBasedOnKeys();
public:
void draw(tSpriteBatch* spriteBatch);
void update(const tKeyboardEvent& msg);
void update(const tTouchEvent& msg);
friend class tSingleton<VirtualGamepad>;
friend class Input;
};