diff options
| author | Jeffery Myers <[email protected]> | 2021-02-20 14:37:32 -0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-02-20 23:37:32 +0100 |
| commit | 48a7cd3c8788799505b4fa9f84cb8f5979397c29 (patch) | |
| tree | f9cbed3827f8855d0e3c27916930b9d82de3e423 /examples/others | |
| parent | 82cdd88ffe6cb9d2f97e34bd0724d791030372bf (diff) | |
| download | raylib-48a7cd3c8788799505b4fa9f84cb8f5979397c29.tar.gz raylib-48a7cd3c8788799505b4fa9f84cb8f5979397c29.zip | |
[Examples] Fix typecast warnings in examples. (#1601)
* Fixing typecast warnings generated by visual studio 2019 in examples.
* Changes to fixes based on feedback
Co-authored-by: Jeffery Myers <[email protected]>
Diffstat (limited to 'examples/others')
| -rw-r--r-- | examples/others/easings.h | 24 | ||||
| -rw-r--r-- | examples/others/raudio_standalone.c | 5 | ||||
| -rw-r--r-- | examples/others/rlgl_standalone.c | 14 |
3 files changed, 23 insertions, 20 deletions
diff --git a/examples/others/easings.h b/examples/others/easings.h index f6c384b0..21617826 100644 --- a/examples/others/easings.h +++ b/examples/others/easings.h @@ -112,12 +112,12 @@ EASEDEF float EaseSineOut(float t, float b, float c, float d) { return (c*sinf(t EASEDEF float EaseSineInOut(float t, float b, float c, float d) { return (-c/2.0f*(cosf(PI*t/d) - 1.0f) + b); } // Circular Easing functions -EASEDEF float EaseCircIn(float t, float b, float c, float d) { t /= d; return (-c*(sqrt(1.0f - t*t) - 1.0f) + b); } -EASEDEF float EaseCircOut(float t, float b, float c, float d) { t = t/d - 1.0f; return (c*sqrt(1.0f - t*t) + b); } +EASEDEF float EaseCircIn(float t, float b, float c, float d) { t /= d; return (-c*(sqrtf(1.0f - t*t) - 1.0f) + b); } +EASEDEF float EaseCircOut(float t, float b, float c, float d) { t = t/d - 1.0f; return (c*sqrtf(1.0f - t*t) + b); } EASEDEF float EaseCircInOut(float t, float b, float c, float d) { - if ((t/=d/2.0f) < 1.0f) return (-c/2.0f*(sqrt(1.0f - t*t) - 1.0f) + b); - t -= 2.0f; return (c/2.0f*(sqrt(1.0f - t*t) + 1.0f) + b); + if ((t/=d/2.0f) < 1.0f) return (-c/2.0f*(sqrtf(1.0f - t*t) - 1.0f) + b); + t -= 2.0f; return (c/2.0f*(sqrtf(1.0f - t*t) + 1.0f) + b); } // Cubic Easing functions @@ -139,15 +139,15 @@ EASEDEF float EaseQuadInOut(float t, float b, float c, float d) } // Exponential Easing functions -EASEDEF float EaseExpoIn(float t, float b, float c, float d) { return (t == 0.0f) ? b : (c*pow(2.0f, 10.0f*(t/d - 1.0f)) + b); } -EASEDEF float EaseExpoOut(float t, float b, float c, float d) { return (t == d) ? (b + c) : (c*(-pow(2.0f, -10.0f*t/d) + 1.0f) + b); } +EASEDEF float EaseExpoIn(float t, float b, float c, float d) { return (t == 0.0f) ? b : (c * powf(2.0f, 10.0f*(t/d - 1.0f)) + b); } +EASEDEF float EaseExpoOut(float t, float b, float c, float d) { return (t == d) ? (b + c) : (c * (-powf(2.0f, -10.0f*t/d) + 1.0f) + b); } EASEDEF float EaseExpoInOut(float t, float b, float c, float d) { if (t == 0.0f) return b; if (t == d) return (b + c); - if ((t/=d/2.0f) < 1.0f) return (c/2.0f*pow(2.0f, 10.0f*(t - 1.0f)) + b); + if ((t/=d/2.0f) < 1.0f) return (c/2.0f* powf(2.0f, 10.0f*(t - 1.0f)) + b); - return (c/2.0f*(-pow(2.0f, -10.0f*(t - 1.0f)) + 2.0f) + b); + return (c/2.0f*(-powf(2.0f, -10.0f*(t - 1.0f)) + 2.0f) + b); } // Back Easing functions @@ -219,7 +219,7 @@ EASEDEF float EaseElasticIn(float t, float b, float c, float d) float p = d*0.3f; float a = c; float s = p/4.0f; - float postFix = a*pow(2.0f, 10.0f*(t-=1.0f)); + float postFix = a*powf(2.0f, 10.0f*(t-=1.0f)); return (-(postFix*sinf((t*d-s)*(2.0f*PI)/p )) + b); } @@ -233,7 +233,7 @@ EASEDEF float EaseElasticOut(float t, float b, float c, float d) float a = c; float s = p/4.0f; - return (a*pow(2.0f,-10.0f*t)*sinf((t*d-s)*(2.0f*PI)/p) + c + b); + return (a*powf(2.0f,-10.0f*t)*sinf((t*d-s)*(2.0f*PI)/p) + c + b); } EASEDEF float EaseElasticInOut(float t, float b, float c, float d) @@ -247,11 +247,11 @@ EASEDEF float EaseElasticInOut(float t, float b, float c, float d) if (t < 1.0f) { - float postFix = a*pow(2.0f, 10.0f*(t-=1.0f)); + float postFix = a*powf(2.0f, 10.0f*(t-=1.0f)); return -0.5f*(postFix*sinf((t*d-s)*(2.0f*PI)/p)) + b; } - float postFix = a*pow(2.0f, -10.0f*(t-=1.0f)); + float postFix = a*powf(2.0f, -10.0f*(t-=1.0f)); return (postFix*sinf((t*d-s)*(2.0f*PI)/p)*0.5f + c + b); } diff --git a/examples/others/raudio_standalone.c b/examples/others/raudio_standalone.c index 224286d3..42a336ec 100644 --- a/examples/others/raudio_standalone.c +++ b/examples/others/raudio_standalone.c @@ -61,9 +61,12 @@ //---------------------------------------------------------------------------------- // Module Functions Declaration //---------------------------------------------------------------------------------- -#if !defined(_WIN32) +#if !defined(_MSC_VER) static int kbhit(void); // Check if a key has been pressed static char getch(); // Get pressed character +#else +#define kbhit _kbhit +#define getch _getch #endif //------------------------------------------------------------------------------------ diff --git a/examples/others/rlgl_standalone.c b/examples/others/rlgl_standalone.c index 9aea2b47..b1e2e735 100644 --- a/examples/others/rlgl_standalone.c +++ b/examples/others/rlgl_standalone.c @@ -57,7 +57,7 @@ #define GLFW_INCLUDE_ES2 #endif -#include <GLFW/glfw3.h> // Windows/Context and inputs management +#include "GLFW/glfw3.h" // Windows/Context and inputs management #include <stdio.h> // Required for: printf() @@ -246,13 +246,13 @@ static void DrawRectangleV(Vector2 position, Vector2 size, Color color) rlBegin(RL_TRIANGLES); rlColor4ub(color.r, color.g, color.b, color.a); - rlVertex2i(position.x, position.y); - rlVertex2i(position.x, position.y + size.y); - rlVertex2i(position.x + size.x, position.y + size.y); + rlVertex2f(position.x, position.y); + rlVertex2f(position.x, position.y + size.y); + rlVertex2f(position.x + size.x, position.y + size.y); - rlVertex2i(position.x, position.y); - rlVertex2i(position.x + size.x, position.y + size.y); - rlVertex2i(position.x + size.x, position.y); + rlVertex2f(position.x, position.y); + rlVertex2f(position.x + size.x, position.y + size.y); + rlVertex2f(position.x + size.x, position.y); rlEnd(); } |
