ソースを参照

fixed a crash when updating a binding that has been bound to an unexisting key/axis of an existing device

undefined
コミット
42381d33a4
1個のファイルの変更6行の追加2行の削除
  1. +6
    -2
      src/input/controller.h

+ 6
- 2
src/input/controller.h ファイルの表示

@@ -30,8 +30,10 @@ public:

void Bind(const char* device_name, const char* key_name);

bool IsBound() { return m_device && m_keyindex != -1; }

protected:
void Update() { m_previous = m_current; m_current = m_device ? m_device->GetKey(m_keyindex) : false; }
void Update() { m_previous = m_current; m_current = IsBound() ? m_device->GetKey(m_keyindex) : false; }

const InputDevice* m_device;
int m_keyindex;
@@ -51,8 +53,10 @@ public:

void Bind(const char* device_name, const char* axis_name);

bool IsBound() { return m_device && m_axisindex != -1; }

protected:
void Update() { m_previous = m_current; m_current = m_device ? m_device->GetAxis(m_axisindex) : 0.0f; }
void Update() { m_previous = m_current; m_current = IsBound() ? m_device->GetAxis(m_axisindex) : 0.0f; }

const InputDevice* m_device;
int m_axisindex;


読み込み中…
キャンセル
保存