fractol/fractol.h
2023-03-01 04:36:42 +01:00

97 lines
4.0 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* 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