improve gexit with init function and add basic mlx image gestion
This commit is contained in:
15
srcs/draw/draw.c
Normal file
15
srcs/draw/draw.c
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user