aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_set_minimap_scale.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-02-06 19:02:34 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2020-02-06 19:02:34 +0100
commit3f95779e54a44ab15d566fbcbdc965d842d12786 (patch)
treed551e073e7306ce75d2e63d80bc2478fc87c9a3b /src/ft_set_minimap_scale.c
parentxdpyinfo works on Linux (diff)
download42-cub3d-3f95779e54a44ab15d566fbcbdc965d842d12786.tar.gz
42-cub3d-3f95779e54a44ab15d566fbcbdc965d842d12786.tar.bz2
42-cub3d-3f95779e54a44ab15d566fbcbdc965d842d12786.tar.xz
42-cub3d-3f95779e54a44ab15d566fbcbdc965d842d12786.tar.zst
42-cub3d-3f95779e54a44ab15d566fbcbdc965d842d12786.zip
New scale function
Diffstat (limited to '')
-rw-r--r--src/ft_set_minimap_scale.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/ft_set_minimap_scale.c b/src/ft_set_minimap_scale.c
new file mode 100644
index 0000000..5a69c18
--- /dev/null
+++ b/src/ft_set_minimap_scale.c
@@ -0,0 +1,10 @@
+#include <cub3d.h>
+
+void
+ ft_set_minimap_scale(t_cub *clist)
+{
+ ((clist->scale = (clist->wlist->x_size / (uint16_t)clist->map_w) - 1) < 1)
+ ? (clist->scale = 1) : 0;
+ (clist->wlist->y_size < (clist->map_h * clist->scale)) ? (clist->scale =
+ (clist->wlist->y_size / (uint16_t)clist->map_h) - 1) : 0;
+}