Skip to content

Commit 653ee3f

Browse files
committed
fix norminette errors after update, get rid of headers just included for macros (norminette)
1 parent 1e2650c commit 653ee3f

File tree

5 files changed

+25
-20
lines changed

5 files changed

+25
-20
lines changed

include/main.h

+7-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/* By: aschenk <[email protected]> +#+ +:+ +#+ */
77
/* +#+#+#+#+#+ +#+ */
88
/* Created: 2024/11/06 18:13:07 by aschenk #+# #+# */
9-
/* Updated: 2025/02/23 18:34:59 by aschenk ### ########.fr */
9+
/* Updated: 2025/02/26 15:51:12 by aschenk ### ########.fr */
1010
/* */
1111
/* ************************************************************************** */
1212

@@ -27,10 +27,6 @@ and declaring all function prototypes.
2727
# include <math.h> // for math functions, expr, e.g. sqrt(), INFINITY
2828
# include <fcntl.h> // for open() macros
2929

30-
// X11 library headers
31-
# include <X11/keysym.h> // Macros for key symbols, e.g. XK_Escape
32-
# include <X11/X.h> // Macros for event names, e.g. DestroyNotify
33-
3430
// Custom headers
3531
# include "libft.h" // libft
3632
# include "mlx.h" // mlx
@@ -43,6 +39,12 @@ and declaring all function prototypes.
4339
//#############
4440

4541
# define WINDOW_TITLE "miniRT by Natalie Holbrook & Alex Schenk @42Berlin"
42+
43+
// To avoid including headers solely for macros (norminette):
44+
// <X11/keysym.h> and <X11/X.h>
45+
# define XK_ESCAPE 0xff1b // Key code for the 'Esc' key
46+
# define DESTROY_NOTIFY 17 // Event code for window destruction
47+
4648
# define BG_COLOR 0x303030 // Anthracite (dark grey)
4749
# define EPSILON 1e-3 // Small value to avoid floating-point errors
4850
# define K_DIFFUSE 0.7 // Diffuse intensity factor [0.0, 1.0]

include/main_bonus.h

+7-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/* By: aschenk <[email protected]> +#+ +:+ +#+ */
77
/* +#+#+#+#+#+ +#+ */
88
/* Created: 2024/11/06 18:13:07 by aschenk #+# #+# */
9-
/* Updated: 2025/02/23 18:35:10 by aschenk ### ########.fr */
9+
/* Updated: 2025/02/26 15:51:15 by aschenk ### ########.fr */
1010
/* */
1111
/* ************************************************************************** */
1212

@@ -27,10 +27,6 @@ and declaring all function prototypes.
2727
# include <math.h> // for math functions, expr, e.g. sqrt(), INFINITY
2828
# include <fcntl.h> // for open() macros
2929

30-
// X11 library headers
31-
# include <X11/keysym.h> // Macros for key symbols, e.g. XK_Escape
32-
# include <X11/X.h> // Macros for event names, e.g. DestroyNotify
33-
3430
// Custom headers
3531
# include "libft.h" // libft
3632
# include "mlx.h" // mlx
@@ -43,6 +39,12 @@ and declaring all function prototypes.
4339
//#############
4440

4541
# define WINDOW_TITLE "miniRT by Natalie Holbrook & Alex Schenk @42Berlin"
42+
43+
// To avoid including headers solely for macros (norminette):
44+
// <X11/keysym.h> and <X11/X.h>
45+
# define XK_ESCAPE 0xff1b // Key code for the 'Esc' key
46+
# define DESTROY_NOTIFY 17 // Event code for window destruction
47+
4648
# define BG_COLOR 0x303030 // Anthracite (dark grey)
4749
# define EPSILON 1e-3 // Small value to avoid floating-point errors
4850
# define K_DIFFUSE 0.7 // Diffuse intensity factor [0.0, 1.0]

