double hexAngle_rad(const Point &h1, const Point &h2) { // Our coordinate system has y-axis increasing as you go down the screen, // so we need to flip it to align with the cartesian plane. auto p1 = pixelFromHex(h1); auto p2 = pixelFromHex(h2); return atan2(p1.y - p2.y, p2.x - p1.x); }
Point Battlefield::sPixelFromHex(int hx, int hy) const { auto basePixel = pixelFromHex(hx, hy); int px = basePixel.x + displayArea_.x; int py = basePixel.y + displayArea_.y; return {px, py}; }
#include "chasecolours.hpp" const pixelColor_t ChaseColours::chase_colours[] = { pixelFromHex(Yellow), pixelFromHex(Green), pixelFromHex(HotPink), pixelFromHex(Blue), pixelFromHex(Red), pixelFromHex(White) }; void ChaseColours::next() { ++idx; if (idx >= sizeof(chase_colours)/sizeof(pixelColor_t)) idx = 0; }
Point pixelFromHex(Point hex) { return pixelFromHex(hex.x, hex.y); }