added more gif and start readme
24
README.md
@@ -1,13 +1,23 @@
|
|||||||
# FDF
|
# FDF - fil de fer
|
||||||
|
|
||||||
quick description
|
this program is written in C
|
||||||
|
|
||||||
- [subject here](./fdf_subject.pdf)
|
this is an exercize to discover 3D drawing, keyboard events, and pixel images manipulation
|
||||||
|
|
||||||

|
what it does is to read a map, which is a simple text file like this one :
|
||||||
|
|
||||||
### ressources
|
```
|
||||||
|
0 0 0 0 0
|
||||||
|
0 0 0 0 0
|
||||||
|
0 10 0 0 0
|
||||||
|
0 0 0 0 0
|
||||||
|
0 0 0 0 0
|
||||||
|
```
|
||||||
|
|
||||||
- minilibx : https://harm-smits.github.io/42docs/libs/minilibx
|
and it will convert it into a rectangular net, like a landscape with the height equal to the numbers :
|
||||||
- draw a line : https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm
|
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
if we modify the map it will modify the 3D drawing
|
||||||
|
|
||||||
|

|
||||||
|
|||||||
BIN
assets/fdf_demo.gif
Normal file
|
After Width: | Height: | Size: 823 KiB |
BIN
assets/fdf_demo_1.jpg
Normal file
|
After Width: | Height: | Size: 54 KiB |
BIN
assets/fdf_demo_2.jpg
Normal file
|
After Width: | Height: | Size: 54 KiB |
BIN
assets/fdf_loop_change_height_50.gif
Normal file
|
After Width: | Height: | Size: 3.0 MiB |
BIN
assets/fdf_loop_flying_tube.gif
Normal file
|
After Width: | Height: | Size: 1.3 MiB |
BIN
assets/fdf_loop_move_down_tube.gif
Normal file
|
After Width: | Height: | Size: 3.6 MiB |
BIN
assets/fdf_loop_move_left_tube.gif
Normal file
|
After Width: | Height: | Size: 3.5 MiB |
BIN
assets/fdf_loop_turn_down_pylone.gif
Normal file
|
After Width: | Height: | Size: 4.3 MiB |
BIN
assets/fdf_loop_turn_left_pyramide.gif
Normal file
|
After Width: | Height: | Size: 2.7 MiB |
BIN
assets/fdf_loop_zoom_element.gif
Normal file
|
After Width: | Height: | Size: 2.2 MiB |
BIN
assets/fdf_pylone.gif
Normal file
|
After Width: | Height: | Size: 3.1 MiB |
BIN
assets/fdf_pyramide.gif
Normal file
|
After Width: | Height: | Size: 4.2 MiB |
BIN
assets/fdf_t2.gif
Normal file
|
After Width: | Height: | Size: 14 MiB |
|
Before Width: | Height: | Size: 734 KiB |
@@ -84,26 +84,38 @@ int **parse_map(t_fdf *fdf, int fd);
|
|||||||
# define Z_HEIGHT_UP 10
|
# define Z_HEIGHT_UP 10
|
||||||
# define Z_HEIGHT_DOWN 10
|
# define Z_HEIGHT_DOWN 10
|
||||||
|
|
||||||
|
/*
|
||||||
|
- 50 : pink - blue
|
||||||
|
- elem : purple - green
|
||||||
|
- pylone : brown - purple
|
||||||
|
- pyramide : white - pink
|
||||||
|
- semitube : green - pink
|
||||||
|
- t2 : white - green
|
||||||
|
- test : white - pink
|
||||||
|
*/
|
||||||
// color for altitude
|
// color for altitude
|
||||||
# define COLOR_START 0xffffff // white
|
# define COLOR_START 0xa263f6 // purple
|
||||||
/*
|
/*
|
||||||
# define COLOR_START 0xf263a6 // pink
|
# define COLOR_START 0xf263a6 // pink
|
||||||
# define COLOR_START 0x00d700 // green
|
# define COLOR_START 0xffffff // white
|
||||||
# define COLOR_START 0x877264 // brown
|
|
||||||
# define COLOR_START 0x1423e6 // blue
|
# define COLOR_START 0x1423e6 // blue
|
||||||
# define COLOR_START 0xa263f6 // purple
|
# define COLOR_START 0x877264 // brown
|
||||||
|
# define COLOR_START 0x00d700 // green
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
# define COLOR_END 0xffffff // white
|
|
||||||
# define COLOR_END 0x00d700 // green
|
|
||||||
# define COLOR_END 0x877264 // brown
|
# define COLOR_END 0x877264 // brown
|
||||||
# define COLOR_END 0x1423e6 // blue
|
# define COLOR_END 0x00d700 // green
|
||||||
# define COLOR_END 0xa263f6 // purple
|
# define COLOR_END 0xa263f6 // purple
|
||||||
*/
|
# define COLOR_END 0x1423e6 // blue
|
||||||
# define COLOR_END 0xf263a6 // pink
|
# define COLOR_END 0xf263a6 // pink
|
||||||
|
*/
|
||||||
|
# define COLOR_END 0xffffff // white
|
||||||
|
|
||||||
|
// pixels deplacement for each keypress
|
||||||
|
# define MOVE 10
|
||||||
|
|
||||||
// minimum time in milliseconds between two keypress
|
// minimum time in milliseconds between two keypress
|
||||||
# define DEBOUNCE_TIME 1
|
# define DEBOUNCE_TIME 10
|
||||||
|
|
||||||
# define ESCAPE 65307
|
# define ESCAPE 65307
|
||||||
# define UP 65362
|
# define UP 65362
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
0 0 0 0 0 0 0 0 0 0
|
0 0 0 0 0 0 0 0 0 0
|
||||||
0 10 10 10 10 10 10 10 10 0
|
0 8 8 10 10 10 10 10 10 0
|
||||||
0 10 20 15 12 15 17 20 10 0
|
0 8 10 10 12 15 17 20 10 0
|
||||||
0 10 15 10 12 15 15 15 10 0
|
0 8 10 10 12 15 15 15 10 0
|
||||||
0 5 15 10 12 15 15 13 10 0
|
0 5 10 10 12 15 15 13 10 0
|
||||||
0 5 10 5 7 12 12 12 10 0
|
0 5 8 5 7 12 12 12 10 0
|
||||||
0 5 7 1 2 7 5 5 7 0
|
0 5 7 1 2 7 5 5 7 0
|
||||||
0 3 0 0 1 2 2 2 5 0
|
0 3 0 0 1 2 2 2 5 0
|
||||||
0 1 0 0 0 0 0 0 3 0
|
0 1 0 0 0 0 0 0 3 0
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
0 0 0 0 0 0
|
0 0 0 0 0
|
||||||
0 7 7 7 0 0
|
0 0 0 0 0
|
||||||
0 7 9 7 0 0
|
0 10 0 0 0
|
||||||
0 7 7 7 0 0
|
0 0 0 0 0
|
||||||
0 0 0 0 0 0
|
0 0 0 0 0
|
||||||
|
|||||||
10
notes.md
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# FDF
|
||||||
|
|
||||||
|
- [subject here](./fdf_subject.pdf)
|
||||||
|
|
||||||
|
### ressources
|
||||||
|
|
||||||
|
- minilibx : https://harm-smits.github.io/42docs/libs/minilibx
|
||||||
|
- draw a line : https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm
|
||||||
|
|
||||||
|
|
||||||
@@ -89,13 +89,13 @@ int keypress(int keycode, t_fdf *fdf)
|
|||||||
else if (keycode == DOWN)
|
else if (keycode == DOWN)
|
||||||
fdf->rot_y -= 1;
|
fdf->rot_y -= 1;
|
||||||
else if (keycode == Q)
|
else if (keycode == Q)
|
||||||
fdf->mov_x -= 6;
|
fdf->mov_x -= MOVE;
|
||||||
else if (keycode == D)
|
else if (keycode == D)
|
||||||
fdf->mov_x += 6;
|
fdf->mov_x += MOVE;
|
||||||
else if (keycode == Z)
|
else if (keycode == Z)
|
||||||
fdf->mov_y -= 6;
|
fdf->mov_y -= MOVE;
|
||||||
else if (keycode == S)
|
else if (keycode == S)
|
||||||
fdf->mov_y += 6;
|
fdf->mov_y += MOVE;
|
||||||
else
|
else
|
||||||
keypress_more(keycode, fdf);
|
keypress_more(keycode, fdf);
|
||||||
draw_image(fdf);
|
draw_image(fdf);
|
||||||
|
|||||||