Skip to content

fix to Call to 'bind' is ambiguous#6

Open
tobetchi wants to merge 1 commit into
arturoc:masterfrom
tobetchi:fix
Open

fix to Call to 'bind' is ambiguous#6
tobetchi wants to merge 1 commit into
arturoc:masterfrom
tobetchi:fix

Conversation

@tobetchi

@tobetchi tobetchi commented Oct 4, 2018

Copy link
Copy Markdown
// example code
#include "ofxEasing.h"

enum EasingExtra {
    BackIn_s, BackOut_s, BackInOut_s,
    ElasticInPow, ElasticOutPow, ElasticInOutPow,
};

float easing(float v, float minIn, float maxIn, float minOut, float maxOut, EasingExtra ease, float extra) {
    return ofxeasing::map_clamp(v, minIn, maxIn, minOut, maxOut, getFunctionExtra(ease), extra);
}

typedef std::function<float(float, float, float, float, float)> functionExtra;

functionExtra getFunctionExtra(EasingExtra ease) {
    static std::map<EasingExtra, functionExtra> index = {
        {EasingExtra::BackIn_s, ofxeasing::back::easeIn_s},
        {EasingExtra::BackOut_s, ofxeasing::back::easeOut_s},
        {EasingExtra::BackInOut_s, ofxeasing::back::easeInOut_s},
        
        {EasingExtra::ElasticInPow, ofxeasing::elastic::easeInPow},
        {EasingExtra::ElasticOutPow, ofxeasing::elastic::easeOutPow},
        {EasingExtra::ElasticInOutPow, ofxeasing::elastic::easeInOutPow},
    };

    return index[ease];
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant