mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2025-12-12 09:48:51 +01:00
31 lines
562 B
C++
31 lines
562 B
C++
#include "JoyAxisHandler.h"
|
|
|
|
/*
|
|
JoyAxisHandler::JoyAxisHandler(SDL_JoystickID joyid, Uint8 axis, Sint16 min, Sint16 max)
|
|
: joyid_(joyid)
|
|
, axis_(axis)
|
|
, min_(min)
|
|
, max_(max)
|
|
, pressed_(false)
|
|
{
|
|
}
|
|
|
|
void JoyAxisHandler::reset()
|
|
{
|
|
pressed_= false;
|
|
}
|
|
|
|
bool JoyAxisHandler::update(SDL_Event &e)
|
|
{
|
|
if(e.type != SDL_JOYAXISMOTION || (joyid_ != -1 && e.jaxis.which != joyid_) || e.jaxis.axis != axis_) return false;
|
|
pressed_ = (min_ <= e.jaxis.value && e.jaxis.value <= max_);
|
|
|
|
return true;
|
|
}
|
|
|
|
bool JoyAxisHandler::pressed()
|
|
{
|
|
return pressed_;
|
|
}
|
|
*/
|