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 70 of file tile2x2.h.

70 {
71 for (u16 x = 0; x < 2; ++x) {
72 for (u16 y = 0; y < 2; ++y) {
73 u8 value = at(x, y);
74 if (value > 0) {
75 int xx = mOrigin.x + x;
76 int yy = mOrigin.y + y;
77 if (xymap.has(xx, yy)) {
78 // we know index cannot be -1 because we checked has(xx, yy) above.
79 u16 ux = static_cast<u16>(xx);
80 u16 uy = static_cast<u16>(yy);
81 int index = xymap.mapToIndex(ux, uy);
82 if (index >= 0) {
83 u32 uindex = static_cast<u32>(index);
84 vec2<u16> pt(ux, uy);
85 visitor.draw(pt, uindex, value);
86 } else {
87 // Unexpected because has(xx, yy) is true above therefore
88 // index cannot be < 0. TODO: low level log this.
89 }
90 }
91 }
92 }
93 }
94 }
int y
Definition simple.h:93
int x
Definition simple.h:92
XYMap xymap(WIDTH, HEIGHT, SERPENTINE)
u8 & at(int x, int y)
Definition tile2x2.h:39
vec2< u16 > mOrigin
Definition tile2x2.h:99
unsigned char u8
Definition int.h:17

References at(), mOrigin, x, xymap, and y.

+ Here is the call graph for this function: