improve gexit with init function and add basic mlx image gestion

This commit is contained in:
Hugo LAMY
2022-03-25 18:49:06 +01:00
parent 3a1036ccdc
commit 02b5d88ea5
45 changed files with 139 additions and 7042 deletions

15
srcs/draw/draw.c Normal file
View File

@@ -0,0 +1,15 @@
#include "cube3d.h"
static void draw_pixel(t_game *game, int x, int y, int color)
{
unsigned int position;
position = y * game->sizel + x * (game->bpp / 8);
*(unsigned int*)(game->img_data + position) = color;
}
void draw(t_game *game)
{
draw_pixel(game, game->plr_x, game->plr_y, 0x00FF0000);
mlx_put_image_to_window(game->mlx_ptr, game->win_ptr, game->img_ptr, 0, 0);
}