Ejemplo n.º 1
0
void TextInputComponent::UpdateDimensions()
{
    // TODO: replace the percentages here with values stored in state?

    qreal verticalMargin = m_windowSize.height() * 0.031;
    qreal horizontalMargin = m_windowSize.width() * 0.05;

    m_font.setPointSizeF(m_windowSize.height() * 0.02);

    QFontMetricsF fontMetrics(m_font);
    qreal fontHeight = fontMetrics.height();

    m_textRect.setRect(horizontalMargin,
                       verticalMargin,
                       m_windowSize.width() - (horizontalMargin * 2),
                       fontHeight * (m_numNewLines + 1));

    m_xPadding = fontHeight * 0.75;
    m_yPadding = fontHeight * 0.33;

    m_boundingRect.setRect(0, 0,
                           m_windowSize.width(),
                           m_textRect.height() + (verticalMargin * 2));

    SetPosition(QPointF(0, 0));

    SetBoundingRect(m_boundingRect);
    Update();
}
Ejemplo n.º 2
0
void Widget::Align( int inner_alignment)
{
    Rect client_area = GetParent()->GetClientRect( this);
    Rect bound = GetBoundingRect() + GetPosition();
    bound.Align( client_area, Rect::Alignment( inner_alignment));
    SetBoundingRect( bound);
}
CollisionComponent::CollisionComponent(Rect _boundingRect, EPhysicsType physType)
{
	SetBoundingRect(_boundingRect);

	SetPhysicsType(physType);


}