forked from ptitSeb/stuntcarremake
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathXBOXController.h
More file actions
34 lines (29 loc) · 807 Bytes
/
Copy pathXBOXController.h
File metadata and controls
34 lines (29 loc) · 807 Bytes
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
#ifndef _XBOX_CONTROLLER_H_
#define _XBOX_CONTROLLER_H_
// No MFC
#define WIN32_LEAN_AND_MEAN
// We need the Windows Header and the XInput Header
#ifdef linux
#include <SDL/SDL.h>
#define XINPUT_STATE int
#else
#include <windows.h>
#include <XInput.h>
#endif
// Now, the XInput Library
// NOTE: COMMENT THIS OUT IF YOU ARE NOT USING A COMPILER THAT SUPPORTS THIS METHOD OF LINKING LIBRARIES
#pragma comment(lib, "XInput.lib")
// XBOX Controller Class Definition
class CXBOXController
{
private:
XINPUT_STATE _controllerState;
int _controllerNum;
public:
// ctor - playerNumber 1<>4
CXBOXController(const int playerNumber);
XINPUT_STATE GetState();
bool IsConnected();
void Vibrate(const unsigned short leftVal = 0, const unsigned short rightVal = 0);
};
#endif