Skip to content

Commit

Permalink
libcore: Minor Rule improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Jul 17, 2016
1 parent 6965845 commit 6da29f0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
5 changes: 3 additions & 2 deletions doomsday/sdk/libcore/include/de/widgets/animationrule.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace de {
class DENG2_PUBLIC AnimationRule : public Rule, DENG2_OBSERVES(Clock, TimeChange)
{
public:
explicit AnimationRule(float initialValue);
explicit AnimationRule(float initialValue, Animation::Style style = Animation::EaseOut);

/**
* Constructs an AnimationRule whose value will animate to the specified target
Expand All @@ -43,8 +43,9 @@ class DENG2_PUBLIC AnimationRule : public Rule, DENG2_OBSERVES(Clock, TimeChange
*
* @param target Target value.
* @param transition Transition time to reach the current or future target values.
* @param style Animation style.
*/
explicit AnimationRule(Rule const &target, TimeDelta transition);
explicit AnimationRule(Rule const &target, TimeDelta transition, Animation::Style style = Animation::EaseOut);

void set(float target, TimeDelta transition = 0, TimeDelta delay = 0);

Expand Down
6 changes: 4 additions & 2 deletions doomsday/sdk/libcore/include/de/widgets/rulerectangle.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,11 @@ class DENG2_PUBLIC RuleRectangle
RuleRectangle &setMidAnchorY(Rule const &middle);

/**
* Sets the outputs of another rule rectangle as the inputs of this one.
* Sets the outputs of another rule rectangle as the inputs of this one. Uses the
* edge rules of @a rect; to later override width or height, make sure that one of
* the edges in that dimension are cleared.
*
* @param rect Rectangle whose outputs to use as inputs.
* @param rect Rectangle whose left, right, top and bottom outputs to use as inputs.
*/
RuleRectangle &setRect(RuleRectangle const &rect);

Expand Down
8 changes: 4 additions & 4 deletions doomsday/sdk/libcore/src/widgets/animationrule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@

namespace de {

AnimationRule::AnimationRule(float initialValue)
AnimationRule::AnimationRule(float initialValue, Animation::Style style)
: Rule(initialValue)
, _animation(initialValue)
, _animation(initialValue, style)
, _targetRule(0)
, _behavior(Singleshot)
{}

AnimationRule::AnimationRule(Rule const &target, TimeDelta transition)
AnimationRule::AnimationRule(Rule const &target, TimeDelta transition, Animation::Style style)
: Rule(target.value())
, _animation(target.value())
, _animation(target.value(), style)
, _targetRule(0)
, _behavior(RestartWhenTargetChanges)
{
Expand Down

0 comments on commit 6da29f0

Please sign in to comment.