Ejemplo n.º 1
0
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);
}
Ejemplo n.º 2
0
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};
}
Ejemplo n.º 3
0
#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;
}
Ejemplo n.º 4
0
Point pixelFromHex(Point hex)
{
    return pixelFromHex(hex.x, hex.y);
}