Permalink
Browse files

added get and set of threshold

  • Loading branch information...
1 parent 26e3c04 commit 6747b856d839a133ff2ccb8cf968c7140bfa2e6b @elliotwoods committed Aug 19, 2012
Showing with 27 additions and 8 deletions.
  1. +23 −8 src/TweenTraceBuffer.cpp
  2. +4 −0 src/TweenTraceBuffer.h
View
@@ -196,6 +196,17 @@ void TweenTraceBuffer::clear() {
this->keyframes.clear();
}
+//----------
+void TweenTraceBuffer::flush() {
+ current.start = inputBuffer.getStart();
+ current.end = inputBuffer.getEndMinusOne();
+
+ this->keyframes.insert(current);
+ point endOfLast = this->inputBuffer.getEndMinusOne();
+ this->clearInputBuffer();
+ this->add(endOfLast);
+}
+
//----------
void TweenTraceBuffer::draw() const {
set<KeyFrame>::const_iterator it;
@@ -205,6 +216,17 @@ void TweenTraceBuffer::draw() const {
this->inputBuffer.draw();
}
+//----------
+float TweenTraceBuffer::getThreshold() const {
+ return this->threshold;
+}
+
+//----------
+void TweenTraceBuffer::setThreshold(float threshold) {
+ this->threshold = threshold;
+}
+
+
//----------
void TweenTraceBuffer::clearInputBuffer() {
current.function = this->easingFunctions->find("Linear [in]");
@@ -225,14 +247,7 @@ bool TweenTraceBuffer::traceInputBuffer() {
if (!this->searchFunc()) {
// shave off last value
// keyframe's function fits remaining points
-
- current.start = inputBuffer.getStart();
- current.end = inputBuffer.getEndMinusOne();
-
- this->keyframes.insert(current);
- point endOfLast = this->inputBuffer.getEndMinusOne();
- this->clearInputBuffer();
- this->add(endOfLast);
+ this->flush();
}
}
View
@@ -58,9 +58,13 @@ class TweenTraceBuffer {
void add(pair<float, float>);
void clear();
+ void flush(); ///<flush current input buffer into keyframe
void draw() const;
+ float getThreshold() const;
+ void setThreshold(float);
+
protected:
void clearInputBuffer();
bool traceInputBuffer();

0 comments on commit 6747b85

Please sign in to comment.