all norm exept for render_sprites
This commit is contained in:
parent
08edfa99a6
commit
f9272b27c7
@ -3,10 +3,10 @@
|
||||
/* :::::::: */
|
||||
/* player.h :+: :+: */
|
||||
/* +:+ */
|
||||
/* By: qmennen <qmennen@student.codam.nl> +#+ */
|
||||
/* By: whaffman <whaffman@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2025/04/15 18:53:27 by qmennen #+# #+# */
|
||||
/* Updated: 2025/05/14 12:43:14 by whaffman ######## odam.nl */
|
||||
/* Updated: 2025/05/14 20:08:48 by whaffman ######## odam.nl */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -19,4 +19,5 @@ int player_create(t_game **game);
|
||||
void player_render(t_screen *screen, t_player *player);
|
||||
void player_update(t_game *game, double delta_time);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@ -3,10 +3,10 @@
|
||||
/* :::::::: */
|
||||
/* game.c :+: :+: */
|
||||
/* +:+ */
|
||||
/* By: qmennen <qmennen@student.codam.nl> +#+ */
|
||||
/* By: whaffman <whaffman@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2025/04/15 15:46:08 by qmennen #+# #+# */
|
||||
/* Updated: 2025/05/09 14:51:14 by whaffman ######## odam.nl */
|
||||
/* Updated: 2025/05/14 19:59:05 by whaffman ######## odam.nl */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -58,12 +58,11 @@ void game_loop(void *param)
|
||||
player_update(game, delta_time);
|
||||
cast_rays(game);
|
||||
render_map(game);
|
||||
//render_entities(game);
|
||||
keyboard_update(game);
|
||||
if (game->player->is_moving)
|
||||
{
|
||||
game->screen->img->instances[0].x = (int)(sin((double)framecount / 4.0) * 20);
|
||||
game->screen->img->instances[0].y = (int)(( 0.5 * cos((double)framecount / 2.0)) * 20);
|
||||
game->screen->img->instances[0].x = sin((double)framecount / 4.0) * 20;
|
||||
game->screen->img->instances[0].y = cos((double)framecount / 2.0) * 10;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3,21 +3,17 @@
|
||||
/* :::::::: */
|
||||
/* map_create.c :+: :+: */
|
||||
/* +:+ */
|
||||
/* By: qmennen <qmennen@student.codam.nl> +#+ */
|
||||
/* By: whaffman <whaffman@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2025/04/23 12:21:13 by whaffman #+# #+# */
|
||||
/* Updated: 2025/05/07 11:52:14 by whaffman ######## odam.nl */
|
||||
/* Updated: 2025/05/14 20:24:32 by whaffman ######## odam.nl */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "cub3d.h"
|
||||
|
||||
int map_create(t_game **game, const char *mapfile)
|
||||
static int map_allocate(t_game **game)
|
||||
{
|
||||
t_tile **grid;
|
||||
|
||||
if (!(*game))
|
||||
return (FAILURE);
|
||||
(*game)->map = malloc(sizeof(t_map));
|
||||
if (!(*game)->map)
|
||||
{
|
||||
@ -25,15 +21,30 @@ int map_create(t_game **game, const char *mapfile)
|
||||
return (FAILURE);
|
||||
}
|
||||
ft_memset((*game)->map->textures, 0, sizeof((*game)->map->textures));
|
||||
return (SUCCESS);
|
||||
}
|
||||
|
||||
static int map_parse_and_copy(t_game **game,
|
||||
const char *mapfile, t_tile ***out_grid)
|
||||
{
|
||||
t_tile **grid;
|
||||
|
||||
if (!parse_args(mapfile, (*game)))
|
||||
return (FAILURE);
|
||||
grid = copy_map((*game)->map->grid, (*game)->map->width, (*game)->map->height);
|
||||
grid = copy_map((*game)->map->grid,
|
||||
(*game)->map->width, (*game)->map->height);
|
||||
if (!grid)
|
||||
{
|
||||
perror("Error copying (*game)->map");
|
||||
free((*game)->map);
|
||||
return (FAILURE);
|
||||
}
|
||||
*out_grid = grid;
|
||||
return (SUCCESS);
|
||||
}
|
||||
|
||||
static int map_validate_and_finalize(t_game **game, t_tile **grid)
|
||||
{
|
||||
if (!enclosed_map((*game)->map))
|
||||
{
|
||||
ft_putendl_fd("Map is not enclosed", STDERR_FILENO);
|
||||
@ -46,3 +57,16 @@ int map_create(t_game **game, const char *mapfile)
|
||||
print_config((*game)->map);
|
||||
return (SUCCESS);
|
||||
}
|
||||
|
||||
int map_create(t_game **game, const char *mapfile)
|
||||
{
|
||||
t_tile **grid;
|
||||
|
||||
if (!(*game))
|
||||
return (FAILURE);
|
||||
if (map_allocate(game) == FAILURE)
|
||||
return (FAILURE);
|
||||
if (map_parse_and_copy(game, mapfile, &grid) == FAILURE)
|
||||
return (FAILURE);
|
||||
return (map_validate_and_finalize(game, grid));
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
/* By: whaffman <whaffman@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2025/04/23 12:22:28 by whaffman #+# #+# */
|
||||
/* Updated: 2025/05/14 12:48:03 by whaffman ######## odam.nl */
|
||||
/* Updated: 2025/05/14 19:57:03 by whaffman ######## odam.nl */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
||||
74
src/moves.c
Normal file
74
src/moves.c
Normal file
@ -0,0 +1,74 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* moves.c :+: :+: */
|
||||
/* +:+ */
|
||||
/* By: whaffman <whaffman@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2025/05/14 20:08:27 by whaffman #+# #+# */
|
||||
/* Updated: 2025/05/14 20:14:24 by whaffman ######## odam.nl */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "cub3d.h"
|
||||
|
||||
static void move(t_map *map, t_player *player, int dir, double delta)
|
||||
{
|
||||
double xa;
|
||||
double ya;
|
||||
|
||||
xa = dir * player->dir.x * player->speed * delta;
|
||||
ya = dir * player->dir.y * player->speed * delta;
|
||||
if (xa != 0 && collision_horizontal(map, player, xa))
|
||||
{
|
||||
player->pos.x += xa;
|
||||
player->is_moving = 1;
|
||||
}
|
||||
if (ya != 0 && collision_vertical(map, player, ya))
|
||||
{
|
||||
player->pos.y += ya;
|
||||
player->is_moving = 1;
|
||||
}
|
||||
}
|
||||
|
||||
static void strave(t_map *map, t_player *player, int dir, double delta)
|
||||
{
|
||||
double xa;
|
||||
double ya;
|
||||
|
||||
xa = dir * perp(player->dir).x * player->speed * delta;
|
||||
ya = dir * perp(player->dir).y * player->speed * delta;
|
||||
if (xa != 0 && collision_horizontal(map, player, xa))
|
||||
{
|
||||
player->pos.x += xa;
|
||||
player->is_moving = 1;
|
||||
}
|
||||
if (ya != 0 && collision_vertical(map, player, ya))
|
||||
{
|
||||
player->is_moving = 1;
|
||||
player->pos.y += ya;
|
||||
}
|
||||
}
|
||||
|
||||
static void rotate(t_player *player, double rot_speed, double delta)
|
||||
{
|
||||
player->dir = rot(player->dir, rot_speed * delta);
|
||||
player->camera = rot(player->camera, rot_speed * delta);
|
||||
}
|
||||
|
||||
void player_update(t_game *game, double delta_time)
|
||||
{
|
||||
game->player->is_moving = 0;
|
||||
if (get_key(game, MLX_KEY_W))
|
||||
move(game->map, game->player, 1, delta_time);
|
||||
else if (get_key(game, MLX_KEY_S))
|
||||
move(game->map, game->player, -1, delta_time);
|
||||
if (get_key(game, MLX_KEY_A))
|
||||
strave(game->map, game->player, -1, delta_time);
|
||||
else if (get_key(game, MLX_KEY_D))
|
||||
strave(game->map, game->player, 1, delta_time);
|
||||
if (get_key(game, MLX_KEY_LEFT))
|
||||
rotate(game->player, -2.5, delta_time);
|
||||
else if (get_key(game, MLX_KEY_RIGHT))
|
||||
rotate(game->player, 2.5, delta_time);
|
||||
}
|
||||
@ -6,7 +6,7 @@
|
||||
/* By: whaffman <whaffman@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2025/04/22 13:10:06 by whaffman #+# #+# */
|
||||
/* Updated: 2025/05/14 12:48:03 by whaffman ######## odam.nl */
|
||||
/* Updated: 2025/05/14 20:13:13 by whaffman ######## odam.nl */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
/* By: whaffman <whaffman@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2025/04/22 13:11:18 by whaffman #+# #+# */
|
||||
/* Updated: 2025/05/14 12:48:03 by whaffman ######## odam.nl */
|
||||
/* Updated: 2025/05/14 20:00:32 by whaffman ######## odam.nl */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
||||
63
src/player.c
63
src/player.c
@ -6,7 +6,7 @@
|
||||
/* By: whaffman <whaffman@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2025/04/15 18:53:19 by qmennen #+# #+# */
|
||||
/* Updated: 2025/05/14 18:31:54 by whaffman ######## odam.nl */
|
||||
/* Updated: 2025/05/14 20:14:10 by whaffman ######## odam.nl */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -32,67 +32,6 @@ int player_create(t_game **game)
|
||||
return (SUCCESS);
|
||||
}
|
||||
|
||||
static void move(t_map *map, t_player *player, int dir, double delta)
|
||||
{
|
||||
double xa;
|
||||
double ya;
|
||||
|
||||
xa = dir * player->dir.x * player->speed * delta;
|
||||
ya = dir * player->dir.y * player->speed * delta;
|
||||
if (xa != 0 && collision_horizontal(map, player, xa))
|
||||
{
|
||||
player->pos.x += xa;
|
||||
player->is_moving = 1;
|
||||
}
|
||||
if (ya != 0 && collision_vertical(map, player, ya))
|
||||
{
|
||||
player->pos.y += ya;
|
||||
player->is_moving = 1;
|
||||
}
|
||||
}
|
||||
|
||||
static void strave(t_map *map, t_player *player, int dir, double delta)
|
||||
{
|
||||
double xa;
|
||||
double ya;
|
||||
|
||||
xa = dir * perp(player->dir).x * player->speed * delta;
|
||||
ya = dir * perp(player->dir).y * player->speed * delta;
|
||||
if (xa != 0 && collision_horizontal(map, player, xa))
|
||||
{
|
||||
player->pos.x += xa;
|
||||
player->is_moving = 1;
|
||||
}
|
||||
if (ya != 0 && collision_vertical(map, player, ya))
|
||||
{
|
||||
player->is_moving = 1;
|
||||
player->pos.y += ya;
|
||||
}
|
||||
}
|
||||
|
||||
static void rotate(t_player *player, double rot_speed, double delta)
|
||||
{
|
||||
player->dir = rot(player->dir, rot_speed * delta);
|
||||
player->camera = rot(player->camera, rot_speed * delta);
|
||||
}
|
||||
|
||||
void player_update(t_game *game, double delta_time)
|
||||
{
|
||||
game->player->is_moving = 0;
|
||||
if (get_key(game, MLX_KEY_W))
|
||||
move(game->map, game->player, 1, delta_time);
|
||||
else if (get_key(game, MLX_KEY_S))
|
||||
move(game->map, game->player, -1, delta_time);
|
||||
if (get_key(game, MLX_KEY_A))
|
||||
strave(game->map, game->player, -1, delta_time);
|
||||
else if (get_key(game, MLX_KEY_D))
|
||||
strave(game->map, game->player, 1, delta_time);
|
||||
if (get_key(game, MLX_KEY_LEFT))
|
||||
rotate(game->player, -2.5, delta_time);
|
||||
else if (get_key(game, MLX_KEY_RIGHT))
|
||||
rotate(game->player, 2.5, delta_time);
|
||||
}
|
||||
|
||||
void player_render(t_screen *screen, t_player *player)
|
||||
{
|
||||
t_vec2 direction;
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
/* By: whaffman <whaffman@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2025/05/08 12:23:17 by qmennen #+# #+# */
|
||||
/* Updated: 2025/05/14 16:10:05 by whaffman ######## odam.nl */
|
||||
/* Updated: 2025/05/14 20:06:28 by whaffman ######## odam.nl */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
||||
24
src/screen.c
24
src/screen.c
@ -6,7 +6,7 @@
|
||||
/* By: whaffman <whaffman@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2025/04/15 15:30:27 by qmennen #+# #+# */
|
||||
/* Updated: 2025/05/14 18:31:32 by whaffman ######## odam.nl */
|
||||
/* Updated: 2025/05/14 20:19:21 by whaffman ######## odam.nl */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -58,13 +58,26 @@ void fill_background(t_screen *screen, int color)
|
||||
}
|
||||
}
|
||||
|
||||
int screen_display(t_screen *screen)
|
||||
int center_window(t_screen *screen)
|
||||
{
|
||||
int m_width;
|
||||
int m_height;
|
||||
|
||||
m_width = 0;
|
||||
m_height = 0;
|
||||
mlx_get_monitor_size(0, &m_width, &m_height);
|
||||
if (m_width == 0 || m_height == 0)
|
||||
{
|
||||
printf(RED"Failed to retrieve monitor size to center window\n"RESET);
|
||||
return (FAILURE);
|
||||
}
|
||||
mlx_set_window_pos(screen->mlx, (m_width - screen->width) / 2,
|
||||
(m_height - screen->height) / 2);
|
||||
return (SUCCESS);
|
||||
}
|
||||
|
||||
int screen_display(t_screen *screen)
|
||||
{
|
||||
fill_background(screen, 0x000000FF);
|
||||
if (mlx_image_to_window(screen->mlx, screen->background, 0, 0) < 0)
|
||||
{
|
||||
@ -86,12 +99,7 @@ int screen_display(t_screen *screen)
|
||||
printf(RED"Failed to display buffer image\n"RESET);
|
||||
return (FAILURE);
|
||||
}
|
||||
mlx_get_monitor_size(0, &m_width, &m_height);
|
||||
if (m_width == 0 || m_height == 0)
|
||||
{
|
||||
printf(RED"Failed to retrieve monitor size to center window\n"RESET);
|
||||
if (!center_window(screen))
|
||||
return (FAILURE);
|
||||
}
|
||||
mlx_set_window_pos(screen->mlx, (m_width - screen->width) / 2, (m_height - screen->height) / 2);
|
||||
return (SUCCESS);
|
||||
}
|
||||
|
||||
@ -3,10 +3,10 @@
|
||||
/* :::::::: */
|
||||
/* texutre_load.c :+: :+: */
|
||||
/* +:+ */
|
||||
/* By: qmennen <qmennen@student.codam.nl> +#+ */
|
||||
/* By: whaffman <whaffman@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2025/05/06 15:45:58 by qmennen #+# #+# */
|
||||
/* Updated: 2025/05/14 12:48:03 by whaffman ######## odam.nl */
|
||||
/* Updated: 2025/05/14 20:01:57 by whaffman ######## odam.nl */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -43,7 +43,8 @@ int texture_load(t_game *game)
|
||||
game->map->textures[SIDE_WEST] = mlx_load_png(game->map->west_texture);
|
||||
game->map->texture_floor = mlx_load_png("./assets/floor.png");
|
||||
game->map->texture_ceiling = mlx_load_png("./assets/ceiling64x64.png");
|
||||
if (!game->map->textures[SIDE_NORTH] || !game->map->textures[SIDE_EAST] || !game->map->textures[SIDE_SOUTH] || !game->map->textures[SIDE_WEST])
|
||||
if (!game->map->textures[SIDE_NORTH] || !game->map->textures[SIDE_EAST]
|
||||
|| !game->map->textures[SIDE_SOUTH] || !game->map->textures[SIDE_WEST])
|
||||
{
|
||||
texture_delete(game);
|
||||
return (FAILURE);
|
||||
|
||||
@ -3,72 +3,50 @@
|
||||
/* :::::::: */
|
||||
/* initialize.c :+: :+: */
|
||||
/* +:+ */
|
||||
/* By: qmennen <qmennen@student.codam.nl> +#+ */
|
||||
/* By: whaffman <whaffman@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2025/04/22 17:08:26 by qmennen #+# #+# */
|
||||
/* Updated: 2025/05/12 12:51:27 by whaffman ######## odam.nl */
|
||||
/* Updated: 2025/05/14 20:33:11 by whaffman ######## odam.nl */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "cub3d.h"
|
||||
|
||||
static t_sprite make_sprite(char *path, double x, double y, int n)
|
||||
{
|
||||
t_sprite sprite;
|
||||
|
||||
sprite.texture = mlx_load_png(path);
|
||||
sprite.n_frames = n;
|
||||
sprite.pos.x = x;
|
||||
sprite.pos.y = y;
|
||||
sprite.dist = 0;
|
||||
sprite.cam_frac = 0;
|
||||
sprite.alpha = 0;
|
||||
return (sprite);
|
||||
}
|
||||
|
||||
static int init_temp(t_game **game)
|
||||
{
|
||||
t_sprite *sprites;
|
||||
|
||||
(*game)->map->sprites = malloc(sizeof(t_sprite) * 10);
|
||||
if (!(*game)->map->sprites)
|
||||
return (FAILURE);
|
||||
(*game)->map->sprites[0].n_frames = 1;
|
||||
(*game)->map->sprites[0].pos.x = 3.5;
|
||||
(*game)->map->sprites[0].pos.y = 3.5;
|
||||
(*game)->map->sprites[0].dist = 0;
|
||||
(*game)->map->sprites[0].texture = mlx_load_png("./assets/battery.png");
|
||||
(*game)->map->sprites[1].n_frames = 1;
|
||||
(*game)->map->sprites[1].pos.x = 2.5;
|
||||
(*game)->map->sprites[1].pos.y = 3.5;
|
||||
(*game)->map->sprites[1].dist = 0;
|
||||
(*game)->map->sprites[1].texture = mlx_load_png("./assets/battery.png");
|
||||
(*game)->map->sprites[2].n_frames = 1;
|
||||
(*game)->map->sprites[2].pos.x = 1.5;
|
||||
(*game)->map->sprites[2].pos.y = 3.5;
|
||||
(*game)->map->sprites[2].dist = 0;
|
||||
(*game)->map->sprites[2].texture = mlx_load_png("./assets/battery.png");
|
||||
(*game)->map->sprites[3].n_frames = 1;
|
||||
(*game)->map->sprites[3].pos.x = 3.5;
|
||||
(*game)->map->sprites[3].pos.y = 4.5;
|
||||
(*game)->map->sprites[3].dist = 0;
|
||||
(*game)->map->sprites[3].texture = mlx_load_png("./assets/broken_mirror.png");
|
||||
(*game)->map->sprites[4].n_frames = 1;
|
||||
(*game)->map->sprites[4].pos.x = 2.5;
|
||||
(*game)->map->sprites[4].pos.y = 5.5;
|
||||
(*game)->map->sprites[4].dist = 0;
|
||||
(*game)->map->sprites[4].texture = mlx_load_png("./assets/lamp.png");
|
||||
(*game)->map->sprites[5].n_frames = 1;
|
||||
(*game)->map->sprites[5].pos.x = 10.5;
|
||||
(*game)->map->sprites[5].pos.y = 6.5;
|
||||
(*game)->map->sprites[5].dist = 0;
|
||||
(*game)->map->sprites[5].texture = mlx_load_png("./assets/battery.png");
|
||||
(*game)->map->sprites[6].n_frames = 1;
|
||||
(*game)->map->sprites[6].pos.x = 14.5;
|
||||
(*game)->map->sprites[6].pos.y = 3.5;
|
||||
(*game)->map->sprites[6].dist = 0;
|
||||
(*game)->map->sprites[6].texture = mlx_load_png("./assets/battery.png");
|
||||
(*game)->map->sprites[7].n_frames = 1;
|
||||
(*game)->map->sprites[7].pos.x = 36.5;
|
||||
(*game)->map->sprites[7].pos.y = 3.5;
|
||||
(*game)->map->sprites[7].dist = 0;
|
||||
(*game)->map->sprites[7].texture = mlx_load_png("./assets/battery.png");
|
||||
(*game)->map->sprites[8].n_frames = 1;
|
||||
(*game)->map->sprites[8].pos.x = 42.5;
|
||||
(*game)->map->sprites[8].pos.y = 4.5;
|
||||
(*game)->map->sprites[8].dist = 0;
|
||||
(*game)->map->sprites[8].texture = mlx_load_png("./assets/broken_mirror.png");
|
||||
(*game)->map->sprites[9].n_frames = 1;
|
||||
(*game)->map->sprites[9].pos.x = 9.5;
|
||||
(*game)->map->sprites[9].pos.y = 10.5;
|
||||
(*game)->map->sprites[9].dist = 0;
|
||||
(*game)->map->sprites[9].texture = mlx_load_png("./assets/lamp.png");
|
||||
sprites = (*game)->map->sprites;
|
||||
sprites[0] = make_sprite("./assets/battery.png", 3.5, 3.5, 1);
|
||||
sprites[1] = make_sprite("./assets/battery.png", 2.5, 3.5, 1);
|
||||
sprites[2] = make_sprite("./assets/battery.png", 1.5, 3.5, 1);
|
||||
sprites[3] = make_sprite("./assets/broken_mirror.png", 3.5, 4.5, 1);
|
||||
sprites[4] = make_sprite("./assets/lamp.png", 2.5, 5.5, 1);
|
||||
sprites[5] = make_sprite("./assets/battery.png", 10.5, 6.5, 1);
|
||||
sprites[6] = make_sprite("./assets/battery.png", 14.5, 3.5, 1);
|
||||
sprites[7] = make_sprite("./assets/battery.png", 36.5, 3.5, 1);
|
||||
sprites[8] = make_sprite("./assets/broken_mirror.png", 42.5, 4.5, 1);
|
||||
sprites[9] = make_sprite("./assets/lamp.png", 9.5, 10.5, 1);
|
||||
(*game)->map->n_sprites = 10;
|
||||
(*game)->screen->hud = mlx_texture_to_image((*game)->screen->mlx, mlx_load_png("./assets/overlay2.png"));
|
||||
(*game)->screen->hud = mlx_texture_to_image((*game)->screen->mlx,
|
||||
mlx_load_png("./assets/overlay2.png"));
|
||||
return (SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@ -3,15 +3,16 @@
|
||||
/* :::::::: */
|
||||
/* keyboard.c :+: :+: */
|
||||
/* +:+ */
|
||||
/* By: qmennen <qmennen@student.codam.nl> +#+ */
|
||||
/* By: whaffman <whaffman@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2025/04/17 19:29:29 by qmennen #+# #+# */
|
||||
/* Updated: 2025/05/07 11:35:41 by whaffman ######## odam.nl */
|
||||
/* Updated: 2025/05/14 20:01:04 by whaffman ######## odam.nl */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "keyboard.h"
|
||||
|
||||
// TODO: Better
|
||||
int keyboard_create(t_game **game)
|
||||
{
|
||||
t_keyboard *keyboard;
|
||||
@ -22,7 +23,7 @@ int keyboard_create(t_game **game)
|
||||
return (FAILURE);
|
||||
(*game)->keyboard = keyboard;
|
||||
i = 0;
|
||||
while (i < NUM_KEYS) // TODO: Better
|
||||
while (i < NUM_KEYS)
|
||||
{
|
||||
(*game)->keyboard->keys[i] = 0;
|
||||
i++;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user