From c204842d2c6353438da9b112d0282e187c6e0106 Mon Sep 17 00:00:00 2001 From: Noel Date: Sat, 22 Oct 2022 23:18:52 -0700 Subject: [PATCH] adding zero_out to input bindings --- include/blah_input.h | 9 +++++++++ src/blah_input.cpp | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/include/blah_input.h b/include/blah_input.h index 768d7c2..a072852 100644 --- a/include/blah_input.h +++ b/include/blah_input.h @@ -554,6 +554,9 @@ namespace Blah // assigns all the bindings to the specific controller ButtonBinding& set_controller(int index); + // clears values (except for last input timestamps) + void zero_out(); + // removes all bindings void clear(); @@ -642,6 +645,9 @@ namespace Blah // assigns all the bindings to the specific controller AxisBinding& set_controller(int index); + // clears values (except for last input timestamps) + void zero_out() { negative.zero_out(); positive.zero_out(); } + // Clears all Bindings void clear(); }; @@ -712,6 +718,9 @@ namespace Blah // assigns all the bindings to the specific controller StickBinding& set_controller(int index); + // clears values (except for last input timestamps) + void zero_out() { x.zero_out(); y.zero_out(); } + // Clears all the bindings void clear(); }; diff --git a/src/blah_input.cpp b/src/blah_input.cpp index aeb5c82..af47e6e 100644 --- a/src/blah_input.cpp +++ b/src/blah_input.cpp @@ -583,6 +583,14 @@ ButtonBinding& ButtonBinding::set_controller(int index) return *this; } +void ButtonBinding::zero_out() +{ + m_down = false; + m_pressed = false; + m_released = false; + m_value = 0.0f; +} + void ButtonBinding::clear() { keys.clear();