| 140 | } |
| 141 | |
| 142 | Json Drawable::toJson() const { |
| 143 | JsonObject json; |
| 144 | if (auto line = part.ptr<LinePart>()) { |
| 145 | json.set("line", jsonFromLine2F(line->line)); |
| 146 | json.set("width", line->width); |
| 147 | } else if (auto poly = part.ptr<PolyPart>()) { |
| 148 | json.set("poly", jsonFromPolyF(poly->poly)); |
| 149 | } else if (auto image = part.ptr<ImagePart>()) { |
| 150 | json.set("image", AssetPath::join(image->image)); |
| 151 | json.set("transformation", jsonFromMat3F(image->transformation)); |
| 152 | } |
| 153 | |
| 154 | json.set("position", jsonFromVec2F(position)); |
| 155 | json.set("color", jsonFromColor(color)); |
| 156 | json.set("fullbright", fullbright); |
| 157 | |
| 158 | return json; |
| 159 | } |
| 160 | |
| 161 | void Drawable::translate(Vec2F const& translation) { |
| 162 | position += translation; |
nothing calls this directly
no test coverage detected