#include "../../src/host/touch_layout.h" #include int main() { int failures = 0; auto check = [&](bool ok, const char* message) { if (!ok) { std::fprintf(stderr, "FAIL: %s\n", message); ++failures; } }; struct Screen { float width, height, inset, target; }; for (const auto screen : {Screen{640, 360, 24, 48}, Screen{800, 600, 0, 48}, Screen{1300, 600, 40, 48}, Screen{1067, 600, 32, 72}, Screen{1366, 1024, 62, 48}}) { const auto layout = mt_host::make_touch_layout(screen.width, screen.height, screen.inset, screen.target); const auto& attack = layout.buttons[0]; float previous_angle = -1000; float first_distance = 0; for (int i = 0; i < int(layout.buttons.size()); ++i) { const auto& b = layout.buttons[i]; check(b.x - b.radius >= screen.inset && b.x + b.radius <= screen.width - screen.inset && b.y - b.radius >= 0 && b.y + b.radius <= screen.height, "visible controls stay inside the safe area"); check(2 * b.radius >= screen.target - 0.01f, "controls retain minimum touch size"); if (i >= 1 && i <= 6) { check(b.y + b.radius <= screen.height - 40 * layout.scale, "skills leave the bottom status and menu strip clear"); const float dx = b.x - attack.x, dy = b.y - attack.y; const float distance = std::hypot(dx, dy); if (i == 1) first_distance = distance; check(std::abs(distance - first_distance) < 0.01f, "all six skills occupy one ring"); float angle = std::atan2(dy, dx); if (angle < 0) angle += 6.2831853f; check(angle > previous_angle, "skill order follows the arc without reversing"); previous_angle = angle; } for (int j = 0; j < i; ++j) { const auto& other = layout.buttons[j]; check(std::hypot(b.x - other.x, b.y - other.y) > 1.25f * (b.radius + other.radius), "expanded touch areas cannot activate a neighboring control"); } } } return failures ? 1 : 0; }