CC := gcc
CFLAGS = -std=c99 -Wall -Wextra -Werror -Wpedantic
-INCGRAPH := minilibx-linux /usr/include Libft/inc
+INCGRAPH := minilibx-linux /usr/include
LINKGRAPH := -Lminilibx-linux -lmlx -L/usr/lib -lXext -lX11 -lm -lbsd -LLibft -lft
ifneq ("$(wildcard .debug)","")
LFTDIR := Libft/
LFT := $(LFTDIR)libft.a
-INCDIR := inc $(LFTDIR)inc/ $(MLXDIR)
+INCDIR := inc $(LFTDIR)inc/ $(INCGRAPH)
INCLUDE := $(addprefix -I, $(INCDIR))
SRCDIR := src
touch $@
$(NAME) : $(OBJECTS) $(LFT) $(MLX)
- $(CC) $(CFLAGS) -o $@ $^ $(LINKS)
+ $(CC) $(CFLAGS) -o $@ $^ $(LINKGRAPH)
FORCE: ;
#include <limits.h>
#include <stdlib.h>
-int handle_key_press(int keycode, t_session *s)
-{
- if (keycode == XK_Escape)
- close_win(s);
- else if (keycode == XK_Up || keycode == XK_w)
- else if (keycode == XK_Left || keycode == XK_a)
- else if (keycode == XK_Down || keycode == XK_s)
- else if (keycode == XK_Right || keycode == XK_d)
- else if (keycode == XK_KP_Add)
- else if (keycode == XK_KP_Subtract)
- if (keycode != XK_Escape)
- draw(s);
- return (0);
-}
-
-int handle_mouse_press(int button, int x, int y, t_session *s)
-{
- if (button == Button4)
- else if (button == Button5)
- if (button == Button4 || button == Button5)
- draw(s);
- return (0);
-}
-
-int no_event_handle(t_session *s)
-{
- return (0);
-}
-
void *get_pixel(t_img *img, int x, int y)
{
return (img->addr + y * img->bpl + x * img->bpp / CHAR_BIT);
{
int x;
int y;
- double param;
t_ray ray;
x = 0;
return ;
}
+int close_win(t_session *s)
+{
+ mlx_destroy_window(s->mlx, s->win);
+ s->win = NULL;
+ return (0);
+}
+
+int handle_key_press(int keycode, t_session *s)
+{
+ if (keycode == XK_Escape)
+ close_win(s);
+ /*
+ else if (keycode == XK_Up || keycode == XK_w)
+ else if (keycode == XK_Left || keycode == XK_a)
+ else if (keycode == XK_Down || keycode == XK_s)
+ else if (keycode == XK_Right || keycode == XK_d)
+ else if (keycode == XK_KP_Add)
+ else if (keycode == XK_KP_Subtract)
+ */
+ if (keycode != XK_Escape)
+ draw(s);
+ return (0);
+}
+
+int handle_mouse_press(int button, __attribute__((unused)) int x, __attribute__((unused)) int y, t_session *s)
+{
+ /*
+ if (button == Button4)
+ else if (button == Button5)
+ */
+ if (button == Button4 || button == Button5)
+ draw(s);
+ return (0);
+}
+
+int no_event_handle(__attribute__((unused)) t_session *s)
+{
+ return (0);
+}
+
void init_session(t_session *s)
{
s->mlx = mlx_init();
&s->img.bpp, &s->img.bpl, &s->img.endian);
}
-int close_win(t_session *s)
-{
- mlx_destroy_window(s->mlx, s->win);
- s->win = NULL;
- return (0);
-}
-
static void free_session(t_session *s)
{
mlx_destroy_display(s->mlx);
s->img.height = 1011;
}
-int main(int argc, char **argv)
+int main(void)
{
t_session s;
set_defaults(&s);
+ /*
if (parse_args(argc, argv, &s))
{
print_help();
return (1);
}
+ */
init_session(&s);
mlx_hook(s.win, KeyPress, KeyPressMask, handle_key_press, &s);
mlx_hook(s.win, ButtonPress, ButtonPressMask, handle_mouse_press, &s);