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

Method makeImage

source/game/StarDrawable.cpp:89–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87}
88
89Drawable Drawable::makeImage(AssetPath image, float pixelSize, bool centered, Vec2F const& position, Color const& color) {
90 Drawable drawable;
91 Mat3F transformation = Mat3F::identity();
92 if (centered) {
93 auto imageMetadata = Root::singleton().imageMetadataDatabase();
94 Vec2F imageSize = Vec2F(imageMetadata->imageSize(image));
95 transformation.translate(-imageSize / 2);
96 }
97
98 if (pixelSize != 1.0f)
99 transformation.scale(pixelSize);
100
101 drawable.part = ImagePart{std::move(image), std::move(transformation)};
102 drawable.position = position;
103 drawable.color = color;
104
105 return drawable;
106}
107
108Drawable::Drawable()
109 : color(Color::White), fullbright(false) {}

Callers

nothing calls this directly

Calls 6

identityClass · 0.85
singletonClass · 0.85
imageMetadataDatabaseMethod · 0.80
imageSizeMethod · 0.45
translateMethod · 0.45
scaleMethod · 0.45

Tested by

no test coverage detected