Skip to content

Commit

Permalink
Replaced Util::remap() with ofMap()
Browse files Browse the repository at this point in the history
  • Loading branch information
nununo committed May 18, 2017
1 parent fe8bf97 commit 38fecb4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/Clip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ MovieBase* Clip::createMovie(string filename) {

//-----------------------------------------------------------------------
float Clip::timeToPercentage(float time) {
return Util::remap(time, 0, movie->getDuration(), 0, 1);
return ofMap(time, 0, movie->getDuration(), 0, 1);
}

//-----------------------------------------------------------------------
Expand All @@ -69,7 +69,7 @@ int Clip::calcAlpha() {
if (levelSettings->getLoop())
return ALPHA_MAX;
else {
float alpha = Util::remap(movie->getPosition(), 0.98-fadeOutPercentage, 0.98, 1, 0);
float alpha = ofMap(movie->getPosition(), 0.98-fadeOutPercentage, 0.98, 1, 0);
return (int)(alpha * ALPHA_MAX);
}
}
Expand Down
12 changes: 1 addition & 11 deletions src/Util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,7 @@
#include "Util.h"

//--------------------------------------------------------------
float Util::remap(const float v, const float inMin, const float inMax, const float outMin, const float outMax) {
float aux = 1 - ((inMax - v) / (inMax - inMin));
if (aux < 0)
aux = 0;
else if (aux > 1)
aux = 1;
return outMin + (outMax-outMin)* aux;
}

//--------------------------------------------------------------
string Util::blowIntensityToString(const BlowIntensity blowIntensity) {
std::string Util::blowIntensityToString(const BlowIntensity blowIntensity) {
switch (blowIntensity) {
case BlowIntensity::IDLE:
return "idle";
Expand Down
5 changes: 2 additions & 3 deletions src/Util.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@
#define UTIL_H_INCLUDED

#include "BlowIntensity.h"
#include "ofMain.h"
#include <string>

class Util {
public:
static float remap(const float v, const float inMin, const float inMax, const float outMin, const float outMax);
static string blowIntensityToString(const BlowIntensity blowIntensity);
static std::string blowIntensityToString(const BlowIntensity blowIntensity);
};

#endif // UTIL_H_INCLUDED

0 comments on commit 38fecb4

Please sign in to comment.