-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merged and fixed mini_map distortion issue
- Loading branch information
1 parent
6a88d2f
commit 6bd213d
Showing
2 changed files
with
9 additions
and
11 deletions.
There are no files selected for viewing
Submodule minilibx-linux
deleted from
7dc53a
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
/* By: tsuchen <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2024/08/15 12:13:17 by tsuchen #+# #+# */ | ||
/* Updated: 2024/09/03 19:05:33 by tsuchen ### ########.fr */ | ||
/* Updated: 2024/09/03 19:22:23 by tsuchen ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
|
@@ -19,25 +19,24 @@ void put_mini_map(t_data *data) | |
int map_x; | ||
int map_y; | ||
|
||
y = 0; | ||
while (y < MINI_MAP_H) | ||
y = -1; | ||
while (++y < MINI_MAP_H) | ||
{ | ||
x = 0; | ||
while (x < MINI_MAP_W) | ||
x = -1; | ||
while (++x < MINI_MAP_W) | ||
{ | ||
map_y = y * (data->map_bound) / MINI_MAP_H; | ||
map_x = x * (data->map_width - 1) / MINI_MAP_W; | ||
// map_x = x * (ft_strlen(data->map[map_y]) - 1) / MINI_MAP_W; | ||
if ((map_x < ft_strlen(data->map[map_y]) - 1) && data->map[map_y][map_x] == '1') | ||
if ((map_x < (int)(ft_strlen(data->map[map_y]) - 1)) | ||
&& data->map[map_y][map_x] == '1') | ||
rc_mlx_pixel_put(&data->mini_map, x, y, 0x212529); | ||
else if ((map_x < ft_strlen(data->map[map_y]) - 1) && data->map[map_y][map_x] == 'D') | ||
else if ((map_x < (int)(ft_strlen(data->map[map_y]) - 1)) | ||
&& data->map[map_y][map_x] == 'D') | ||
rc_mlx_pixel_put(&data->mini_map, x, y, 0xFFC300); | ||
else | ||
rc_mlx_pixel_put(&data->mini_map, x, y, 0xE9ECEF); | ||
if ((int)data->p_pos.x == map_y && (int)data->p_pos.y == map_x) | ||
rc_mlx_pixel_put(&data->mini_map, x, y, 0xD62828); | ||
x++; | ||
} | ||
y++; | ||
} | ||
} |