Space Fighter
A "shmup" game for Computer Programming C++
Loading...
Searching...
No Matches
GamePadState.h
Go to the documentation of this file.
1
2/*
3 ██╗ ██╗ █████╗ ████████╗ █████╗ ███╗ ██╗ █████╗
4 ██║ ██╔╝ ██╔══██╗ ╚══██╔══╝ ██╔══██╗ ████╗ ██║ ██╔══██╗
5 █████╔╝ ███████║ ██║ ███████║ ██╔██╗ ██║ ███████║
6 ██╔═██╗ ██╔══██║ ██║ ██╔══██║ ██║╚██╗██║ ██╔══██║
7 ██║ ██╗ ██║ ██║ ██║ ██║ ██║ ██║ ╚████║ ██║ ██║
8 ╚═╝ ╚═╝ ╚═╝ ╚═╝/\ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝
9 /vvvvvvvvvvvvvvvvvvv \=========================================,
10 `^^^^^^^^^^^^^^^^^^^ /---------------------------------------"
11 Katana Engine \/ © 2012 - Shuriken Studios LLC
12 http://www.shurikenstudios.com
13*/
14
15#pragma once
16
17namespace KatanaEngine
18{
26 enum class ButtonState
27 {
28 PRESSED,
30 };
31
39 enum class Button
40 {
41 A,
42 B,
43 X,
44 Y,
45 START,
46 BACK,
51 DPAD_UP,
52 DPAD_DOWN,
53 DPAD_LEFT,
55 };
56
71
80 {
81 float Left;
82 float Right;
83 };
84
97
120
129 {
135 ALLEGRO_JOYSTICK *ID;
140 bool IsButtonDown(Button button) const
141 {
142 switch (button)
143 {
144 case Button::A: return (Buttons.A == ButtonState::PRESSED);
145 case Button::B: return (Buttons.B == ButtonState::PRESSED);
146 case Button::X: return (Buttons.X == ButtonState::PRESSED);
147 case Button::Y: return (Buttons.Y == ButtonState::PRESSED);
148
151
156
161 }
162
163 return false;
164 }
165
169 bool IsButtonUp(Button button) const { return !IsButtonDown(button); }
170
197 };
198}
Defines a vector with 2 components (x and y).
Definition Vector2.h:21
static const Vector2 ZERO
A vector with both of its components set to zero.
Definition Vector2.h:31
Katana Engine is a library of classes, interfaces, and value types that provides a foundation for dev...
Definition Animation.cpp:18
Button
Defines the buttons for an Xbox Controller.
ButtonState
Defines the possible states of a Button.
Identifies whether buttons on an Xbox Controller are pressed or released.
Identifies which directions on the directional pad of an Xbox Controller are being pressed.
Represents specific information about the state of an Xbox Controller, including the current state of...
GamePadButtons Buttons
The current state of the GamePad's Buttons.
bool IsButtonDown(Button button) const
Determines if a button is pressed down.
GamePadDPad DPad
The current state of the GamePad's DPad.
bool IsButtonUp(Button button) const
Determines if a button is up.
ALLEGRO_JOYSTICK * ID
The underlaying allegro joystick id.
bool IsConnected
True if the GamePad is connected, false otherwise.
GamePadThumbSticks Thumbsticks
The current state of the GamePad's Thumbsticks.
GamePadTriggers Triggers
The current state of the GamePad's Triggers.
Structure that represents the position of left and right sticks (thumbsticks) on an Xbox Controller.
Structure that defines the position of the left and right triggers on an Xbox Controller.