mirror of
https://github.com/GayPizzaSpecifications/padlab.git
synced 2025-08-03 21:21:33 +00:00
Separate stick functionality from main file
This commit is contained in:
41
stick.h
Normal file
41
stick.h
Normal file
@ -0,0 +1,41 @@
|
||||
#ifndef STICK_H
|
||||
#define STICK_H
|
||||
|
||||
#include "maths.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
// common
|
||||
vector rawpos, compos;
|
||||
bool recalc;
|
||||
|
||||
// analogue
|
||||
double preaccel, postacel;
|
||||
double accelpow;
|
||||
double deadzone;
|
||||
|
||||
// digital
|
||||
double digiangle;
|
||||
double digideadzone;
|
||||
} StickState;
|
||||
|
||||
inline void InitDefaults(StickState* p)
|
||||
{
|
||||
p->rawpos = (vector){0.0, 0.0};
|
||||
p->compos = (vector){0.0, 0.0};
|
||||
|
||||
p->recalc = true;
|
||||
p->preaccel = 0.0;
|
||||
p->postacel = 0.0;
|
||||
p->accelpow = 1.25;
|
||||
p->deadzone = 0.125;
|
||||
|
||||
p->digiangle = sqrt(2.0) - 1.0;
|
||||
p->digideadzone = 0.5;
|
||||
}
|
||||
|
||||
void DrawAnalogue(const rect* win, StickState* p);
|
||||
void DrawDigital(const rect* win, StickState* p);
|
||||
|
||||
#endif//STICK_H
|
Reference in New Issue
Block a user