Adapt Android mobile controls and native client UI
This commit is contained in:
@@ -13,8 +13,8 @@ Bytes header(uint32_t bits, uint32_t r, uint32_t g, uint32_t b, uint32_t a, size
|
||||
put(out, 92, r); put(out, 96, g); put(out, 100, b); put(out, 104, a);
|
||||
return out;
|
||||
}
|
||||
mtgodot::Image decode(const Bytes& b) { return mtgodot::load_dds(b.data(), b.size()); }
|
||||
void pixel(const mtgodot::Image& im, size_t n, uint8_t r, uint8_t g, uint8_t b, uint8_t a) {
|
||||
mtimage::Image decode(const Bytes& b) { return mtimage::load_dds(b.data(), b.size()); }
|
||||
void pixel(const mtimage::Image& im, size_t n, uint8_t r, uint8_t g, uint8_t b, uint8_t a) {
|
||||
assert(im.ok()); assert(im.rgba[n*4] == r && im.rgba[n*4+1] == g && im.rgba[n*4+2] == b && im.rgba[n*4+3] == a);
|
||||
}
|
||||
int main() {
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
#include "water_depth.h"
|
||||
#include <cassert>
|
||||
#include <cstdio>
|
||||
#include <limits>
|
||||
#include <initializer_list>
|
||||
int main() {
|
||||
for (double scale : {0.25, 0.5, 1.0, 2.0}) {
|
||||
assert(mtgodot::water_depth_alpha(-1, scale) == 0);
|
||||
assert(mtgodot::water_depth_alpha(0, scale) == 0);
|
||||
assert(std::abs(mtgodot::water_depth_alpha(100 * scale, scale) - 0.25) < 1e-6);
|
||||
assert(std::abs(mtgodot::water_depth_alpha(320 * scale, scale) - 0.8) < 1e-6);
|
||||
assert(std::abs(mtgodot::water_depth_alpha(1000 * scale, scale) - 0.8) < 1e-6);
|
||||
}
|
||||
assert(mtgodot::water_depth_alpha(100, 0) == 0);
|
||||
assert(mtgodot::water_depth_alpha(std::numeric_limits<double>::quiet_NaN(), 1) == 0);
|
||||
std::puts("PASS: water depth reference (raw depth, shoreline, cap, height scale)");
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
#include "water_motion.h"
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
#include <cstdio>
|
||||
int main() {
|
||||
mtgodot::WaterMotion m;
|
||||
assert(m.sample(100, 2000, 15) == 0);
|
||||
assert(m.sample(400, 2000, 15) == 0);
|
||||
assert(m.sample(401, 2000, 15) == 0);
|
||||
assert(std::abs(m.sample(1401, 2000, 15) + .075) < 1e-9);
|
||||
assert(std::abs(m.sample(2401, 2000, 15) + .15) < 1e-9);
|
||||
assert(std::abs(m.sample(2402, 1000, 15) + .15) < 1e-9);
|
||||
assert(std::abs(m.sample(2902, 1000, 15) + .075) < 1e-9);
|
||||
assert(m.sample(3402, 1000, 15) == 0);
|
||||
// Large frame gaps start at the last rendered height, without overshoot.
|
||||
for (uint64_t t = 3403; t < 200000; t += 137) {
|
||||
const double y = m.sample(t, 1700, 9);
|
||||
assert(y <= 0 && y >= -.15);
|
||||
}
|
||||
std::puts("PASS: shared linear water motion, endpoints, timing, no overshoot");
|
||||
}
|
||||
Reference in New Issue
Block a user