add: better timedloop (uses FPS) for bonus

This commit is contained in:
mcolonna 2024-11-19 15:36:39 +01:00
parent 08db89f6dc
commit c8b3a42d13
7 changed files with 94 additions and 48 deletions

View file

@ -6,7 +6,7 @@
/* By: mcolonna <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/31 17:00:59 by mcolonna #+# #+# */
/* Updated: 2024/11/19 13:54:46 by mcolonna ### ########.fr */
/* Updated: 2024/11/19 15:29:31 by mcolonna ### ########.fr */
/* */
/* ************************************************************************** */
@ -17,11 +17,18 @@
# define PI 3.1415926535 // it's just pi
# define MOVE_SPEED 0.05 // Player oves by N cases by tick
# define ROT_SPEED_DIVIDE_PI 64 // Player turns by pi/N rad by tick
# define MOUSE_ROTATION_SPEED 0.001 // rad/px
# define FPS 30 // Number of frames per second (bonus only)
# define MOVE_SPEED 0.1 // Player oves by N cases by tick
# define ROT_SPEED_DIVIDE_PI 48 // Player turns by pi/N rad by tick
# define MOUSE_ROTATION_SPEED 0.001 // Rotation speed from mouse: rad/px
# define HITBOX 0.25 // Hitbox of N cases around player.
# ifdef BONUS
# define WINDOW_NAME "cub3d (bonus)"
# else
# define WINDOW_NAME "cub3d (mandatory)"
# endif
# define SCREEN_WIDTH 640 // Width of the window
# define SCREEN_HEIGHT 480 // Height of the window

View file

@ -6,7 +6,7 @@
/* By: mcolonna <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/31 16:22:09 by mcolonna #+# #+# */
/* Updated: 2024/11/12 17:41:11 by mcolonna ### ########.fr */
/* Updated: 2024/11/19 15:08:27 by mcolonna ### ########.fr */
/* */
/* ************************************************************************** */
@ -24,6 +24,7 @@
# include <stdlib.h>
# include <string.h>
# include <sys/types.h>
# include <time.h>
# include <unistd.h>
# include <X11/keysym.h>
# include <X11/X.h>