1 module isodi.raylib.cell; 2 3 import raylib; 4 5 import isodi.cell; 6 import isodi.tests; 7 import isodi.display; 8 import isodi.resource; 9 import isodi.position; 10 import isodi.raylib.display; 11 import isodi.raylib.internal; 12 import isodi.raylib.resources; 13 14 15 @safe: 16 17 18 /// Cell implementation with Raylib. 19 /// 20 /// DrawableResource is implemented as a wrapper for the cell's resource calls. 21 final class RaylibCell : Cell, WithDrawableResources { 22 23 package { 24 25 Tile tile; 26 Side side; 27 Decoration decoration; 28 29 } 30 31 /// Modulate the color of the cell. 32 Color color = Colors.WHITE; 33 34 /// 35 this(Display display, const Position position, const string type) { 36 37 super(display, position, type); 38 reload(); 39 40 } 41 42 /// 43 void reload() { 44 45 tile = Tile(this, getTile); 46 side = Side(this, getSide); 47 decoration = Decoration(this, getDecoration(tile.options)); 48 49 } 50 51 /// 52 void draw() { 53 54 tile.draw(); 55 side.draw(); 56 decoration.draw(); 57 58 } 59 60 } 61 62 mixin DisplayTest!((display) { 63 64 display.addCell(position(0, 0), "grass"); 65 66 auto second = cast(RaylibCell) display.addCell(position(1, 0), "grass"); 67 second.color = Color(0xcc, 0xaa, 0xff, 0xee); 68 69 });