MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / dump

Method dump

src/Core/Graphics/Sprite.cpp:449–479  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

447 }
448
449 vili::node Sprite::dump() const
450 {
451 vili::node result = vili::object {};
452 result.emplace("path", m_path);
453
454 const Transform::UnitVector spritePositionRect = this->getPosition().to(m_unit);
455 const Transform::UnitVector spriteSizeRect = this->getSize().to(m_unit);
456 result.emplace("rect",
457 vili::object { { "x", spritePositionRect.x }, { "y", spritePositionRect.y },
458 { "width", spriteSizeRect.x }, { "height", spriteSizeRect.y },
459 { "unit", Transform::unitsToString(m_unit) } });
460
461 result.emplace("rotation", m_angle);
462 result.emplace("layer", m_layer);
463 result.emplace("zdepth", m_zdepth);
464 result.emplace("transform",
465 vili::object { { "x", m_positionTransformer.getXTransformerName() },
466 { "y", m_positionTransformer.getYTransformerName() } });
467 if (!m_visible)
468 {
469 result.emplace("visible", m_visible);
470 }
471 const Color& color = m_sprite.getColor();
472 if (color != Color::White)
473 {
474 result.emplace("color",
475 vili::object { { "r", color.r }, { "g", color.g }, { "b", color.b },
476 { "a", color.a } });
477 }
478 return result;
479 }
480
481 void Sprite::load(vili::node& data)
482 {

Callers 1

loadMethod · 0.45

Calls 8

unitsToStringFunction · 0.85
toMethod · 0.80
getXTransformerNameMethod · 0.80
getYTransformerNameMethod · 0.80
getColorMethod · 0.80
emplaceMethod · 0.45
getPositionMethod · 0.45
getSizeMethod · 0.45

Tested by

no test coverage detected