include/parsing.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
/* ::: :::::::: */
44
/* parsing.h :+: :+: :+: */
55
/* +:+ +:+ +:+ */
6-
/* By: nholbroo <nholbroo@student.42.fr> +#+ +:+ +#+ */
6+
/* By: aschenk <aschenk@student.42berlin.de> +#+ +:+ +#+ */
77
/* +#+#+#+#+#+ +#+ */
88
/* Created: 2024/11/19 16:58:53 by nholbroo #+# #+# */
9-
/* Updated: 2025/02/24 15:07:53 by nholbroo ### ########.fr */
9+
/* Updated: 2025/02/26 15:47:23 by aschenk ### ########.fr */
1010
/* */
1111
/* ************************************************************************** */
1212

@@ -34,7 +34,7 @@
3434
C -50.0,0,20 0,0,1 70
3535
∗ identifier: C
3636
∗ x,y,z coordinates of the view point: -50.0,0,20
37-
∗ 3d normalized orientation vector. In range [-1,1] for each x,y,z axis:
37+
∗ 3d normalized orientation vector. In range [-1,1] for each axis:
3838
0.0,0.0,1.0
3939
∗ FOV : Horizontal field of view in degrees in range [0,180]: 70
4040
Light:
@@ -66,8 +66,8 @@
6666
∗ the sphere diameter: 12.6
6767
∗ R,G,B colors in range [0-255]: 10, 0, 255
6868
69-
The program will show a descriptive error message and exit with an error code,
70-
depending on what the issue was.
69+
The program will show a descriptive error message and exit with an error
70+
code, depending on what the issue was.
7171
7272
The main structure of the parsing is as follows:
7373
1. Checks file related errors -- like file permissions, existence etc.

include/types.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/* By: aschenk <[email protected]> +#+ +:+ +#+ */
77
/* +#+#+#+#+#+ +#+ */
88
/* Created: 2024/11/12 15:55:37 by aschenk #+# #+# */
9-
/* Updated: 2025/02/25 19:08:11 by aschenk ### ########.fr */
9+
/* Updated: 2025/02/26 15:46:40 by aschenk ### ########.fr */
1010
/* */
1111
/* ************************************************************************** */
1212

@@ -375,7 +375,7 @@ typedef struct s_scene
375375
/**
376376
Data structure holding all raytracing-related data.
377377
- t_mlx `mlx`: Struct with rendering context containing MiniLibX components.
378-
- t_scene `scene`: Struct with scene data, including objects, lights, and camera.
378+
- t_scene `scene`: Struct with scene data, including objects, lights, and cam.
379379
*/
380380
typedef struct s_rt
381381
{

src/2_event_handling.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/* By: aschenk <[email protected]> +#+ +:+ +#+ */
77
/* +#+#+#+#+#+ +#+ */
88
/* Created: 2024/11/13 17:24:44 by aschenk #+# #+# */
9-
/* Updated: 2025/02/18 22:44:13 by aschenk ### ########.fr */
9+
/* Updated: 2025/02/26 15:49:19 by aschenk ### ########.fr */
1010
/* */
1111
/* ************************************************************************** */
1212

@@ -32,7 +32,7 @@ Handles key press events:
3232
*/
3333
static int handle_keypress(int keycode, t_rt *rt)
3434
{
35-
if (keycode == XK_Escape)
35+
if (keycode == XK_ESCAPE)
3636
{
3737
cleanup(&rt);
3838
exit(EXIT_SUCCESS);
@@ -67,6 +67,7 @@ program is terminated.
6767
void start_event_loop(t_rt *rt)
6868
{
6969
(void)mlx_key_hook(rt->mlx.win_ptr, &handle_keypress, rt);
70-
(void)mlx_hook(rt->mlx.win_ptr, DestroyNotify, 0, &handle_window_close, rt);
70+
(void)mlx_hook(rt->mlx.win_ptr, DESTROY_NOTIFY, 0, &handle_window_close,
71+
rt);
7172
(void)mlx_loop(rt->mlx.mlx_ptr);
7273
}

0 commit comments

Comments
 (0)