#pragma once #include #include #include namespace mt_host { struct TouchCircle { float x, y, radius; }; struct TouchLayout { // Attack, six skills, auto hunt, two bottom item quick slots. std::array buttons; float scale; }; inline TouchLayout make_touch_layout(float width, float height, float safe_inset, float minimum_target) { TouchLayout layout{}; layout.scale = std::max(minimum_target / 52.0f, std::clamp(std::min(height / 600.0f, (width - 2 * safe_inset) / 800.0f), 0.65f, 1.35f)); const float s = layout.scale; const float ax = width - safe_inset - 78 * s; // Leave the original status/menu strip clear below the lowest skill. const float ay = height - 136 * s; layout.buttons[0] = {ax, ay, 44 * s}; // PORT: D2R Mobile's main-button + single skill arc arrangement, extended to six slots. // 24-degree spacing at radius 176 keeps even the expanded (1.25x) hit circles separate. for (int slot = 0; slot < 6; ++slot) { const float angle = (160.0f + 24.0f * slot) * 3.14159265f / 180.0f; layout.buttons[slot + 1] = {ax + std::cos(angle) * 176 * s, ay + std::sin(angle) * 176 * s, 28 * s}; } // Keep the settings/toggle action outside the arc, away from repeated attack taps. layout.buttons[7] = {ax - 246 * s, ay - 84 * s, 26 * s}; const float item_center = std::min(width / 2, layout.buttons[1].x - 114 * s); layout.buttons[8] = {item_center - 36 * s, height - 38 * s, 28 * s}; layout.buttons[9] = {item_center + 36 * s, height - 38 * s, 28 * s}; return layout; } } // namespace mt_host