Skip to content

Commit

Permalink
libdeng2|Widgets: RuleRectangle size and RootWidget size
Browse files Browse the repository at this point in the history
The RootWidget's size now correctly uses the width and height outputs
of its rule rectangle.
  • Loading branch information
skyjake committed Nov 1, 2013
1 parent 033a36e commit f4ebe21
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
5 changes: 5 additions & 0 deletions doomsday/libdeng2/include/de/widgets/rulerectangle.h
Expand Up @@ -113,6 +113,11 @@ class DENG2_PUBLIC RuleRectangle
*/
Rectanglef rect() const;

/**
* Returns the current size of the rectangle as defined by the input rules.
*/
Vector2f size() const;

/**
* Returns the current rectangle as defined by the input rules.
* Values are floored to integers.
Expand Down
8 changes: 4 additions & 4 deletions doomsday/libdeng2/src/widgets/rootwidget.cpp
Expand Up @@ -43,8 +43,8 @@ DENG2_PIMPL_NOREF(RootWidget)

Size viewSize() const
{
return Size(de::max(0, viewRect->right().valuei()),
de::max(0, viewRect->bottom().valuei()));
return Size(de::max(0, viewRect->width().valuei()),
de::max(0, viewRect->height().valuei()));
}
};

Expand Down Expand Up @@ -83,12 +83,12 @@ Rule const &RootWidget::viewBottom() const

Rule const &RootWidget::viewWidth() const
{
return d->viewRect->right();
return d->viewRect->width();
}

Rule const &RootWidget::viewHeight() const
{
return d->viewRect->bottom();
return d->viewRect->height();
}

void RootWidget::setViewSize(Size const &size)
Expand Down
5 changes: 5 additions & 0 deletions doomsday/libdeng2/src/widgets/rulerectangle.cpp
Expand Up @@ -317,6 +317,11 @@ Rectanglef RuleRectangle::rect() const
Vector2f(right().value(), bottom().value()));
}

Vector2f RuleRectangle::size() const
{
return Vector2f(width().value(), height().value());
}

Rectanglei RuleRectangle::recti() const
{
Rectanglef const r = rect();
Expand Down

0 comments on commit f4ebe21

Please sign in to comment.