MCPcopy Create free account
hub / github.com/EasyRPG/Player / DrawCheckerboard

Function DrawCheckerboard

src/cache.cpp:204–222  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

202
203 template<Material::Type T>
204 BitmapRef DrawCheckerboard() {
205 static_assert(Material::REND < T && T < Material::END, "Invalid material.");
206 const Spec& s = spec[T];
207
208 BitmapRef bitmap = Bitmap::Create(s.max_width, s.max_height, false);
209
210 // ToDo: Maybe use different renderers depending on material
211 // Will look ugly for some image types
212
213 // Draw chess board
214 Color color[2] = { Color(255, 255, 255, 255), Color(128, 128, 128, 255) };
215 for (int i = 0; i < s.max_width / 16; ++i) {
216 for (int j = 0; j < s.max_height / 16; ++j) {
217 bitmap->FillRect(Rect(i * 16, j * 16, 16, 16), color[(i + j) % 2]);
218 }
219 }
220
221 return bitmap;
222 }
223
224 template<Material::Type T>
225 BitmapRef CreateEmpty() {

Callers

nothing calls this directly

Calls 3

FillRectMethod · 0.80
ColorClass · 0.70
RectClass · 0.70

Tested by

no test coverage detected