diff options
author | 2017-12-01 13:22:27 +0100 | |
---|---|---|
committer | 2017-12-01 13:22:27 +0100 | |
commit | 39176274946d70ff520f265dee8fbd16d5fe0000 (patch) | |
tree | 318801d93146752050c9a492654ae3738820e3b9 /3rdparty/bx/tests/easing_test.cpp | |
parent | 6829ecb3b037d6bfbe0b84e818d17d712f71bce6 (diff) |
Updated GENie, BGFX, BX, added BIMG since it is separated now, updated all shader binaries and MAME part of code to support new interfaces [Miodrag Milanovic]
Diffstat (limited to '3rdparty/bx/tests/easing_test.cpp')
-rw-r--r-- | 3rdparty/bx/tests/easing_test.cpp | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/3rdparty/bx/tests/easing_test.cpp b/3rdparty/bx/tests/easing_test.cpp new file mode 100644 index 00000000000..9bf3c996798 --- /dev/null +++ b/3rdparty/bx/tests/easing_test.cpp @@ -0,0 +1,58 @@ +/* + * Copyright 2010-2017 Branimir Karadzic. All rights reserved. + * License: https://github.com/bkaradzic/bx#license-bsd-2-clause + */ + +#include "test.h" + +#include <bx/easing.h> +#include <bx/file.h> + +TEST_CASE("easing", "") +{ + bx::WriterI* writer = bx::getNullOut(); + + for (uint32_t ee = 0; ee < bx::Easing::Count; ++ee) + { + bx::writePrintf(writer, "\n\n%d\n", ee); + + const bx::EaseFn easing = bx::getEaseFunc(bx::Easing::Enum(ee) ); + + const int32_t nx = 64; + const int32_t ny = 10; + + bx::writePrintf(writer, "\t/// ^\n"); + + for (int32_t yy = ny+4; yy >= -5; --yy) + { + const float ys = float(yy )/float(ny); + const float ye = float(yy+1.0)/float(ny); + + bx::writePrintf(writer, "\t/// %c", yy != 0 ? '|' : '+'); + + for (int32_t xx = 0; xx < nx; ++xx) + { + int32_t jj = 0; + for (; jj < 10; ++jj) + { + const float tt = float(xx*10+jj)/10.0f/float(nx); + const float vv = easing(tt); + + if (vv >= ys + && vv < ye) + { + bx::writePrintf(writer, "*"); + break; + } + } + + if (jj == 10) + { + bx::writePrintf(writer, "%c", yy != 0 ? ' ' : '-'); + } + } + + bx::writePrintf(writer, "%s\n", yy != 0 ? "" : ">"); + } + } +} |