Skip to content

Instantly share code, notes, and snippets.

@gyakoo
Created July 16, 2015 21:09
Show Gist options
  • Save gyakoo/103be04ae0b849b82c43 to your computer and use it in GitHub Desktop.
Save gyakoo/103be04ae0b849b82c43 to your computer and use it in GitHub Desktop.
My generic c++ input driver interface for games
class gyInput : public gyReflectedObject
{
GY_PIMPL_CLASS();
GY_DECLARE_REFLECT(gyInput);
public:
gy_override int Create(gyVarDict& createParams);
gy_override void FillCreateTemplate(gyVarDict& outTemplate);
void Recycle();
gyIDInputTrigger TriggerCreate( gyInputDevice devType, gyInputIndex iindex, const gyInputTriggerOpts& opts=gyInputTriggerOpts::DEFAULT );
int TriggerCreate( gyIDInputTrigger existId, gyInputDevice devType, gyInputIndex iindex, const gyInputTriggerOpts& opts=gyInputTriggerOpts::DEFAULT );
float TriggerGet(gyIDInputTrigger triggerId);
void TriggerRelease(gyIDInputTrigger& triggerId);
bool IsDeviceConnected(gyInputDevice dev);
bool CheckCompatibilityDeviceIndex(gyInputDevice devType, gyInputIndex iindex );
// gamepad specific
void SetPadDeadZone(float deadZone);
void SetPadDeadZoneEnabled(bool status);
void SetPadNormalizeAnalogEnabled(bool status);
bool IsPadDeadZoneEnabled();
bool IsPadNormalizeAnalogEnabled();
float GetPadDeadZone();
int GetPadVibrationSupport(gyInputDevice pad);
int SetPadVibration(gyInputDevice pad, float left, float right, const gyInputPadVibrationFade* fade=0);
private:
friend class gyEngine;
gyInput();
~gyInput();
gyResourceMgr<gyInputTrigger, ID_INPUTTRIGGER> triggers;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment