mirror of
https://codeberg.org/ACME-Corporation/cub3d.git
synced 2025-12-06 09:58:09 +01:00
feat: Added delta time variable
This commit is contained in:
parent
02940e9ecf
commit
2bc214103b
6 changed files with 53 additions and 3 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/07/17 14:14:30 by kcolin #+# #+# */
|
||||
/* Updated: 2025/07/31 13:30:05 by tchampio ### ########.fr */
|
||||
/* Updated: 2025/07/31 13:57:08 by tchampio ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -21,16 +21,19 @@
|
|||
#include "raycast/ray.h"
|
||||
#include "utils/hooks.h"
|
||||
#include "utils/inits.h"
|
||||
#include <bits/types/struct_timeval.h>
|
||||
#include <stdbool.h>
|
||||
#include <X11/keysym.h>
|
||||
#include <X11/X.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include "utils/time.h"
|
||||
|
||||
int game_loop(t_cub3d_data *data)
|
||||
{
|
||||
t_ray ray;
|
||||
|
||||
data->delta = (get_milliseconds() - data->last_tick);
|
||||
mlx_destroy_image(data->mlx, data->img_data->img);
|
||||
data->img_data->img = mlx_new_image(data->mlx, WIDTH, HEIGHT);
|
||||
reset_matrix(data);
|
||||
|
|
@ -41,6 +44,7 @@ int game_loop(t_cub3d_data *data)
|
|||
mlx_put_image_to_window(data->mlx, data->mlx_win,
|
||||
data->img_data->img, 0, 0);
|
||||
mlx_string_put(data->mlx, data->mlx_win, 10, 10, 0x00FFFFFF, COMPILED_TEXT);
|
||||
data->last_tick = get_milliseconds();
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue