mirror of
https://codeberg.org/ACME-Corporation/cub3d.git
synced 2025-12-06 01:48:08 +01:00
wip: trying to render sprites
This commit is contained in:
parent
d3ba05a36d
commit
134a6e14f0
1 changed files with 9 additions and 1 deletions
10
src/main.c
10
src/main.c
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/07/17 14:14:30 by kcolin #+# #+# */
|
/* Created: 2025/07/17 14:14:30 by kcolin #+# #+# */
|
||||||
/* Updated: 2025/07/31 15:01:00 by kcolin ### ########.fr */
|
/* Updated: 2025/08/05 13:20:05 by tchampio ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
#include "raycast/raycaster.h"
|
#include "raycast/raycaster.h"
|
||||||
#include "renderer/render.h"
|
#include "renderer/render.h"
|
||||||
#include "raycast/ray.h"
|
#include "raycast/ray.h"
|
||||||
|
#include "sprites/sprite.h"
|
||||||
#include "utils/hooks.h"
|
#include "utils/hooks.h"
|
||||||
#include "utils/inits.h"
|
#include "utils/inits.h"
|
||||||
#include <bits/types/struct_timeval.h>
|
#include <bits/types/struct_timeval.h>
|
||||||
|
|
@ -29,6 +30,9 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "utils/time.h"
|
#include "utils/time.h"
|
||||||
|
|
||||||
|
// for testing purposes
|
||||||
|
// TODO: Put all of that code in separated files
|
||||||
|
|
||||||
int game_loop(t_cub3d_data *data)
|
int game_loop(t_cub3d_data *data)
|
||||||
{
|
{
|
||||||
t_ray ray;
|
t_ray ray;
|
||||||
|
|
@ -56,6 +60,10 @@ int main(int argc, char **argv)
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
return (ft_printf("Error: Missing cub3d file\n"), 1);
|
return (ft_printf("Error: Missing cub3d file\n"), 1);
|
||||||
init_cub3d_data(&data, argv);
|
init_cub3d_data(&data, argv);
|
||||||
|
// placing a sprite next to player to ease debugging
|
||||||
|
data.static_sprite[0].x = data.map->startx + 1;
|
||||||
|
data.static_sprite[0].y = data.map->starty;
|
||||||
|
data.static_sprite[0].texture = mlx_xpm_file_to_image(&data.mlx, "ressources/box.xpm", &data.static_sprite[0].texture_width, &data.static_sprite[0].texture_height);
|
||||||
mlx_hook(data.mlx_win, KeyPress, KeyPressMask, keypress_handler, &data);
|
mlx_hook(data.mlx_win, KeyPress, KeyPressMask, keypress_handler, &data);
|
||||||
mlx_hook(data.mlx_win, KeyRelease, KeyReleaseMask,
|
mlx_hook(data.mlx_win, KeyRelease, KeyReleaseMask,
|
||||||
keyrelease_handler, &data);
|
keyrelease_handler, &data);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue