-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
23ac210
commit 45af360
Showing
132 changed files
with
24,016 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# **************************************************************************** # | ||
# # | ||
# ::: :::::::: # | ||
# Makefile :+: :+: :+: # | ||
# +:+ +:+ +:+ # | ||
# By: nvienot <[email protected]> +#+ +:+ +#+ # | ||
# +#+#+#+#+#+ +#+ # | ||
# Created: 2018/12/14 15:52:13 by nvienot #+# #+# # | ||
# Updated: 2019/03/03 01:21:36 by nvienot ### ########.fr # | ||
# # | ||
# **************************************************************************** # | ||
|
||
NAME = fractol | ||
|
||
SRCS = srcs/main.c srcs/ft_draw_line.c srcs/ft_draw_proj.c srcs/ft_parse.c \ | ||
srcs/ft_init_proj.c srcs/ft_get_map.c srcs/ft_error.c \ | ||
srcs/ft_print.c srcs/ft_init_img.c srcs/ft_deal_key.c \ | ||
srcs/ft_transform.c srcs/ft_utilities.c srcs/ft_create_proj.c \ | ||
srcs/ft_init_win.c | ||
|
||
CC = gcc | ||
|
||
INC. = -I libft/ -I includes/ -I mlx/ | ||
|
||
FLAGS = -O2 -Wall -Werror -Wextra | ||
|
||
OBJS = $(SRCS:.c=.o) | ||
|
||
F.WORK = -lmlx -L mlx -framework OpenGL -framework Appkit | ||
|
||
LIB = libft/libft.a | ||
|
||
RM = rm -rf | ||
|
||
.SILENT : | ||
|
||
.PHONY : all clean fclean re | ||
|
||
#Colors | ||
_BLACK=\x1b[30m | ||
_RED=\x1b[31m | ||
_GREEN=\x1b[32m | ||
_YELLOW=\x1b[33m | ||
_BLUE=\x1b[34m | ||
_PURPLE=\x1b[35m | ||
_CYAN=\x1b[36m | ||
_WHITE=\x1b[37m | ||
|
||
_END=\x1b[0m | ||
|
||
all : $(NAME) | ||
|
||
$(NAME) : $(OBJS) Makefile includes/fractol.h | ||
make -C libft/ | ||
echo "$(_RED)Libft ! $(_GREEN)OK$(_END)" | ||
make -C mlx/ | ||
$(CC) -o $(NAME) $(OBJS) $(LIB) $(F.WORK) | ||
|
||
echo "$(_RED) ______ _ _ _ _ _ _ " | ||
echo "$(_RED) | ___| | | ( ) | | (_) | | | | " | ||
echo "$(_BLUE) | |_ _ __ __ _ ___| |_ |/ ___ | | _ ___ _ __ ___ __ _ __| |_ _ | | " | ||
echo "$(_PURPLE) | _| '__/ _ |/ __| __| / _ \| | | / __| | '__/ _ \/ _ |/ _ | | | | | | " | ||
echo "$(_CYAN) | | | | | (_| | (__| |_ | (_) | | | \__ \ | | | __/ (_| | (_| | |_| | |_| " | ||
echo "$(_GREEN) \_| |_| \__,_|\___|\__| \___/|_| |_|___/ |_| \___|\__,_|\__,_|\__, | (_) " | ||
echo "$(_YELLOW) __/ | " | ||
echo "$(_WHITE) $(_RED)By $(_CYAN)nvienot $(_GREEN)2019 $(_YELLOW)!$(_WHITE)!$(_END) |___/ " | ||
echo "\n" | ||
|
||
$(OBJS) : %.o: %.c | ||
$(CC) $(FLAGS) $(INC.) -c $< -o $@ | ||
|
||
clean : | ||
@$(RM) $(OBJS) | ||
make clean -C libft/ | ||
make clean -C mlx/ | ||
|
||
echo "$(_RED)Clean ! $(_GREEN)OK$(_END)" | ||
|
||
fclean : clean | ||
@$(RM) $(NAME) | ||
make fclean -C libft/ | ||
|
||
echo "$(_RED)Fclean ! $(_GREEN)OK$(_END)" | ||
|
||
re : fclean all | ||
make re -C libft/ | ||
make re -C mlx/ | ||
|
||
recl : all clean | ||
make recl -C libft/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
nvienot | ||
dsds | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
/* ************************************************************************** */ | ||
/* */ | ||
/* ::: :::::::: */ | ||
/* fractol.h :+: :+: :+: */ | ||
/* +:+ +:+ +:+ */ | ||
/* By: nvienot <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2019/01/16 11:41:57 by nvienot #+# #+# */ | ||
/* Updated: 2019/03/03 01:20:26 by nvienot ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
#ifndef FRACTOL_H | ||
# define FRACTOL_H | ||
|
||
# include "libft.h" | ||
# include "mlx.h" | ||
# include <fcntl.h> | ||
# include <stdio.h> | ||
# include <unistd.h> | ||
# include <stdlib.h> | ||
# include <math.h> | ||
|
||
# define BUFF_SIZE 9999 | ||
# define BUF_SIZE 1000 | ||
|
||
# define PI 3.14 | ||
# define COEF_ZOOM 1.2 | ||
# define COEF_ROTA 1 | ||
# define SIZE_MOV 15 | ||
# define COEF_ALT 1.2 | ||
# define COEF_Z 0.2 | ||
# define MIN_ZOOM 0.01 | ||
# define MAX_ZOOM 150 | ||
# define MAX_ALT 15 | ||
# define MIN_ALT -15 | ||
|
||
# define BLACK 0 | ||
# define BLUE 255 | ||
# define GREEN 65280 | ||
# define RED 16711680 | ||
# define PURPLE 16711935 | ||
# define WHITE 16777215 | ||
# define GREY 6908265 | ||
|
||
# define WIN_HOR_SIZE 1700 | ||
# define WIN_VER_SIZE 1100 | ||
# define IMG_HOR_SIZE 1100 | ||
# define IMG_VER_SIZE 800 | ||
|
||
# define TOUCH_ESC 53 | ||
# define ARROW_LEFT 123 | ||
# define ARROW_DOWN 125 | ||
# define ARROW_RIGHT 124 | ||
# define ARROW_UP 126 | ||
# define TOUCH_PLUS 69 | ||
# define TOUCH_LESS 78 | ||
# define TOUCH_O 31 | ||
# define TOUCH_P 35 | ||
# define TOUCH_I 34 | ||
# define TOUCH_R 15 | ||
# define TOUCH_T 17 | ||
# define TOUCH_M 46 | ||
# define TOUCH_C 8 | ||
# define TOUCH_STAR 67 | ||
# define PAGE_DOWN 121 | ||
# define PAGE_UP 116 | ||
|
||
typedef struct s_map | ||
{ | ||
int x; | ||
int y; | ||
int z; | ||
int x_pix; | ||
int y_pix; | ||
float z_pix; | ||
int x_pix_temp; | ||
int color; | ||
} t_map; | ||
|
||
typedef struct s_win | ||
{ | ||
t_map **s; | ||
void *mlx_ptr; | ||
void *win_ptr; | ||
void *img_ptr; | ||
void *img_back1; | ||
void *img_back2; | ||
void *img_back3; | ||
void *img_back4; | ||
void *img_back5; | ||
void *img_back6; | ||
void *img_back7; | ||
void *img_back8; | ||
void *img_back9; | ||
char *filename; | ||
char *data; | ||
int choosecolor; | ||
int rota; | ||
int start; | ||
int proj; | ||
int menu; | ||
int img; | ||
int x_max; | ||
int y_max; | ||
float z_min; | ||
float z_max; | ||
int pos_max; | ||
int x1; | ||
int x2; | ||
int y1; | ||
int y2; | ||
float z; | ||
float z1; | ||
float z2; | ||
int aff_x; | ||
int aff_y; | ||
float pix; | ||
float zix; | ||
int hor; | ||
int ver; | ||
int sizeline; | ||
int bpp; | ||
int endian; | ||
} t_win; | ||
|
||
void ft_usage(void); | ||
int ft_parse(t_win **win, char *av); | ||
char *get_map(char *av, t_win **win); | ||
void ft_create_proj(t_win **win); | ||
void ft_init_xypix(t_win **win); | ||
void ft_init_pix_and_pos_orthographic_projection(t_win **win); | ||
void ft_init_pos_isometric_projection(t_win **win); | ||
void ft_init_pix_isometric_projection(t_win **win); | ||
int ft_print_menu(t_win **win); | ||
void mlx_put_pixel_to_image(t_win **win, int x, int y, int i); | ||
int deal_key(int keycode, t_win **win); | ||
void ft_move_pos(t_win **win); | ||
void ft_rotate(t_win **win, int i, float a, float b); | ||
void ft_rotate_2(t_win **win, int i, float a, float b); | ||
void ft_get_color(t_win **win); | ||
void ft_free_struct(t_win **win); | ||
int ft_draw_para(t_win **win); | ||
int ft_draw_iso(t_win **win); | ||
void ft_refresh_img(t_win **win); | ||
void ft_new_imgs(t_win **win); | ||
void ft_init_start(t_win **win, char *av1); | ||
void ft_init_refresh(t_win **win); | ||
int ft_altitude_color(t_win **win, int i); | ||
void ft_altitude(t_win **win, int a); | ||
void ft_display_menu(t_win **win); | ||
char *ft_get_file_name(char *av1); | ||
void ft_anim_background(t_win **win); | ||
void ft_free_n_exit(t_win **win, int error); | ||
void ft_free_n_exit_map(char **map, t_win **win, int error); | ||
void ft_exit(int code); | ||
void ft_get_z(t_win **win); | ||
void ft_draw_line(t_win **win, int i); | ||
int ft_free_n_exit_win(t_win **win); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# **************************************************************************** # | ||
# # | ||
# ::: :::::::: # | ||
# Makefile :+: :+: :+: # | ||
# +:+ +:+ +:+ # | ||
# By: nvienot <[email protected]> +#+ +:+ +#+ # | ||
# +#+#+#+#+#+ +#+ # | ||
# Created: 2018/11/09 14:10:45 by nvienot #+# #+# # | ||
# Updated: 2019/02/16 16:32:10 by nvienot ### ########.fr # | ||
# # | ||
# **************************************************************************** # | ||
|
||
NAME = libft.a | ||
CC = gcc | ||
FLAGS = -Wall -Wextra -Werror | ||
SRCS = ft_atoi.c ft_putchar.c ft_putnbr.c ft_putstr.c ft_strcat.c ft_strchr.c \ | ||
ft_strcmp.c ft_strcpy.c ft_strdup.c ft_strlcat.c ft_strlen.c ft_strncat.c \ | ||
ft_strncmp.c ft_strncpy.c ft_strstr.c ft_memset.c ft_bzero.c ft_memcpy.c \ | ||
ft_memmove.c ft_memchr.c ft_memcmp.c ft_strrchr.c ft_isalpha.c ft_isdigit.c \ | ||
ft_isalnum.c ft_isascii.c ft_isprint.c ft_toupper.c ft_tolower.c ft_strnstr.c \ | ||
ft_putendl.c ft_putchar_fd.c ft_putendl_fd.c ft_putnbr_fd.c ft_putstr_fd.c \ | ||
ft_strclr.c ft_strdel.c ft_strnew.c ft_memalloc.c ft_memdel.c ft_memccpy.c \ | ||
ft_strequ.c ft_strnequ.c ft_itoa.c ft_striter.c ft_striteri.c ft_strmap.c \ | ||
ft_strmapi.c ft_strjoin.c ft_strsub.c ft_strtrim.c ft_strsplit.c ft_lstadd.c \ | ||
ft_isnumber.c ft_lstiter.c ft_lstdel.c ft_lstdelone.c ft_lstmap.c ft_swap.c \ | ||
ft_lstnew.c ft_iswhitespace.c ft_strlcpy.c ft_sortinttab.c ft_strndup.c \ | ||
ft_str_is_alpha.c ft_str_is_lowercase.c ft_str_is_numeric.c ft_ishexa.c \ | ||
ft_str_is_printable.c ft_str_is_uppercase.c ft_strcapitalize.c \ | ||
ft_strupcase.c ft_strlowcase.c ft_isupper.c ft_islower.c ft_data_in_tab.c \ | ||
ft_strsplit_at_first_c.c get_next_line.c ft_atoi_base.c ft_is_present.c | ||
|
||
OBJS = $(SRCS:.c=.o) | ||
|
||
all: $(NAME) | ||
|
||
$(NAME): libft.h | ||
@$(CC) $(FLAGS) -c $(SRCS) | ||
@ar rc $(NAME) $(OBJS) | ||
@ranlib $(NAME) | ||
|
||
clean: | ||
@/bin/rm -f $(OBJS) | ||
|
||
fclean: clean | ||
@/bin/rm -f $(NAME) | ||
|
||
re: fclean all | ||
|
||
recl: all clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* ************************************************************************** */ | ||
/* */ | ||
/* ::: :::::::: */ | ||
/* ft_atoi.c :+: :+: :+: */ | ||
/* +:+ +:+ +:+ */ | ||
/* By: nvienot <[email protected]> +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2018/11/12 17:35:00 by nvienot #+# #+# */ | ||
/* Updated: 2018/11/21 21:24:18 by nvienot ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
#include "libft.h" | ||
|
||
int ft_atoi(const char *str) | ||
{ | ||
int i; | ||
int neg; | ||
long repatoi; | ||
|
||
i = 0; | ||
repatoi = 0; | ||
neg = 0; | ||
while ((str[i] >= 9 && str[i] <= 13) || (str[i] == 32)) | ||
i++; | ||
if ((str[i] == '+') && (str[i + 1] != '-')) | ||
i++; | ||
if (str[i] == '-') | ||
{ | ||
neg = 1; | ||
i++; | ||
} | ||
while (ft_isdigit(str[i]) == 1) | ||
{ | ||
repatoi = repatoi * 10 + (str[i] - '0'); | ||
i++; | ||
} | ||
if (neg == 1) | ||
return (-repatoi); | ||
return (repatoi); | ||
} |
Oops, something went wrong.