mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-08-08 07:09:52 +00:00
Huge Game.cpp refactor and various other things
Started working on a tiny input/ActionMapper refactor, then everything fell apart and i ended up doing this. I'm sorry. Pretty much untested because input mapping is broken right now, will fix that next.
This commit is contained in:
parent
e2e7753226
commit
9414be864a
45 changed files with 4540 additions and 6812 deletions
|
@ -3,9 +3,15 @@
|
|||
|
||||
#include <SDL_joystick.h>
|
||||
|
||||
#ifdef BBGE_BUILD_SDL2
|
||||
#include <SDL_gamecontroller.h>
|
||||
#include <SDL_haptic.h>
|
||||
#endif
|
||||
|
||||
#include "Vector.h"
|
||||
|
||||
#define MAX_JOYSTICK_BTN 32
|
||||
#define MAX_JOYSTICK_AXIS 32
|
||||
|
||||
class Joystick
|
||||
{
|
||||
|
@ -13,25 +19,27 @@ public:
|
|||
Joystick();
|
||||
void init(int stick=0);
|
||||
void shutdown();
|
||||
//Ranges from 0 to 65535 (full speed).
|
||||
//Ranges from 0 to 1 (full speed).
|
||||
void rumble(float leftMotor, float rightMotor, float time);
|
||||
void update(float dt);
|
||||
Vector position, lastPosition;
|
||||
Vector position;
|
||||
|
||||
float deadZone1, deadZone2;
|
||||
float clearRumbleTime;
|
||||
|
||||
void callibrate(Vector &vec, float dead);
|
||||
bool anyButton();
|
||||
bool getButton(unsigned id) const { return buttonBitmask & (1u << id); }
|
||||
void calibrate(Vector &vec, float dead);
|
||||
bool anyButton() const;
|
||||
bool getButton(unsigned id) const { return !!(buttonBitmask & (1u << id)); }
|
||||
int getIndex() const { return stickIndex; }
|
||||
int getInstanceID() const { return instanceID; }
|
||||
|
||||
Vector rightStick;
|
||||
|
||||
int stickIndex;
|
||||
int s1ax, s1ay, s2ax, s2ay;
|
||||
|
||||
private:
|
||||
bool inited;
|
||||
int stickIndex;
|
||||
int instanceID;
|
||||
unsigned buttonBitmask; // FIXME: this should go
|
||||
SDL_Joystick *sdl_joy;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue