Merge commit '4e42229bdd980ab50da8b83b1aa1b0877b5a9ef6' as 'external/gainput'

This commit is contained in:
Simone
2024-01-22 08:51:55 +01:00
170 changed files with 31921 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
#include "catch.hpp"
#include <gainput/gainput.h>
using namespace gainput;
const unsigned ButtonCount = 15;
TEST_CASE("InputState", "")
{
InputState state(GetDefaultAllocator(), ButtonCount);
InputState state2(GetDefaultAllocator(), ButtonCount);
for (unsigned i = 0; i < ButtonCount; ++i)
{
REQUIRE(!state.GetBool(i));
REQUIRE(state.GetFloat(i) == 0.0f);
}
for (unsigned i = 0; i < ButtonCount; ++i)
{
const bool s = i & 1;
state.Set(i, s);
REQUIRE(state.GetBool(i) == s);
}
state2 = state;
for (unsigned i = 0; i < ButtonCount; ++i)
{
REQUIRE(state2.GetBool(i) == state.GetBool(i));
}
float s = 0.0f;
for (unsigned i = 0; i < ButtonCount; ++i)
{
state.Set(i, s);
REQUIRE(state.GetFloat(i) == s);
s += float(i)*0.0354f;
}
state2 = state;
for (unsigned i = 0; i < ButtonCount; ++i)
{
REQUIRE(state2.GetFloat(i) == state.GetFloat(i));
}
}