Progress on poker logic
This commit is contained in:
77
src/dawn/display/animation/Easing.hpp
Normal file
77
src/dawn/display/animation/Easing.hpp
Normal file
@ -0,0 +1,77 @@
|
||||
/**
|
||||
* Copyright (c) 2021 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
#pragma once
|
||||
#include "dawnlibs.hpp"
|
||||
|
||||
typedef float_t easefunction_t(float_t t);
|
||||
|
||||
/**
|
||||
* Returns the ease time for a given real time duration span.
|
||||
* @param start At what point in time the animation started
|
||||
* @param current The current point in time the animation is at.
|
||||
* @param duration The total duration on the animation.
|
||||
* @returns The easing time (0-1 time) that the animation is at.
|
||||
*/
|
||||
static inline float_t easeTimeToEase(
|
||||
float_t start,
|
||||
float_t current,
|
||||
float_t duration
|
||||
) {
|
||||
return (current - start) / duration;
|
||||
}
|
||||
|
||||
static inline float_t easeLinear(float_t t) {
|
||||
return t;
|
||||
}
|
||||
|
||||
static inline float_t easeInQuad(float_t t) {
|
||||
return t * t;
|
||||
}
|
||||
|
||||
static inline float_t easeOutQuad(float_t t) {
|
||||
return t * (2 - t);
|
||||
}
|
||||
|
||||
static inline float_t easeOutCubic(float_t t) {
|
||||
return 1 - powf(1 - t, 3);
|
||||
}
|
||||
|
||||
static inline float_t easeInOutQuad(float_t t) {
|
||||
return t < .5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
|
||||
}
|
||||
|
||||
static inline float_t easeInCubic(float_t t) {
|
||||
return t * t * t;
|
||||
}
|
||||
|
||||
static inline float_t easeInOutCubic(float_t t) {
|
||||
return t < .5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1;
|
||||
}
|
||||
|
||||
static inline float_t easeInQuart(float_t t) {
|
||||
return t * t * t * t;
|
||||
}
|
||||
|
||||
static inline float_t easeOutQuart(float_t t) {
|
||||
return 1 - (t-1)*(t-1)*(t-1)*(t-1);
|
||||
}
|
||||
|
||||
static inline float_t easeInOutQuart(float_t t) {
|
||||
return t < .5 ? 8*t*t*t*t : 1-8*(t-1)*(t-1)*(t-1)*(t-1);
|
||||
}
|
||||
|
||||
static inline float_t easeInQuint(float_t t) {
|
||||
return t*t*t*t*t;
|
||||
}
|
||||
|
||||
static inline float_t easeOutQuint(float_t t) {
|
||||
return 1 + (t-1)*(t-1)*(t-1)*(t-1)*(t-1);
|
||||
}
|
||||
|
||||
static inline float_t easeInOutQuint(float_t t) {
|
||||
return t<.5 ? 16*t*t*t*t*t : 1+16*(t-1)*(t-1)*(t-1)*(t-1)*(t-1);
|
||||
}
|
@ -37,7 +37,7 @@ float_t TrueTypeFont::getScale(float_t scale) {
|
||||
|
||||
float_t TrueTypeFont::getSpaceSize(float_t fontSize) {
|
||||
assertTrue(fontSize > 0);
|
||||
return mathRoundFloat(this->fontSize * 0.3f);
|
||||
return mathRound<float_t>(this->fontSize * 0.3f);
|
||||
}
|
||||
|
||||
float_t TrueTypeFont::getInitialLineHeight(float_t fontSize) {
|
||||
|
Reference in New Issue
Block a user