FastLED 3.9.15
Loading...
Searching...
No Matches

◆ draw() [2/2]

template<typename XYVisitor>
void fl::Tile2x2_u8::draw ( const XYMap & xymap,
XYVisitor & visitor ) const
inline

Definition at line 65 of file tile2x2.h.

65 {
66 for (u16 x = 0; x < 2; ++x) {
67 for (u16 y = 0; y < 2; ++y) {
68 u8 value = at(x, y);
69 if (value > 0) {
70 int xx = mOrigin.x + x;
71 int yy = mOrigin.y + y;
72 if (xymap.has(xx, yy)) {
73 // we know index cannot be -1 because we checked has(xx, yy) above.
74 u16 ux = static_cast<u16>(xx);
75 u16 uy = static_cast<u16>(yy);
76 int index = xymap.mapToIndex(ux, uy);
77 if (index >= 0) {
78 u32 uindex = static_cast<u32>(index);
79 vec2<u16> pt(ux, uy);
80 visitor.draw(pt, uindex, value);
81 } else {
82 // Unexpected because has(xx, yy) is true above therefore
83 // index cannot be < 0. TODO: low level log this.
84 }
85 }
86 }
87 }
88 }
89 }
XYMap xymap
u8 & at(int x, int y)
Definition tile2x2.h:34
vec2< u16 > mOrigin
Definition tile2x2.h:94
unsigned char u8
Definition stdint.h:131
constexpr int type_rank< T >::value

References at(), mOrigin, fl::type_rank< T >::value, fl::x, xymap, and fl::y.

+ Here is the call graph for this function: