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

Method setCursor

source/frontend/StarInterfaceCursor.cpp:19–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17}
18
19void InterfaceCursor::setCursor(String const& configFile) {
20 if (m_configFile == configFile)
21 return;
22
23 m_configFile = configFile;
24
25 auto& root = Root::singleton();
26 auto assets = root.assets();
27 auto imageMetadata = root.imageMetadataDatabase();
28
29 auto config = assets->json(m_configFile);
30
31 m_offset = jsonToVec2I(config.get("offset"));
32 if (config.contains("image")) {
33 m_drawable = config.getString("image");
34 m_size = Vec2I{imageMetadata->imageSize(config.getString("image"))};
35 } else {
36 m_drawable = Animation(config.get("animation"), "/interface");
37 m_size = Vec2I(m_drawable.get<Animation>().drawable(1.0f).boundBox(false).size());
38 }
39
40 m_scale = config.getUInt("scale", 0);
41}
42
43Drawable InterfaceCursor::drawable() const {
44 if (m_drawable.is<String>())

Callers 1

updateCursorMethod · 0.80

Calls 14

singletonClass · 0.85
jsonToVec2IFunction · 0.85
AnimationClass · 0.85
assetsMethod · 0.80
imageMetadataDatabaseMethod · 0.80
jsonMethod · 0.80
getStringMethod · 0.80
getUIntMethod · 0.80
getMethod · 0.45
containsMethod · 0.45
imageSizeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected