added debounce time

This commit is contained in:
asus
2024-01-13 14:38:02 +01:00
parent dabb4acf7a
commit a2f5f90fce
9 changed files with 80 additions and 37 deletions

View File

@@ -3,39 +3,42 @@
# include "../libft/includes/libft.h"
# include <mlx.h>
# include <math.h> // for M_PI
# include <fcntl.h> // for open
# include <math.h> // for M_PI
# include <fcntl.h> // for open
# include <time.h> // for time
# include <sys/time.h> // for gettimeofday
typedef struct s_fdf
{
void *mlx_ptr;
void *win_ptr;
void *img_ptr;
char *img_addr;
int **map;
int offset;
int min_z;
int max_z;
int z_amplitude;
int altitude;
int win_size_x;
int win_size_y;
int img_size_x;
int img_size_y;
int map_size_x;
int map_size_y;
int map_width;
int map_height;
int rot_x;
int rot_y;
double rad_x;
double rad_y;
int mov_x;
int mov_y;
double zoom;
int img_bpp;
int img_sizel;
int img_endian;
void *mlx_ptr;
void *win_ptr;
void *img_ptr;
char *img_addr;
int **map;
int offset;
int min_z;
int max_z;
int z_amplitude;
int altitude;
int win_size_x;
int win_size_y;
int img_size_x;
int img_size_y;
int map_size_x;
int map_size_y;
int map_width;
int map_height;
int rot_x;
int rot_y;
double rad_x;
double rad_y;
int mov_x;
int mov_y;
double zoom;
int img_bpp;
int img_sizel;
int img_endian;
struct timeval last_keypress_time;
} t_fdf;
// fdf.c
@@ -71,16 +74,17 @@ int **parse_map(t_fdf *fdf, int fd);
// steps size for the hight transform with p and o
// must be > 0
// 100 is small, 1 is the biggest
# define Z_HEIGHT 10
# define Z_HEIGHT 50
// color for altitude
# define COLOR_START 0xffffff
# define COLOR_END 0x00d700
// R,G,B colors
// ex for col = 0x236ad0
# define COLOR_R(col) ((col & 0xff0000) >> 16) // output 23
# define COLOR_G(col) ((col & 0x00ff00) >> 8) // output 6a
# define COLOR_B(col) (col & 0x0000ff) // output d0
/*
# define COLOR_END 0x1423e6 // blue
*/
# define COLOR_END 0x00d700 // green
// minimum time in milliseconds between two keypress
# define DEBOUNCE_TIME 60
# define ESCAPE 65307
# define UP 65362