MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / toJson

Method toJson

source/game/StarDrawable.cpp:142–159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140}
141
142Json 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
161void Drawable::translate(Vec2F const& translation) {
162 position += translation;

Callers

nothing calls this directly

Calls 7

jsonFromLine2FFunction · 0.85
jsonFromPolyFFunction · 0.85
jsonFromMat3FFunction · 0.85
jsonFromVec2FFunction · 0.85
jsonFromColorFunction · 0.85
joinFunction · 0.50
setMethod · 0.45

Tested by

no test coverage detected