Skip to content

Commit b0c01db

Browse files
committed
fix: minor changes and norminette
1 parent 0a1f6b4 commit b0c01db

File tree

6 files changed

+29
-30
lines changed

6 files changed

+29
-30
lines changed

src/main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/* By: ebabaogl <[email protected] +#+ +:+ +#+ */
77
/* +#+#+#+#+#+ +#+ */
88
/* Created: 2025/01/12 19:39:45 by ebabaogl #+# #+# */
9-
/* Updated: 2025/01/13 16:43:45 by ebabaogl ### ########.fr */
9+
/* Updated: 2025/01/13 22:21:44 by ebabaogl ### ########.fr */
1010
/* */
1111
/* ************************************************************************** */
1212

src/render/init_renderer.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/* By: ebabaogl <[email protected] +#+ +:+ +#+ */
77
/* +#+#+#+#+#+ +#+ */
88
/* Created: 2025/01/13 16:39:50 by ebabaogl #+# #+# */
9-
/* Updated: 2025/01/13 16:40:47 by ebabaogl ### ########.fr */
9+
/* Updated: 2025/01/13 22:32:51 by ebabaogl ### ########.fr */
1010
/* */
1111
/* ************************************************************************** */
1212

@@ -16,4 +16,4 @@ void init_renderer(t_vars *vars)
1616
{
1717
set_camera_props(vars);
1818
render_map(vars);
19-
}
19+
}

src/render/render_map.c

+7-8
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
/* By: ebabaogl <[email protected] +#+ +:+ +#+ */
77
/* +#+#+#+#+#+ +#+ */
88
/* Created: 2025/01/13 15:56:40 by ebabaogl #+# #+# */
9-
/* Updated: 2025/01/13 20:16:30 by ebabaogl ### ########.fr */
9+
/* Updated: 2025/01/13 22:33:41 by ebabaogl ### ########.fr */
1010
/* */
1111
/* ************************************************************************** */
1212

1313
#include "fdf.h"
1414
#include "mlx.h"
1515
#include <limits.h>
1616

17-
static void put_pixel(t_vars *vars, int x, int y, unsigned long color)
17+
static void put_pixel(t_vars *vars, int x, int y, unsigned long color)
1818
{
1919
int i;
2020

@@ -31,12 +31,12 @@ static void put_pixel(t_vars *vars, int x, int y, unsigned long color)
3131
}
3232
}
3333

34-
static void draw_line(t_vars *vars, t_point p1, t_point p2, unsigned long color)
34+
static void draw_line(t_vars *vars, t_point p1, t_point p2, unsigned long color)
3535
{
36-
double x0;
37-
double y0;
38-
int steps;
39-
int i;
36+
double x0;
37+
double y0;
38+
int steps;
39+
int i;
4040

4141
x0 = p1.x;
4242
y0 = p1.y;
@@ -94,4 +94,3 @@ void render_map(t_vars *vars)
9494
mlx_put_image_to_window(vars->mlx->mlx_ptr, vars->mlx->win_ptr,
9595
vars->mlx->img_ptr, 0, 0);
9696
}
97-

src/render/render_utils.c

+12-2
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,22 @@
66
/* By: ebabaogl <[email protected] +#+ +:+ +#+ */
77
/* +#+#+#+#+#+ +#+ */
88
/* Created: 2025/01/13 16:15:19 by ebabaogl #+# #+# */
9-
/* Updated: 2025/01/13 20:21:28 by ebabaogl ### ########.fr */
9+
/* Updated: 2025/01/13 22:33:29 by ebabaogl ### ########.fr */
1010
/* */
1111
/* ************************************************************************** */
1212

1313
#include "fdf.h"
1414

15+
unsigned long get_z(unsigned long point)
16+
{
17+
return (point >> 32);
18+
}
19+
20+
unsigned long get_color(unsigned long point)
21+
{
22+
return (point & COLOR_MASK);
23+
}
24+
1525
void set_camera_props(t_vars *vars)
1626
{
1727
double width_distance;
@@ -49,4 +59,4 @@ void render_point(t_vars *vars, t_point *point)
4959
rotate_z_x(vars, point);
5060
translate(vars, point);
5161
zoom(vars, point);
52-
}
62+
}

src/utils.c

+1-11
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/* By: ebabaogl <[email protected] +#+ +:+ +#+ */
77
/* +#+#+#+#+#+ +#+ */
88
/* Created: 2025/01/13 00:10:17 by ebabaogl #+# #+# */
9-
/* Updated: 2025/01/13 16:28:33 by ebabaogl ### ########.fr */
9+
/* Updated: 2025/01/13 22:33:12 by ebabaogl ### ########.fr */
1010
/* */
1111
/* ************************************************************************** */
1212

@@ -61,16 +61,6 @@ void free_str_arr(char **arr)
6161
free(arr);
6262
}
6363

64-
unsigned long get_z(unsigned long point)
65-
{
66-
return (point >> 32);
67-
}
68-
69-
unsigned long get_color(unsigned long point)
70-
{
71-
return (point & COLOR_MASK);
72-
}
73-
7464
int abs(int n)
7565
{
7666
if (n < 0)

src/window/init_win.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/* By: ebabaogl <[email protected] +#+ +:+ +#+ */
77
/* +#+#+#+#+#+ +#+ */
88
/* Created: 2025/01/13 10:39:33 by ebabaogl #+# #+# */
9-
/* Updated: 2025/01/13 16:50:12 by ebabaogl ### ########.fr */
9+
/* Updated: 2025/01/13 22:28:58 by ebabaogl ### ########.fr */
1010
/* */
1111
/* ************************************************************************** */
1212

@@ -56,17 +56,17 @@ int init_win(t_vars *vars)
5656
t_mlx mlx;
5757

5858
vars->mlx = &mlx;
59-
mlx.img_ptr = NULL;
60-
mlx.win_ptr = NULL;
6159
mlx.mlx_ptr = NULL;
60+
mlx.win_ptr = NULL;
61+
mlx.img_ptr = NULL;
6262
if (set_win_props(vars->mlx) == -1)
6363
return (-1);
6464
if (set_img_props(vars->mlx) == -1)
6565
return (-1);
66-
mlx_hook(mlx.win_ptr, DestroyNotify, 0, destroy_handler, vars->mlx);
67-
mlx_key_hook(mlx.win_ptr, key_handler, vars->mlx);
66+
mlx_hook(mlx.win_ptr, DestroyNotify, 0, destroy_handler, &mlx);
67+
mlx_key_hook(mlx.win_ptr, key_handler, &mlx);
6868
init_renderer(vars);
6969
mlx_loop(mlx.mlx_ptr);
70-
destroy_win(vars->mlx);
70+
destroy_win(&mlx);
7171
return (0);
7272
}

0 commit comments

Comments
 (0)