| 17 | } |
| 18 | |
| 19 | void 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 | |
| 43 | Drawable InterfaceCursor::drawable() const { |
| 44 | if (m_drawable.is<String>()) |
no test coverage detected