]> git.lizzy.rs Git - nothing.git/commitdiff
(#450) Use fmimf fmaxf
authorrexim <reximkut@gmail.com>
Sat, 28 Dec 2019 18:31:13 +0000 (01:31 +0700)
committerrexim <reximkut@gmail.com>
Sat, 28 Dec 2019 18:31:13 +0000 (01:31 +0700)
src/game/level/platforms.c
src/math/extrema.h

index e066d1a34e1827893868df30ba7beaaefb082e0e..6a670db9d60138254806bbd3baebf6b84bf30b4f 100644 (file)
@@ -86,7 +86,7 @@ int platforms_render(const Platforms *platforms,
 
         Rect world_viewport = camera_view_port(camera);
         Rect viewport = camera_view_port_screen(camera);
-        
+
         if (rects_overlap(
                 camera_rect(
                     camera,
@@ -96,12 +96,12 @@ int platforms_render(const Platforms *platforms,
                 camera,
                 text_pos) == false) {
             if (platform_rect.w > text_rect.w){
-                text_pos.x = MAX(float, MIN(float, world_viewport.x, platform_rect.x + platform_rect.w - text_rect.w),
-                                        platform_rect.x);
+                text_pos.x = fmaxf(fminf(world_viewport.x, platform_rect.x + platform_rect.w - text_rect.w),
+                                   platform_rect.x);
             }
             if (platform_rect.h > text_rect.h){
-                text_pos.y = MAX(float, MIN(float, world_viewport.y, platform_rect.y + platform_rect.h - text_rect.h),
-                                        platform_rect.y);
+                text_pos.y = fmaxf(fminf(world_viewport.y, platform_rect.y + platform_rect.h - text_rect.h),
+                                   platform_rect.y);
             }
         }
 
index 1f49bd28ce4cfa2686fb140ee88abef05dadef0b..d06229422d86b681efa4f8e5a301a5113eff0db8 100644 (file)
@@ -9,7 +9,6 @@
         return a > b ? a : b;                   \
     }                                           \
 
-MAX_INSTANCE(float)
 MAX_INSTANCE(int64_t)
 MAX_INSTANCE(size_t)
 #define MAX(type, a, b) max_##type(a, b)
@@ -20,7 +19,6 @@ MAX_INSTANCE(size_t)
         return a < b ? a : b;                   \
     }                                           \
 
-MIN_INSTANCE(float)
 MIN_INSTANCE(int64_t)
 MIN_INSTANCE(size_t)
 #define MIN(type, a, b) min_##type(a, b)