Files
42_INT_04_fdf/includes/fdf.h
2021-07-25 13:59:18 +02:00

93 lines
1.9 KiB
C

#ifndef FDF_H
# define FDF_H
# include "../libft/includes/libft.h"
# include <mlx.h>
# include <unistd.h> // for sleep()
# include <math.h> // for M_PI
# include <stdio.h> // for printf()
# include <fcntl.h> // for open
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;
int zoom;
int img_bpp;
int img_sizel;
int img_endian;
} t_fdf;
void init_fdf(t_fdf *fdf);
void init_offset(t_fdf *fdf);
void init_server(t_fdf *fdf);
int print_keycode(int keycode);
int shut_down(t_fdf *fdf);
void draw_image(t_fdf *fdf);
void draw_pixel(t_fdf *fdf, int x, int y, int color);
void draw_color_pixel(t_fdf *fdf, int new_x, int new_y, int z);
int keypress(int keycode, t_fdf *fdf);
void keypress_more(int keycode, t_fdf *fdf);
void position_state(t_fdf *fdf);
int is_color(char *color);
int **parse_map(t_fdf *fdf, int fd);
int *new_coordinates(t_fdf *fdf, int i, int j);
void draw_lines(t_fdf *fdf, int *start, int *end);
void draw_grid(t_fdf *fdf, int i, int j);
# define ESCAPE 65307
# define UP 65362
# define DOWN 65364
# define LEFT 65361
# define RIGHT 65363
# define A 97
# define B 98
# define C 99
# define D 100
# define E 101
# define F 102
# define G 103
# define H 104
# define I 105
# define J 106
# define K 107
# define L 108
# define M 109
# define N 110
# define O 111
# define P 112
# define Q 113
# define R 114
# define S 115
# define T 116
# define U 117
# define V 118
# define W 119
# define X 120
# define Y 121
# define Z 122
#endif