params adjust angle of view and size of game window

This commit is contained in:
hugogogo
2022-04-24 11:14:08 +02:00
parent fac1f78230
commit c886118bd6
9 changed files with 135 additions and 103 deletions

View File

@@ -75,7 +75,9 @@ void draw_line(t_game *game, t_vec vec, int color)
{
t_coord incr;
t_coord pos;
int cell;
cell = game->map.cell;
incr.x = 0;
pos.x = 0;
pos.y = 0;
@@ -85,19 +87,19 @@ void draw_line(t_game *game, t_vec vec, int color)
while ((game->map.content)[incr.x][incr.y])
{
if ((game->map.content)[incr.x][incr.y] == '1' )
draw_square(game, pos, 0x00999999, 0x00000000, CELL, 0);
draw_square(game, pos, 0x00999999, 0x00000000, cell, 0);
else
draw_square(game, pos, 0x00555555, 0x00333333, CELL, 0);
draw_square(game, pos, 0x00555555, 0x00333333, cell, 0);
(incr.y)++;
pos.x += CELL;
pos.x += cell;
}
(incr.x)++;
pos.x = 0;
pos.y += CELL;
pos.y += cell;
}
pos.x = game->plr.pos.x - CELL / 2;
pos.y = game->plr.pos.y - CELL / 2;
draw_square(game, pos, 0x00999900, 0x00330033, CELL, 1);
pos.x = game->plr.pos.x - cell / 2;
pos.y = game->plr.pos.y - cell / 2;
draw_square(game, pos, 0x00999900, 0x00330033, cell, 1);
}
static void draw_screen(t_game *game, t_rcast *rcast)
@@ -132,7 +134,7 @@ void draw(t_game *game)
// tmp, to draw map
draw_screen(game, &(game->rcast));
mlx_put_image_to_window(game->mlx_ptr, game->map_win.ptr, game->map_img.ptr, 0, 0);
mlx_put_image_to_window(game->mlx_ptr, game->map_win.ptr, game->map_img.ptr, 0, SCREEN_HEIGHT);
// tmp end
// mlx_put_image_to_window(game->mlx_ptr, game->win.ptr, game->img.ptr, 0, 0);