100 lines
2.3 KiB
C
100 lines
2.3 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* mlx_structs.h :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: bgoulard <bgoulard@student.42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2024/11/10 05:33:08 by bgoulard #+# #+# */
|
|
/* Updated: 2024/12/20 15:01:06 by bgoulard ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#ifndef MLX_STRUCTS_H
|
|
# define MLX_STRUCTS_H
|
|
|
|
# include <X11/X.h>
|
|
# include <X11/Xlib.h>
|
|
# include <X11/extensions/XShm.h>
|
|
|
|
# define MLX_TYPE_SHM_PIXMAP 3
|
|
# define MLX_TYPE_SHM 2
|
|
# define MLX_TYPE_XIMAGE 1
|
|
|
|
# define MLX_MAX_EVENT 36
|
|
|
|
# define ENV_DISPLAY "DISPLAY"
|
|
# define LOCALHOST "localhost"
|
|
|
|
typedef struct s_xpm_col
|
|
{
|
|
int name;
|
|
int col;
|
|
} t_xpm_col;
|
|
|
|
struct s_col_name
|
|
{
|
|
char *name;
|
|
int color;
|
|
};
|
|
|
|
typedef struct s_event_list
|
|
{
|
|
int mask;
|
|
int (*hook)();
|
|
void *param;
|
|
} t_event_list;
|
|
|
|
/// @brief window pointer from mlx
|
|
typedef struct s_win_list
|
|
{
|
|
Window window;
|
|
GC gc;
|
|
struct s_win_list *next;
|
|
int (*mouse_hook)();
|
|
int (*key_hook)();
|
|
int (*expose_hook)();
|
|
void *mouse_param;
|
|
void *key_param;
|
|
void *expose_param;
|
|
t_event_list hooks[MLX_MAX_EVENT];
|
|
} t_win_list;
|
|
|
|
typedef struct s_img
|
|
{
|
|
XImage *image;
|
|
Pixmap pix;
|
|
GC gc;
|
|
int size_line;
|
|
int bpp;
|
|
int width;
|
|
int height;
|
|
int type;
|
|
int format;
|
|
char *data;
|
|
XShmSegmentInfo shm;
|
|
} t_img;
|
|
|
|
/// @brief mlx pointer
|
|
typedef struct s_xvar
|
|
{
|
|
Display *display;
|
|
Window root;
|
|
int screen;
|
|
int depth;
|
|
Visual *visual;
|
|
Colormap cmap;
|
|
int private_cmap;
|
|
t_win_list *win_list;
|
|
int (*loop_hook)();
|
|
void *loop_param;
|
|
int use_xshm;
|
|
int pshm_format;
|
|
int do_flush;
|
|
int decrgb[6];
|
|
Atom wm_delete_window;
|
|
Atom wm_protocols;
|
|
int end_loop;
|
|
} t_xvar;
|
|
|
|
#endif /* MLX_STRUCTS_H */
|