Source/Gorgon/Widgets/Common.h

Sat, 18 Jun 2022 03:28:53 +0200

author
lucatonini
date
Sat, 18 Jun 2022 03:28:53 +0200
branch
4.x-dev
changeset 1766
ff04475158dc
parent 1461
6bbecfcb304e
permissions
-rw-r--r--

* Update install instructions for Fedora 36

#pragma once


namespace Gorgon { namespace Widgets {
    
    ///@cond internal
    
    template<class T_>
    float FloatDivider(T_ left, T_ min, T_ max) {
        if(min == max) return 0.f;
        
        return float(left - min) / float(max - min);
    }
    
    template<class T_>
    T_ FloatToValue(float value, T_ min, T_ max) {
        return T_((max - min) * value + min);
    }
    
    ///@endcond
    
} }

mercurial