void CControl::SetPercentSize( const CVec2& size ) { if ( m_vec2PercentSize != size ) { m_vec2PercentSize = size; CalcRealSize(); UpdateQuadP(); for ( auto childWnd : GetChildren() ) { if ( childWnd->GetType() == eNT_NodeGUI ) { CControl* child =( CControl*) childWnd; child->OnParentSizeChange( m_vec2Size.x , m_vec2Size.y ); } } } }
void CControl::OnParentSizeChange( float width, float height ) { m_fTargetWidth = width; m_fTargetHeight = height; CVec2 position; CalcRealPosition( position ); SetPosition( position.x, position.y, 0.0f ); CalcRealSize(); UpdateQuadP(); for ( auto childWnd : GetChildren() ) { if( childWnd->GetType() == eNT_NodeGUI ) { CControl* child = down_cast<CControl*>(childWnd); child->OnParentSizeChange( m_vecRealSize.x, m_vecRealSize.y ); } } }