barely anything

This commit is contained in:
Danny Jonker 2023-10-25 14:07:29 +02:00
parent ecb0a9a77d
commit ed0bfd8d61
3 changed files with 107 additions and 11 deletions

8
.gitignore vendored Normal file
View File

@ -0,0 +1,8 @@
*.pdf
*.o
*.a
fract-ol
LICENSE
obj
.git
.ccls-cache

View File

@ -6,23 +6,17 @@
# By: djonker <djonker@student.codam.nl> // \ \ __| | | \ \/ / # # By: djonker <djonker@student.codam.nl> // \ \ __| | | \ \/ / #
# (| | )|_| |_| |> < # # (| | )|_| |_| |> < #
# Created: 2022/11/24 10:12:10 by djonker /'\_ _/`\__|\__,_/_/\_\ # # Created: 2022/11/24 10:12:10 by djonker /'\_ _/`\__|\__,_/_/\_\ #
# Updated: 2023/10/25 13:53:30 by djonker ######## odam.nl # # Updated: 2023/10/25 14:06:02 by djonker ######## odam.nl #
# # # #
# **************************************************************************** # # **************************************************************************** #
NAME =fract-ol NAME =cub3d
CC =gcc CC =gcc
FC =-Wall -Werror -Wextra -Wunreachable-code -Ofast #-fsanitize=address FC =-Wall -Werror -Wextra -Wunreachable-code -Ofast #-fsanitize=address
HEAD =-I ./include -I $(MLX)/include HEAD =-I ./include -I $(MLX)/include
RM =rm -rf RM =rm -rf
UNAME_S :=$(shell uname -s) UNAME_S :=$(shell uname -s)
ifeq ($(UNAME_S),Linux)
OS =Freedom Respecting Linux! :)
LIB =libft/libft.a mlx/build/libmlx42.a -ldl -lglfw -pthread -lm LIB =libft/libft.a mlx/build/libmlx42.a -ldl -lglfw -pthread -lm
else
OS =Proprietary Malware :(
LIB =libft/libft.a mlx/build/libmlx42.a -lglfw3 -framework Cocoa -framework OpenGL -framework IOKit
endif
SRC =src/main.c\ SRC =src/main.c\
src/colors.c\ src/colors.c\
src/zoommove.c\ src/zoommove.c\
@ -44,7 +38,7 @@ clean:
@printf "\e[1;35mCleaned Object Files\n\e[0;00m" @printf "\e[1;35mCleaned Object Files\n\e[0;00m"
fclean: clean fclean: clean
@$(RM) $(NAME) mlx/build @$(RM) $(NAME) mlx/build > /dev/null
@$(MAKE) -C libft fclean > /dev/null @$(MAKE) -C libft fclean > /dev/null
@printf "\e[1;31mCleaned Executables\n\e[0;00m" @printf "\e[1;31mCleaned Executables\n\e[0;00m"
@ -64,9 +58,7 @@ libft:
@$(MAKE) -C libft all @$(MAKE) -C libft all
libmlx: libmlx:
@cd mlx
@cmake -S mlx -B mlx/build @cmake -S mlx -B mlx/build
@$(MAKE) -C mlx/build -j4 @$(MAKE) -C mlx/build -j4
@cd ..
.PHONY: libft .PHONY: libft

96
cub3d.h Normal file
View File

@ -0,0 +1,96 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* fractol.h |o_o || | */
/* +:+ +:+ +:+ */
/* By: houtworm <codam@houtworm.net> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/11/29 03:25:46 by houtworm #+# #+# */
/* Updated: 2022/12/29 06:29:04 by djonker \___)=(___/ */
/* */
/* ************************************************************************** */
#ifndef FRACTOL_H
# define FRACTOL_H
# include <unistd.h>
# include <math.h>
# include "libft/libft.h"
# include "mlx/include/MLX42/MLX42.h"
typedef struct s_cnbr
{
long double re; //Real Number
long double im; //Imaginary Number
} t_cnbr;
typedef struct s_varlist
{
mlx_t *mlx; //mlx instance
mlx_image_t *img; //mlx img
mlx_image_t *font[30]; //mlx font image
int w; //actual window width used everywhere
int h; //actual window height used everywhere
int fontnbr; //number printed strings on the screen
char *fractal; //name of fractal used for title and info
int fractalid; //int id of the fractal to faster compare
char *cscheme; //name of current colorscheme to print
int cschemeid; //id of current colorscheme to compare
int cscale; //scale used to generate colorschemes
int cshi; //used for shifting colors by 1
int csha; //total amount of colors/shades
int32_t colors[1530]; //colorscheme colors
int iter; //number of iterations to do
long long calc; //Number of calculations per frame
long double xmax; //max number shown on the horizontal numberplane
long double ymax; //max number shown on the vertical numberplane
long double xmin; //min number shown on the horizontal numberplane
long double ymin; //min number shown on the vertical numberplane
long double xscale; //scale of visible numbers horizontal numberplane
long double yscale; //scale of visible numbers vertical numberplane
long double julre; //adjustable c value for x axis
long double julim; //adjustable c value for y axis
int xcur; //current x position of the mouse
int ycur; //current y position of the mouse
int psycho; //psycho mode toggle
int help; //help screen toggle
int info; //info screen toggle
int redraw; //if true then redraw
long double power; //for the mandelpower
} t_varlist;
typedef struct s_threads
{
t_varlist *vl;
int x;
int y;
} t_threads;
void mousehook(void *param);
void scrollhook(double xdelta, double ydelta, void *param);
void keyhook(mlx_key_data_t keydata, void *param);
void keyhookextra(void *param);
void keyhookmove(void *param);
void keyhookfractal(void *param);
void resizehook(int x, int y, void *param);
void setcolorscheme(t_varlist *vl);
void redrawimage(t_varlist *vl);
void resetfractal(t_varlist *vl);
void ft_error(int r);
void showinfo(t_varlist *vl);
void showhelp(t_varlist *vl);
void justmove(t_varlist *vl, char dir);
void zoomtomouse(t_varlist *vl);
void zoomfrommouse(t_varlist *vl);
void fractal(t_varlist *vl);
void mandelbrot(t_varlist *vl, int x, int y, t_cnbr c);
void mandelcloud(t_varlist *vl, int x, int y, t_cnbr c);
void mandelfeather(t_varlist *vl, int x, int y, t_cnbr c);
void julia(t_varlist *vl, int x, int y, t_cnbr z);
void mandelpower(t_varlist *vl, int x, int y, t_cnbr c);
void burningship(t_varlist *vl, int x, int y, t_cnbr c);
void tricorn(t_varlist *vl, int x, int y, t_cnbr c);
void rorschach(t_varlist *vl, int x, int y, t_cnbr c);
void powerflower(t_varlist *vl, int x, int y, t_cnbr c);
#endif