MCPcopy Create free account
hub / github.com/TankOs/SFGUI / GetAbsolutePosition

Method GetAbsolutePosition

src/SFGUI/Widget.cpp:569–584  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

567}
568
569sf::Vector2f Widget::GetAbsolutePosition() const {
570 // If no parent, allocation's position is absolute position.
571 PtrConst parent( m_parent.lock() );
572
573 if( !parent ) {
574 return sf::Vector2f( GetAllocation().position.x, GetAllocation().position.y );
575 }
576
577 // Get parent's absolute position and add own rel. position to it.
578 sf::Vector2f parent_position( parent->GetAbsolutePosition() );
579
580 return sf::Vector2f(
581 parent_position.x + GetAllocation().position.x,
582 parent_position.y + GetAllocation().position.y
583 );
584}
585
586void Widget::UpdateDrawablePosition() const {
587 if( m_drawable ) {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected