mirror of
https://codeberg.org/ACME-Corporation/cub3d.git
synced 2025-12-06 09:58:09 +01:00
fixed everything
This commit is contained in:
parent
8eb1a4962c
commit
00d0beadf1
2 changed files with 20 additions and 2 deletions
20
src/main.c
20
src/main.c
|
|
@ -6,12 +6,12 @@
|
|||
/* By: tchampio <tchampio@student.42lehavre. +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/05/06 13:16:11 by tchampio #+# #+# */
|
||||
/* Updated: 2025/05/06 13:16:18 by tchampio ### ########.fr */
|
||||
/* Updated: 2025/06/06 13:12:28 by tchampio ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../includes/libft.h"
|
||||
#include "../includes/mlx.h"
|
||||
#include "../mlx/mlx.h"
|
||||
#include "../includes/maputils.h"
|
||||
#include <stdbool.h>
|
||||
#include <unistd.h>
|
||||
|
|
@ -35,6 +35,20 @@ void my_mlx_pixel_put(t_mlx_data *data, int x, int y, int color)
|
|||
*(unsigned int*)dst = color;
|
||||
}
|
||||
|
||||
int destroy(t_mapdata *map)
|
||||
{
|
||||
(void)map;
|
||||
exit(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int key_destroy(int keycode, t_mapdata *map)
|
||||
{
|
||||
if (keycode == 65307)
|
||||
destroy(map);
|
||||
return (0);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
void *mlx;
|
||||
|
|
@ -56,6 +70,8 @@ int main(int argc, char **argv)
|
|||
data.addr = mlx_get_data_addr(data.img, &data.bits_per_pixel, &data.line_length, &data.endian);
|
||||
xpm_image = mlx_xpm_file_to_image(mlx, xpm, &xpm_width, &xpm_height);
|
||||
//my_mlx_pixel_put(&data, 5, 5, 0x00FF0000);
|
||||
mlx_hook(mlx_win, 17, 0L, destroy, &map);
|
||||
mlx_key_hook(mlx_win, key_destroy, &map);
|
||||
mlx_put_image_to_window(mlx, mlx_win, data.img, 0, 0);
|
||||
mlx_put_image_to_window(mlx, mlx_win, xpm_image, 0, 0);
|
||||
mlx_loop(mlx);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue