diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-03-08 22:53:57 +0100 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-03-08 22:53:57 +0100 |
| commit | fafabad0906ff9641b0c6183fda8b07745579dfb (patch) | |
| tree | 64e57f2b72b3986aa3869924567ce459a1da5433 /minilibx/mlx_int.h | |
| parent | f52b4ad77158b52fad161e98e116059ac5b68d3d (diff) | |
| download | cub3d-linux.tar.gz cub3d-linux.tar.bz2 cub3d-linux.zip | |
Linux versionlinux
Diffstat (limited to 'minilibx/mlx_int.h')
| -rwxr-xr-x[-rw-r--r--] | minilibx/mlx_int.h | 205 |
1 files changed, 120 insertions, 85 deletions
diff --git a/minilibx/mlx_int.h b/minilibx/mlx_int.h index a93c1c9..8cadead 100644..100755 --- a/minilibx/mlx_int.h +++ b/minilibx/mlx_int.h @@ -1,102 +1,137 @@ -// -// mlx_int.h for minilibx -// -// ol@staff.42.fr -// -// include opengl needed before mlx_int.h -// +/* +** mlx_int.h for mlx in +** +** Made by Charlie Root +** Login <ol@epitech.net> +** +** Started on Mon Jul 31 16:45:48 2000 Charlie Root +** Last update Wed May 25 16:44:16 2011 Olivier Crouzet +*/ -#define MAX_EVENT 32 -#define MAX_PIXEL_NB 200000 -#define UNIQ_BPP 4 -#define FONT_WIDTH 10 -#define FONT_HEIGHT 20 +/* +** Internal settings for MiniLibX +*/ -typedef int (*func_t)(); +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <unistd.h> +#include <fcntl.h> +#include <sys/mman.h> +#include <X11/Xlib.h> +#include <X11/XKBlib.h> +#include <X11/Xutil.h> +#include <sys/ipc.h> +#include <sys/shm.h> +#include <X11/extensions/XShm.h> +#include <bsd/bsd.h> +/* #include <X11/xpm.h> */ -/* structs */ -typedef struct glsl_info_s -{ - GLuint pixel_vshader; - GLuint pixel_fshader; - GLuint pixel_program; - GLint loc_pixel_position; - GLint loc_pixel_texture; - GLint loc_pixel_winhalfsize; - - GLuint image_vshader; - GLuint image_fshader; - GLuint image_program; - GLint loc_image_position; - GLint loc_image_winhalfsize; - GLint loc_image_texture; - GLint loc_image_pos; - GLint loc_image_size; - - GLuint font_vshader; - GLuint font_fshader; - GLuint font_program; - GLint loc_font_position; - GLint loc_font_winhalfsize; - GLint loc_font_texture; - GLint loc_font_color; - GLint loc_font_posinwin; - GLint loc_font_posinatlas; - GLint loc_font_atlassize; -} glsl_info_t; - - -typedef struct mlx_img_list_s +#define MLX_TYPE_SHM_PIXMAP 3 +#define MLX_TYPE_SHM 2 +#define MLX_TYPE_XIMAGE 1 + +#define MLX_MAX_EVENT LASTEvent + + +#define ENV_DISPLAY "DISPLAY" +#define LOCALHOST "localhost" +#define ERR_NO_TRUECOLOR "MinilibX Error : No TrueColor Visual available.\n" +#define WARN_SHM_ATTACH "MinilibX Warning : X server can't attach shared memory.\n" + + +typedef struct s_xpm_col { - int width; - int height; - char *buffer; - GLfloat vertexes[8]; - struct mlx_img_list_s *next; -} mlx_img_list_t; + int name; + int col; +} t_xpm_col; -typedef struct mlx_img_ctx_s +struct s_col_name { - GLuint texture; - GLuint vbuffer; - mlx_img_list_t *img; - struct mlx_img_ctx_s *next; -} mlx_img_ctx_t; + char *name; + int color; +}; -typedef struct mlx_win_list_s +typedef struct s_event_list { - void *winid; - mlx_img_ctx_t *img_list; - int nb_flush; - int pixmgt; - struct mlx_win_list_s *next; -} mlx_win_list_t; + int mask; + int (*hook)(); + void *param; +} t_event_list; -typedef struct mlx_ptr_s +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; + +typedef struct s_xvar { - void *appid; - mlx_win_list_t *win_list; - mlx_img_list_t *img_list; - void (*loop_hook)(void *); - void *loop_hook_data; - void *loop_timer; - mlx_img_list_t *font; - int main_loop_active; -} mlx_ptr_t; - -// proto - -int mlx_shaders(glsl_info_t *glsl); -char **mlx_int_str_to_wordtab(char *str); -int mlx_int_str_str(char *str,char *find,int len); -int mlx_int_str_str_cote(char *str,char *find,int len); -int mlx_destroy_image(mlx_ptr_t *mlx_ptr, mlx_img_list_t *img_ptr); + 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]; +} t_xvar; + + +int mlx_int_do_nothing(); +int mlx_int_get_good_color(); +int mlx_int_find_in_pcm(); +int mlx_int_anti_resize_win(); +int mlx_int_wait_first_expose(); +int mlx_int_rgb_conversion(); +int mlx_int_deal_shm(); +void *mlx_int_new_xshm_image(); +char **mlx_int_str_to_wordtab(); void *mlx_new_image(); -void *mlx_xpm_to_image(mlx_ptr_t *xvar,char **xpm_data,int *width,int *height); -int mlx_do_sync(mlx_ptr_t *mlx_ptr); +int shm_att_pb(); + +/* +** Added +*/ + +int mlx_int_str_str(char *str,char *find,int len); +int mlx_int_get_visual(t_xvar *xvar); +int mlx_int_set_win_event_mask(t_xvar *xvar); +int mlx_get_color_value(t_xvar *xvar,int color); +int mlx_int_str_str_cote(char *str,char *find,int len); |
