feat: Added the round counter on the hud

This commit is contained in:
Theo Champion 2025-09-03 18:39:30 +02:00
parent 82d7941e81
commit f80eb125f5
24 changed files with 1217 additions and 115 deletions

View file

@ -9,6 +9,7 @@ endif
IFLAGS = -I./mlx -I./libft IFLAGS = -I./mlx -I./libft
SOURCEFILES = \ SOURCEFILES = \
src/hud/load_texture.c \
src/utils/inits.c \ src/utils/inits.c \
src/utils/time.c \ src/utils/time.c \
src/utils/destroy_utils.c \ src/utils/destroy_utils.c \

BIN
ressources/Mastodonte.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View file

@ -1,86 +1,89 @@
/* XPM */ /* XPM */
static char * juggernog_xpm[] = { static char *juggernog[] = {
/* columns rows colors chars-per-pixel */
"64 64 19 1 ", "64 64 19 1 ",
" c #FF00DC", " c black",
". c #000001", ". c #000001",
"+ c #E4E4E4", "X c #6A6A69",
"@ c #D53737", "o c #727271",
"# c #FDECB3", "O c #9A2B2B",
"$ c #FF0000", "+ c #A93030",
"% c #FFFFFF", "@ c #C70000",
"& c #FADF84", "# c #CE1C1C",
"* c #C2C2C2", "$ c red",
"= c #903030", "% c #996262",
"- c #782A2A", "& c #FF00DC",
"; c #B12A2A", "* c #838381",
"> c #A7A7A7", "= c #8C8C8A",
", c #E9E9E9", "- c #929292",
"' c #817F7F", "; c #A7A7A7",
") c #8E2323", ": c #CECECE",
"! c #C1C1C1", "> c #ECE8D8",
"~ c #686666", ", c gray96",
"{ c #FF5400", "< c white",
" ....... ", /* pixels */
" ...+++++... ", "&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&....&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&",
" ..+++++++++.. ", "&&&&&&&&&&&&&&&&&&&&&&&&&&&&...>>...&&&&&&&&&&&&&&&&&&&&&&&&&&&&",
" ..@@@@@@@@@@@.. ", "&&&&&&&&&&&&&&&&&&&&&&&&&&&..++++++..&&&&&&&&&&&&&&&&&&&&&&&&&&&",
" ..@@@@#####@$$@.. ", "&&&&&&&&&&&&&&&&&&&&&&&&&&&.+++<<+++.&&&&&&&&&&&&&&&&&&&&&&&&&&&",
" .+@@@@#####$$$@%. ", "&&&&&&&&&&&&&&&&&&&&&&&&&&..+++<<+++..&&&&&&&&&&&&&&&&&&&&&&&&&&",
" ..+@@@@####&&$@@+.. ", "&&&&&&&&&&&&&&&&&&&&&&&&&&.>+<<<<<<+>.&&&&&&&&&&&&&&&&&&&&&&&&&&",
" .++@######$$&##@++. ", "&&&&&&&&&&&&&&&&&&&&&&&&&&.>+<<<<<<+>.&&&&&&&&&&&&&&&&&&&&&&&&&&",
" .++@#####$$$###@++. ", "&&&&&&&&&&&&&&&&&&&&&&&&&&..+++<<+++..&&&&&&&&&&&&&&&&&&&&&&&&&&",
" .++@####$$$####@++. ", "&&&&&&&&&&&&&&&&&&&&&&&&&&&.>++<<++>.&&&&&&&&&&&&&&&&&&&&&&&&&&&",
" .++@###$$$#####@++. ", "&&&&&&&&&&&&&&&&&&&&&&&&&&&..>++++>..&&&&&&&&&&&&&&&&&&&&&&&&&&&",
" .++@##$$$######@++. ", "&&&&&&&&&&&&&&&&&&&&&&&&&&&&...++...&&&&&&&&&&&&&&&&&&&&&&&&&&&&",
" ..+@@$$$####@@@@+.. ", "&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&....&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&",
" .++@@$#####@@@++. ", "&&&&&&&&&&&&&&&&&&&..........................&&&&&&&&&&&&&&&&&&&",
" ..++@@#####@@++.. ", "&&&&&&&&&&&&&&&&&&..,,,,,,,,,,,,,,,,,,,,,,,,..&&&&&&&&&&&&&&&&&&",
" ..++@@@@@@@++.. ", "&&&&&&&&&&&&&&&&&..,,,,,,,,,,,,,,,,,,,,,,,,,,..&&&&&&&&&&&&&&&&&",
" ..++@@@@@++.. ", "&&&&&&&&&&&&&&&&&.,,,,,,,,,,,,,,,,,,,,,,,,,,,,.&&&&&&&&&&&&&&&&&",
" ...+@@@+... ", "&&&&&&&&&&&&&&&&&.,,,$,$,$,$$$,,$$$,,$$$,$$$,,.&&&&&&&&&&&&&&&&&",
" ....... ", "&&&&&&&&&&&&&&&&&.,,,$,$,$,$,,,,$,,,,$,,,$,$,,.&&&&&&&&&&&&&&&&&",
" .......................... ", "&&&&&&&&&&&&&&&&&.,,,$,$,$,$,$$,$,$$,$$,,$$$,,.&&&&&&&&&&&&&&&&&",
" ..************************.. ", "&&&&&&&&&&&&&&&&&.,$,$,$,$,$,,$,$,,$,$,,,$$,,,.&&&&&&&&&&&&&&&&&",
" ..**=*=*=*===**===**===*===*.. ", "&&&&&&&&&&&&&&&&&.,$$$,$$$,$$$$,$$$$,$$$,$,$,,.&&&&&&&&&&&&&&&&&",
" ..***=*=*=*=****=****=***=*=**.. ", "&&&&&&&&&&&&&&&&&.,,,,,,,,,,,,,,,,,,,,,,,,,,,,.&&&&&&&&&&&&&&&&&",
" .****=*=*=*=*==*=*==*==**===***. ", "&&&&&&&&&&&&&&&&&.,,,,,,,$,,$,$$$,$$$,,,,,,,,,.&&&&&&&&&&&&&&&&&",
" .**=*=*=*=*=**=*=**=*=***==****. ", "&&&&&&&&&&&&&&&&&.,,,,,,,$$,$,$,$,$,,,,,,,,,,,.&&&&&&&&&&&&&&&&&",
" .**===*===*====*====*===*=*=***. ", "&&&&&&&&&&&&&&&&&.,,,,,,,$,$$,$,$,$,$$,,,,,,,,.&&&&&&&&&&&&&&&&&",
" .******************************. ", "&&&&&&&&&&&&&&&&&.,,,,,,,$,,$,$,$,$,,$,,,,,,,,.&&&&&&&&&&&&&&&&&",
" .*******=***=*====*===*********. ", "&&&&&&&&&&&&&&&&&.,,,,,,,$,,$,$$$,$$$$,,,,,,,,.&&&&&&&&&&&&&&&&&",
" .*******==**=*=**=*=***********. ", "&&&&&&&&&&&&&&&&&.,,,,,,,,,,,,,,,,,,,,,,,,,,,,.&&&&&&&&&&&&&&&&&",
" .*******=*=*=*=**=*=*==********. ", "&&&&&&&&&&&&&&&&&.,,OOOOO,,,,,,,,,,,,,,,,,,,,,.&&&&&&&&&&&&&&&&&",
" .*******=**==*=**=*=**=********. ", "&&&&&&&&&&&&&&&&&.,O:O::OO,,,,,,,,,,,,,,,,,,,,.&&&&&&&&&&&&&&&&&",
" .*******=***=*====*====********. ", "&&&&&&&&&&&&&&&&&.,::O::OO,,,,,,,,@@,@@,@,,@,,.&&&&&&&&&&&&&&&&&",
" .******************************. ", "&&&&&&&&&&&&&&&&&.,O:O::O::,,,,,,@,,,@@,@,,@@,.&&&&&&&&&&&&&&&&&",
" .*-*--*--**********************. ", "&&&&&&&&&&&&&&&&&.,O:O::O:,,,,,,,@,,,@@,@,,@@,.&&&&&&&&&&&&&&&&&",
" .--*--*-***********************. ", "&&&&&&&&&&&&&&&&&.,OOOOOO::,,,,,,,@@,@@,@@,@,,.&&&&&&&&&&&&&&&&&",
" .*-*--*--**********************. ", "&&&&&&&&&&&&&&&&&.,,OOOOO,,,,,,,,,,,,,,,,,,,,,.&&&&&&&&&&&&&&&&&",
" .*-*--***;;;;;;;;;;;;;*********. ", "&&&&&&&&&&&&&&&&&.,,,,,,,,############,,,,,,,,.&&&&&&&&&&&&&&&&&",
" .*******;>>>>>>>>>>>>>;********. ", "&&&&&&&&&&&&&&&&&.oooooooo#;;;;;;;;;;#oooooooo.&&&&&&&&&&&&&&&&&",
" .,,,,,,,;''''''''''''';,,,,,,,,. ", "&&&&&&&&&&&&&&&&&.OO----O#************#OOOOOOO.&&&&&&&&&&&&&&&&&",
" .)))))));''''''''''''';)))))))). ", "&&&&&&&&&&&&&&&&&.O-----O#************#OOOOOOO.&&&&&&&&&&&&&&&&&",
" .)!!))));>>>>>>>>>>>>>;)))))))). ", "&&&&&&&&&&&&&&&&&.---OOOO#;;;;;;;;;;;;#OOOOOOO.&&&&&&&&&&&&&&&&&",
" .!))))));;..~~..~~~.~;;)))))))). ", "&&&&&&&&&&&&&&&&&.OOOOOOO#************#OOOOOOO.&&&&&&&&&&&&&&&&&",
" .)))))));;~~~~..~~~.~;;)))))))). ", "&&&&&&&&&&&&&&&&&.OOOOOOO##############OOOOO--.&&&&&&&&&&&&&&&&&",
" .)))))));;...........;;)))))))!. ", "&&&&&&&&&&&&&&&&&.OOOOOOO######==######OOOO---.&&&&&&&&&&&&&&&&&",
" .!))))));;;;;;;;;;;;;;;))))))!). ", "&&&&&&&&&&&&&&&&&.OOOOOOO######==######OOOO---.&&&&&&&&&&&&&&&&&",
" .)))))));;;;;;;;;;;;;;;)))))))). ", "&&&&&&&&&&&&&&&&&.OOOOOOO##....==....##OOO----.&&&&&&&&&&&&&&&&&",
" .))))))!;;;;;;;';;;;;;;!)))))!). ", "&&&&&&&&&&&&&&&&&.OOOOOOO##.###==###.##OOO----.&&&&&&&&&&&&&&&&&",
" .)))))));;;;;;;';;;;;;;)))))))). ", "&&&&&&&&&&&&&&&&&.OOOOOOO##..........##OO-----.&&&&&&&&&&&&&&&&&",
" .)))))));;;;...'...;;;;)!)))))). ", "&&&&&&&&&&&&&&&&&.OOOOOOO##############OO----O.&&&&&&&&&&&&&&&&&",
" .)))))!);;;;.;;;;;.;;;;)!)))))). ", "&&&&&&&&&&&&&&&&&.OOOOOOO##############OOO--OO.&&&&&&&&&&&&&&&&&",
" .))))!));;;;.......;;;;)!)))))). ", "&&&&&&&&&&&&&&&&&.OOOOOOO##########==##OOOOOOO.&&&&&&&&&&&&&&&&&",
" .))))!));;;;;;;;;;;;;;;)!)))))). ", "&&&&&&&&&&&&&&&&&.OOOOOOO##########==##OOOOOOO.&&&&&&&&&&&&&&&&&",
" .)))))));;~~~~;;;;;...;)!)))))). ", "&&&&&&&&&&&&&&&&&.-OOOOOO##############OOOOOOO.&&&&&&&&&&&&&&&&&",
" .)))))));;~{{~;;;;;.;.;!))))))). ", "&&&&&&&&&&&&&&&&&.-OOOOOO##############OOOOOOO.&&&&&&&&&&&&&&&&&",
" .)))))));;~{{~;;;;;...;)))))))). ", "&&&&&&&&&&&&&&&&&.--OOOOO#####====#####OOOOOOO.&&&&&&&&&&&&&&&&&",
" .)))))));;~{{~;;;;;;;;;))))!))). ", "&&&&&&&&&&&&&&&&&.---OOOO#####=XX=#####OOOOOOO.&&&&&&&&&&&&&&&&&",
" .))))!));;~~~~;;;;;;;;;)!!!)))). ", "&&&&&&&&&&&&&&&&&.OO-OOOO#####=XX=#####OOOOOOO.&&&&&&&&&&&&&&&&&",
" .!!!!))));;;;;;;;;;;;;))))))))). ", "&&&&&&&&&&&&&&&&&.OO--OOO#####====#####OOOOOOO.&&&&&&&&&&&&&&&&&",
" .))!)))))))))))))))))!))))))))). ", "&&&&&&&&&&&&&&&&&.OOO%OOOO############OOOOOOOO.&&&&&&&&&&&&&&&&&",
" .)!!)))))))))))))))))!))))))))). ", "&&&&&&&&&&&&&&&&&.OOOOOOOOO--OOOOOOOOOOOOOOOOO.&&&&&&&&&&&&&&&&&",
" ..!))))))!!))))))))))))))))))).. ", "&&&&&&&&&&&&&&&&&.OOOOOOOO--OOOOOOOOOOOOOOOOOO.&&&&&&&&&&&&&&&&&",
" ..)))))!!)!))))))))))))))))).. ", "&&&&&&&&&&&&&&&&&.OOOOOOO---OOOOOOOOOOOOO---OO.&&&&&&&&&&&&&&&&&",
" ..)))!)))!)))))))))))))))).. ", "&&&&&&&&&&&&&&&&&..OOOOOO-O----OOOOOOOOO-----..&&&&&&&&&&&&&&&&&",
" .......................... "}; "&&&&&&&&&&&&&&&&&&..OOOOOOOO---OOOOOOOOO-OOO..&&&&&&&&&&&&&&&&&&",
"&&&&&&&&&&&&&&&&&&&..........................&&&&&&&&&&&&&&&&&&&"
};

View file

@ -0,0 +1,65 @@
/* XPM */
static char * round_eight_xpm[] = {
"60 60 2 1",
" c #FF00DC",
". c #EB0000",
" ",
" ",
" ",
" ",
" ........ ",
" .......... ",
" ............ ",
" ............... ",
" ................. ",
" ................... ",
" .................... ",
" .............. ....... ",
" ............... ....... ",
" ............. ....... ",
" ........... ....... ",
" ........... ....... ",
" ........ ....... ",
" ........ ....... ",
" ....... ....... ",
" ....... ....... ",
" ....... ........ ",
" ....... ......... ",
" ....... ........ ",
" ........ ........ ",
" ........... ........ ",
" ............... ....... ",
" ...................... ",
" ..................... ",
" ...................... ",
" ...................... ",
" ................... ",
" ................... ",
" ...................... ",
" ........................ ",
" ............. ........... ",
" ........... ......... ",
" ........... ......... ",
" ........ ......... ",
" ......... ........ ",
" ........ ....... ",
" ........ ....... ",
" ....... ....... ",
" ....... ....... ",
" ....... ....... ",
" ....... ........ ",
" ....... ........ ",
" ....... ....... ",
" ....... ....... ",
" ........ ....... ",
" ......... ........ ",
" .......... ......... ",
" .......... ........... ",
" ........................... ",
" ........................... ",
" ........................ ",
" ....................... ",
" ................... ",
" ................ ",
" ........... ",
" "};

65
ressources/round_five.xpm Normal file
View file

@ -0,0 +1,65 @@
/* XPM */
static char * round_five_xpm[] = {
"60 60 2 1",
" c #FF00DC",
". c #EB0000",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ..... ",
" ............. ",
" ................. ",
" ........................ ",
" ......................... ",
" ......................... ",
" ........................ ",
" ........................ ",
" ....... ............ ",
" ....... ......... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ......... ",
" .................... ",
" ....................... ",
" ........................ ",
" ........................ ",
" ......................... ",
" .......................... ",
" ......... ........... ",
" ...... ......... ",
" ..... ......... ",
" ......... ",
" ........ ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ........ ",
" ......... ",
" ..... ........... ",
" ..................... ",
" ..................... ",
" ................... ",
" ................... ",
" ................ ",
" ............... ",
" ........ ",
" ..... "};

65
ressources/round_four.xpm Normal file
View file

@ -0,0 +1,65 @@
/* XPM */
static char * round_four_xpm[] = {
"60 60 2 1",
" c #FF00DC",
". c #EB0000",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ..... ",
" ....... ",
" ........ ",
" ......... ",
" ............ ",
" ............. ",
" ............. ",
" .............. ",
" ............... ",
" ................ ",
" ................. ",
" ......... ....... ",
" .......... ....... ",
" ........... ....... ",
" ......... ....... ",
" .......... ....... ",
" ......... ....... ",
" ........ ....... ",
" ......... ....... ",
" ......... ....... ",
" ........ ....... ",
" ......... ....... ",
" ......... ....... ",
" ......... ............... ",
" ................................... ",
" ................................... ",
" ................................... ",
" ................................... ",
" .................................. ",
" .................................. ",
" .................... ....... ",
" ......... ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ...... ",
" ..... ",
" ",
" ",
" ",
" ",
" ",
" "};

65
ressources/round_nine.xpm Normal file
View file

@ -0,0 +1,65 @@
/* XPM */
static char * round_nine_xpm[] = {
"60 60 2 1",
" c #FF00DC",
". c #EB0000",
" ",
" ",
" ",
" ",
" ",
" ........ ",
" ............ ",
" ............. ",
" .................. ",
" .................... ",
" .................... ",
" ...................... ",
" ........... ........... ",
" ........... ......... ",
" ........ ......... ",
" ........ .......... ",
" ....... .......... ",
" ....... ......... ",
" ....... ......... ",
" ....... ........ ",
" ......... ........ ",
" .......... ....... ",
" ............ ........ ",
" ............... ........ ",
" ........................ ",
" ...................... ",
" ...................... ",
" .................... ",
" ................... ",
" ................. ",
" .............. ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ........ ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ........ ",
" ......... ",
" ......... ",
" .......... ",
" ............. ",
" ..................... ",
" ...................... ",
" .................... ",
" ................... ",
" ................... ",
" ................ ",
" ............ ",
" ",
" ",
" ",
" ",
" ",
" ",
" "};

65
ressources/round_one.xpm Normal file
View file

@ -0,0 +1,65 @@
/* XPM */
static char * round_one_xpm[] = {
"60 60 2 1",
" c #FF00DC",
". c #EB0000",
" ",
" ",
" ",
" ",
" ",
" ..... ",
" ....... ",
" ......... ",
" .......... ",
" ............ ",
" ............. ",
" ............. ",
" .............. ",
" ............... ",
" ............... ",
" ................ ",
" ................. ",
" ........ ....... ",
" ........ ....... ",
" ....... ....... ",
" ...... ....... ",
" ..... ....... ",
" ....... ",
" ........ ",
" ....... ",
" ....... ",
" ........ ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ........ ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ........ ",
" ....... ",
" .............. ",
" ................. ",
" ....................... ",
" ........................ ",
" ........................ ",
" ........................ ",
" ........................ ",
" ..... ............ ",
" ........ ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" "};

View file

@ -0,0 +1,65 @@
/* XPM */
static char * round_seven_xpm[] = {
"60 60 2 1",
" c #FF00DC",
". c #EB0000",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ................... ",
" ........................... ",
" .................................. ",
" .................................... ",
" ..................................... ",
" ..................................... ",
" .................................... ",
" .................. ",
" .......... ",
" ........ ",
" ......... ",
" ........ ",
" ......... ",
" ......... ",
" ........ ",
" ......... ",
" ......... ",
" ........ ",
" ......... ",
" ......... ",
" ........ ",
" ........ ",
" ........ ",
" ....... ",
" ........ ",
" ......... ",
" ........ ",
" ........ ",
" ....... ",
" ....... ",
" ........ ",
" ......... ",
" ......... ",
" ......... ",
" .......... ",
" ........ ",
" ......... ",
" ......... ",
" ........ ",
" ........ ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ...... ",
" ..... ",
" ",
" ",
" ",
" ",
" "};

65
ressources/round_six.xpm Normal file
View file

@ -0,0 +1,65 @@
/* XPM */
static char * round_six_xpm[] = {
"60 60 2 1",
" c #FF00DC",
". c #EB0000",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ......... ",
" ........... ",
" ........... ",
" ............ ",
" ............. ",
" .............. ",
" ............... ",
" ............ ",
" ............ ",
" ............. ",
" ........... ",
" ........... ",
" ........ ",
" ........ ",
" ....... ",
" ....... ",
" ....... ",
" ........ ",
" ....... ........ ",
" ...................... ",
" ........................ ",
" ......................... ",
" .......................... ",
" .......................... ",
" ............................ ",
" ............ ........... ",
" ....... .......... ",
" ........ .......... ",
" ........ ......... ",
" ....... ......... ",
" ........ ........ ",
" ........ ........ ",
" ......... ....... ",
" ............ ........ ",
" ............... ........... ",
" .......................... ",
" ........................ ",
" ....................... ",
" ..................... ",
" .................. ",
" ............ ",
" ..... ",
" ",
" ",
" ",
" ",
" ",
" ",
" "};

View file

@ -0,0 +1,65 @@
/* XPM */
static char * round_three_xpm[] = {
"60 60 2 1",
" c #FF00DC",
". c #EB0000",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ..... ",
" ............... ",
" .................... ",
" ....................... ",
" ......................... ",
" .......................... ",
" .......................... ",
" ............ ............ ",
" ...... ........ ",
" ..... ........ ",
" ....... ",
" ....... ",
" ........ ",
" ........ ",
" ......... ",
" ......... ",
" .......... ",
" ............. ",
" ............. ",
" .............. ",
" .............. ",
" ................ ",
" ................. ",
" .................. ",
" .................. ",
" ............... ",
" ......... ",
" ........ ",
" ........ ",
" ....... ",
" ....... ",
" ........ ",
" ....... ",
" ....... ",
" ........ ",
" ....... ",
" ......... ",
" ..... ............ ",
" ...................... ",
" ...................... ",
" .................... ",
" ................... ",
" ................... ",
" ............... ",
" ......... ",
" ",
" ",
" ",
" ",
" ",
" ",
" "};

65
ressources/round_two.xpm Normal file
View file

@ -0,0 +1,65 @@
/* XPM */
static char * round_two_xpm[] = {
"60 60 2 1",
" c #FF00DC",
". c #EB0000",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ......... ",
" ............... ",
" ................... ",
" ...................... ",
" ....................... ",
" ......................... ",
" .......................... ",
" ......... ............ ",
" ..... .......... ",
" ......... ",
" ........ ",
" ....... ",
" ....... ",
" ........ ",
" ........ ",
" ....... ",
" ........ ",
" ........ ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ........ ",
" ............ ......... ",
" ........................ ",
" ........................ ",
" ....................... ",
" .......................... ",
" .............................. ",
" ................................ ",
" .......................... ",
" ................... ",
" ................ ",
" ............. ",
" ........ ",
" ..... ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" "};

65
ressources/round_zero.xpm Normal file
View file

@ -0,0 +1,65 @@
/* XPM */
static char * round_zero_xpm[] = {
"60 60 2 1",
" c #FF00DC",
". c #EB0000",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ....... ",
" ............. ",
" ................. ",
" .................... ",
" ......................... ",
" ........................... ",
" ............................... ",
" ............... ............... ",
" ............ ............ ",
" ............. ........... ",
" ........... ........... ",
" ......... ......... ",
" .......... ........ ",
" ......... ....... ",
" ........ ........ ",
" ......... ....... ",
" ........ ....... ",
" ........ ........ ",
" ....... ........ ",
" ....... ....... ",
" ....... ........ ",
" ....... ........ ",
" ....... ....... ",
" ....... ....... ",
" ....... ........ ",
" ....... ....... ",
" ........ ....... ",
" ........ ....... ",
" ....... ....... ",
" ........ ....... ",
" ........ ....... ",
" ........ ....... ",
" ......... ....... ",
" ......... ........ ",
" ......... ......... ",
" ......... .......... ",
" .............. ............. ",
" .................... ............... ",
" ................................... ",
" ................................... ",
" ............................... ",
" ............................. ",
" ......................... ",
" ................ ",
" ..... ",
" ",
" ",
" ",
" ",
" ",
" ",
" "};

65
ressources/tally_five.xpm Normal file
View file

@ -0,0 +1,65 @@
/* XPM */
static char * tally_five_xpm[] = {
"60 60 2 1",
" c #FF00DC",
". c #EB0000",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ..... ..... ",
" ....... ....... ..... ..... ",
" ....... ....... ....... ....... ",
" ....... ....... ....... ....... ",
" ....... ....... ....... ....... ..... ",
" ....... ....... ....... ....... ....... ",
" ....... ....... ....... ....... ....... ",
" ....... ....... ....... ....... ........ ",
" ....... ........ ....... ................ ",
" ....... ....... ....... ................ ",
" ....... ....... ....... ................ ",
" ........ ....... ....... ............... ",
" ....... ....... ....... .............. ",
" ....... ....... ....... .............. ",
" ....... ....... ....... ............. ",
" ....... ....... ....... .............. ",
" ....... ....... .................... ",
" ....... ....... .................... ",
" ....... ....... ................... ",
" ....... ....... .................... ",
" ....... ....... .................... ",
" ........ ....... ........... ....... ",
" ........ ....... ............ ........ ",
" ....... ....... .......... ....... ",
" ....... .................. ....... ",
" ....... .................. ....... ",
" ....... .................. ....... ",
" ....... .................. ....... ",
" ....... .................. ....... ",
" ....... ................... ....... ",
" ................... ....... ....... ",
" ................... ....... ....... ",
" ................. ....... ....... ",
" ................. ....... ....... ",
" ................. ....... ....... ",
" .................. ....... ....... ",
" .................... ....... ....... ",
" ..................... ....... ....... ",
" ............. ....... ....... ....... ",
" ............. ....... ....... ....... ",
" ............. ....... ....... ....... ",
" ............. ....... ....... ....... ",
" ............. ....... ....... ....... ",
" ............. ...... ....... ....... ",
" ............ ..... ...... ...... ",
" ....... ..... ..... ",
" ...... ",
" ..... ",
" ",
" ",
" ",
" ",
" "};

65
ressources/tally_four.xpm Normal file
View file

@ -0,0 +1,65 @@
/* XPM */
static char * tally_four_xpm[] = {
"60 60 2 1",
" c #FF00DC",
". c #EB0000",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ..... ..... ",
" ....... ....... ..... ..... ",
" ....... ....... ....... ....... ",
" ....... ....... ....... ....... ",
" ....... ....... ....... ....... ",
" ....... ....... ....... ....... ",
" ....... ....... ....... ....... ",
" ....... ....... ....... ....... ",
" ....... ........ ....... ....... ",
" ....... ....... ....... ........ ",
" ....... ....... ....... ....... ",
" ........ ....... ....... ....... ",
" ....... ....... ....... ....... ",
" ....... ....... ....... ....... ",
" ....... ....... ....... ....... ",
" ....... ....... ....... ....... ",
" ....... ....... ....... ........ ",
" ....... ....... ....... ........ ",
" ....... ....... ....... ....... ",
" ....... ....... ........ ........ ",
" ....... ....... ........ ........ ",
" ........ ....... ....... ....... ",
" ........ ....... ....... ........ ",
" ....... ....... ....... ....... ",
" ....... ....... ....... ....... ",
" ....... ....... ....... ....... ",
" ....... ....... ....... ....... ",
" ....... ....... ....... ....... ",
" ....... ....... ....... ....... ",
" ....... ....... ....... ....... ",
" ....... ....... ....... ....... ",
" ....... ....... ....... ....... ",
" ....... ....... ....... ....... ",
" ....... ....... ....... ....... ",
" ....... ....... ....... ....... ",
" ....... ....... ....... ....... ",
" ....... ....... ....... ....... ",
" ....... ....... ....... ....... ",
" ....... ....... ....... ....... ",
" ....... ....... ....... ....... ",
" ....... ....... ....... ....... ",
" ....... ....... ....... ....... ",
" ....... ....... ....... ....... ",
" ....... ...... ....... ....... ",
" ....... ..... ...... ...... ",
" ....... ..... ..... ",
" ...... ",
" ..... ",
" ",
" ",
" ",
" ",
" "};

65
ressources/tally_one.xpm Normal file
View file

@ -0,0 +1,65 @@
/* XPM */
static char * tally_one_xpm[] = {
"60 60 2 1",
" c #FF00DC",
". c #EB0000",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ..... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ........ ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ........ ",
" ........ ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ....... ",
" ...... ",
" ..... ",
" ",
" ",
" ",
" ",
" "};

View file

@ -0,0 +1,65 @@
/* XPM */
static char * tally_three_xpm[] = {
"60 60 2 1",
" c #FF00DC",
". c #EB0000",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ..... ..... ",
" ....... ....... ..... ",
" ....... ....... ....... ",
" ....... ....... ....... ",
" ....... ....... ....... ",
" ....... ....... ....... ",
" ....... ....... ....... ",
" ....... ....... ....... ",
" ....... ........ ....... ",
" ....... ....... ....... ",
" ....... ....... ....... ",
" ........ ....... ....... ",
" ....... ....... ....... ",
" ....... ....... ....... ",
" ....... ....... ....... ",
" ....... ....... ....... ",
" ....... ....... ....... ",
" ....... ....... ....... ",
" ....... ....... ....... ",
" ....... ....... ........ ",
" ....... ....... ........ ",
" ........ ....... ....... ",
" ........ ....... ....... ",
" ....... ....... ....... ",
" ....... ....... ....... ",
" ....... ....... ....... ",
" ....... ....... ....... ",
" ....... ....... ....... ",
" ....... ....... ....... ",
" ....... ....... ....... ",
" ....... ....... ....... ",
" ....... ....... ....... ",
" ....... ....... ....... ",
" ....... ....... ....... ",
" ....... ....... ....... ",
" ....... ....... ....... ",
" ....... ....... ....... ",
" ....... ....... ....... ",
" ....... ....... ....... ",
" ....... ....... ....... ",
" ....... ....... ....... ",
" ....... ....... ....... ",
" ....... ....... ....... ",
" ....... ...... ....... ",
" ....... ..... ...... ",
" ....... ..... ",
" ...... ",
" ..... ",
" ",
" ",
" ",
" ",
" "};

65
ressources/tally_two.xpm Normal file
View file

@ -0,0 +1,65 @@
/* XPM */
static char * tally_two_xpm[] = {
"60 60 2 1",
" c #FF00DC",
". c #EB0000",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ..... ..... ",
" ....... ....... ",
" ....... ....... ",
" ....... ....... ",
" ....... ....... ",
" ....... ....... ",
" ....... ....... ",
" ....... ....... ",
" ....... ........ ",
" ....... ....... ",
" ....... ....... ",
" ........ ....... ",
" ....... ....... ",
" ....... ....... ",
" ....... ....... ",
" ....... ....... ",
" ....... ....... ",
" ....... ....... ",
" ....... ....... ",
" ....... ....... ",
" ....... ....... ",
" ........ ....... ",
" ........ ....... ",
" ....... ....... ",
" ....... ....... ",
" ....... ....... ",
" ....... ....... ",
" ....... ....... ",
" ....... ....... ",
" ....... ....... ",
" ....... ....... ",
" ....... ....... ",
" ....... ....... ",
" ....... ....... ",
" ....... ....... ",
" ....... ....... ",
" ....... ....... ",
" ....... ....... ",
" ....... ....... ",
" ....... ....... ",
" ....... ....... ",
" ....... ....... ",
" ....... ....... ",
" ....... ...... ",
" ....... ..... ",
" ....... ",
" ...... ",
" ..... ",
" ",
" ",
" ",
" ",
" "};

View file

@ -6,7 +6,7 @@
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */ /* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/07/17 14:59:37 by kcolin #+# #+# */ /* Created: 2025/07/17 14:59:37 by kcolin #+# #+# */
/* Updated: 2025/09/03 16:31:54 by tchampio ### ########.fr */ /* Updated: 2025/09/03 18:22:15 by tchampio ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -32,6 +32,8 @@ typedef struct s_cub3d_data
t_img_data *img_data; t_img_data *img_data;
t_img_data *point_figures[10]; t_img_data *point_figures[10];
t_img_data *perk_logos[3]; t_img_data *perk_logos[3];
t_img_data *tally_marks[5];
t_img_data *round_figures[10];
t_mapdata *map; t_mapdata *map;
t_player player; t_player player;
t_keypresses keypresses; t_keypresses keypresses;
@ -43,6 +45,7 @@ typedef struct s_cub3d_data
double zbuffer[WIDTH]; double zbuffer[WIDTH];
int sprite_order[MAX_SPRITES]; int sprite_order[MAX_SPRITES];
double sprite_distances[MAX_SPRITES]; double sprite_distances[MAX_SPRITES];
int round;
} t_cub3d_data; } t_cub3d_data;
#endif // CUB3D_DATA_H #endif // CUB3D_DATA_H

95
src/hud/load_texture.c Normal file
View file

@ -0,0 +1,95 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* load_texture.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tchampio <tchampio@student.42lehavre.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/09/03 17:02:08 by tchampio #+# #+# */
/* Updated: 2025/09/03 18:24:18 by tchampio ### ########.fr */
/* */
/* ************************************************************************** */
#include "../../libft/includes/libft.h"
#include "../cub3d_data.h"
#include "../utils/frees.h"
#include "../utils/inits.h"
#include "../../mlx/mlx.h"
t_img_data *load_hud_texture(t_cub3d_data *data, char *path)
{
int width;
int height;
void *img;
t_img_data *img_data;
img = mlx_xpm_file_to_image(data->mlx, path, &width, &height);
if (img == NULL)
{
ft_printf("Error: failed to open image at %s\n", path);
destroy(data, 1);
}
ft_printf("image: %p\n", img);
img_data = ft_calloc(sizeof(t_img_data), 1);
img_data->img = img;
img_data->addr = mlx_get_data_addr(img_data->img,
&img_data->bits_per_pixel, &img_data->line_length,
&img_data->endian);
img_data->height = height;
img_data->width = width;
return (img_data);
}
void load_points_textures(t_cub3d_data *data)
{
data->point_figures[0] = load_hud_texture(data, "ressources/zero.xpm");
data->point_figures[1] = load_hud_texture(data, "ressources/one.xpm");
data->point_figures[2] = load_hud_texture(data, "ressources/two.xpm");
data->point_figures[3] = load_hud_texture(data, "ressources/three.xpm");
data->point_figures[4] = load_hud_texture(data, "ressources/four.xpm");
data->point_figures[5] = load_hud_texture(data, "ressources/five.xpm");
data->point_figures[6] = load_hud_texture(data, "ressources/six.xpm");
data->point_figures[7] = load_hud_texture(data, "ressources/seven.xpm");
data->point_figures[8] = load_hud_texture(data, "ressources/eight.xpm");
data->point_figures[9] = load_hud_texture(data, "ressources/nine.xpm");
}
void load_perk_logos(t_cub3d_data *data)
{
data->perk_logos[0] = load_hud_texture(data,
"ressources/juggernog_logo.xpm");
data->perk_logos[1] = load_hud_texture(data,
"ressources/revive_logo.xpm");
data->perk_logos[2] = load_hud_texture(data,
"ressources/doubletap_logo.xpm");
}
void load_round_indicators(t_cub3d_data *data)
{
data->tally_marks[4] = load_hud_texture(data, "ressources/tally_five.xpm");
data->tally_marks[3] = load_hud_texture(data, "ressources/tally_four.xpm");
data->tally_marks[2] = load_hud_texture(data, "ressources/tally_three.xpm");
data->tally_marks[1] = load_hud_texture(data, "ressources/tally_two.xpm");
data->tally_marks[0] = load_hud_texture(data, "ressources/tally_one.xpm");
data->round_figures[0] = load_hud_texture(data, "ressources/round_zero.xpm");
data->round_figures[1] = load_hud_texture(data, "ressources/round_one.xpm");
data->round_figures[2] = load_hud_texture(data, "ressources/round_two.xpm");
data->round_figures[3] = load_hud_texture(data, "ressources/round_three.xpm");
data->round_figures[4] = load_hud_texture(data, "ressources/round_four.xpm");
data->round_figures[5] = load_hud_texture(data, "ressources/round_five.xpm");
data->round_figures[6] = load_hud_texture(data, "ressources/round_six.xpm");
data->round_figures[7] = load_hud_texture(data, "ressources/round_seven.xpm");
data->round_figures[8] = load_hud_texture(data, "ressources/round_eight.xpm");
data->round_figures[9] = load_hud_texture(data, "ressources/round_nine.xpm");
}
void load_textures(t_cub3d_data *data)
{
data->no_texture = load_single_texture(data, data->map->no_texture);
data->so_texture = load_single_texture(data, data->map->so_texture);
data->we_texture = load_single_texture(data, data->map->we_texture);
data->ea_texture = load_single_texture(data, data->map->ea_texture);
load_points_textures(data);
load_perk_logos(data);
load_round_indicators(data);
}

21
src/hud/load_texture.h Normal file
View file

@ -0,0 +1,21 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* load_texture.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: tchampio <tchampio@student.42lehavre.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/09/03 17:06:02 by tchampio #+# #+# */
/* Updated: 2025/09/03 17:06:52 by tchampio ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef LOAD_TEXTURE_H
# define LOAD_TEXTURE_H
# include "../cub3d_data.h"
t_img_data *load_hud_texture(t_cub3d_data *data, char *path);
void load_textures(t_cub3d_data *data);
#endif // LOAD_TEXTURE_H

View file

@ -6,7 +6,7 @@
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */ /* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/07/17 14:14:30 by kcolin #+# #+# */ /* Created: 2025/07/17 14:14:30 by kcolin #+# #+# */
/* Updated: 2025/09/03 16:32:13 by tchampio ### ########.fr */ /* Updated: 2025/09/03 18:31:54 by tchampio ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -74,12 +74,33 @@ void draw_perks(t_cub3d_data *data)
} }
} }
void draw_round(t_cub3d_data *data)
{
int i;
int pos;
char round_str[5];
if (data->round <= 5)
return (matrix_image_put(data, data->tally_marks[data->round - 1], 20, HEIGHT - 85));
pos = 20;
i = 0;
ft_itoa_static(data->round, round_str, 5);
while (round_str[i])
{
matrix_image_put(data, data->round_figures[round_str[i] - '0'], pos, HEIGHT - 85);
pos += 50;
i++;
}
}
void create_hud(t_cub3d_data *data) void create_hud(t_cub3d_data *data)
{ {
// draw points // draw points
draw_points(data); draw_points(data);
// draw perks // draw perks
draw_perks(data); draw_perks(data);
// draw round
draw_round(data);
// draw weapon // draw weapon
// draw map // draw map
} }

View file

@ -6,7 +6,7 @@
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */ /* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/07/17 14:22:57 by kcolin #+# #+# */ /* Created: 2025/07/17 14:22:57 by kcolin #+# #+# */
/* Updated: 2025/09/01 15:39:07 by tchampio ### ########.fr */ /* Updated: 2025/09/03 17:54:36 by tchampio ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -39,6 +39,8 @@ int keypress_handler(int keycode, t_cub3d_data *data)
data->keypresses.is_right_pressed = true; data->keypresses.is_right_pressed = true;
if (keycode == XK_p) if (keycode == XK_p)
data->player.points += 500; data->player.points += 500;
if (keycode == XK_u)
data->round++;
return (0); return (0);
} }

View file

@ -6,7 +6,7 @@
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */ /* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/07/31 13:43:05 by kcolin #+# #+# */ /* Created: 2025/07/31 13:43:05 by kcolin #+# #+# */
/* Updated: 2025/09/01 17:49:33 by tchampio ### ########.fr */ /* Updated: 2025/09/03 17:53:41 by tchampio ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -15,6 +15,7 @@
#include "../../libft/includes/libft.h" #include "../../libft/includes/libft.h"
#include "../../mlx/mlx.h" #include "../../mlx/mlx.h"
#include "../map/map_checker.h" #include "../map/map_checker.h"
#include "../hud/load_texture.h"
#include "../sprites/create_sprite.h" #include "../sprites/create_sprite.h"
#include "frees.h" #include "frees.h"
#include <stdio.h> #include <stdio.h>
@ -48,27 +49,6 @@ t_img_data *load_single_texture(t_cub3d_data *data, char *path)
return (img_data); return (img_data);
} }
void load_textures(t_cub3d_data *data)
{
data->no_texture = load_single_texture(data, data->map->no_texture);
data->so_texture = load_single_texture(data, data->map->so_texture);
data->we_texture = load_single_texture(data, data->map->we_texture);
data->ea_texture = load_single_texture(data, data->map->ea_texture);
data->point_figures[0] = load_single_texture(data, "ressources/zero.xpm");
data->point_figures[1] = load_single_texture(data, "ressources/one.xpm");
data->point_figures[2] = load_single_texture(data, "ressources/two.xpm");
data->point_figures[3] = load_single_texture(data, "ressources/three.xpm");
data->point_figures[4] = load_single_texture(data, "ressources/four.xpm");
data->point_figures[5] = load_single_texture(data, "ressources/five.xpm");
data->point_figures[6] = load_single_texture(data, "ressources/six.xpm");
data->point_figures[7] = load_single_texture(data, "ressources/seven.xpm");
data->point_figures[8] = load_single_texture(data, "ressources/eight.xpm");
data->point_figures[9] = load_single_texture(data, "ressources/nine.xpm");
data->perk_logos[0] = load_single_texture(data, "ressources/juggernog_logo.xpm");
data->perk_logos[1] = load_single_texture(data, "ressources/revive_logo.xpm");
data->perk_logos[2] = load_single_texture(data, "ressources/doubletap_logo.xpm");
}
void place_base_sprites(t_cub3d_data *data, char **map) void place_base_sprites(t_cub3d_data *data, char **map)
{ {
int y; int y;
@ -96,6 +76,7 @@ void init_cub3d_data(t_cub3d_data *data, char **argv)
{ {
ft_bzero(data, sizeof(*data)); ft_bzero(data, sizeof(*data));
data->map = ft_calloc(sizeof(t_mapdata), 1); data->map = ft_calloc(sizeof(t_mapdata), 1);
data->round = 1;
if (!check_cubfile(argv[1], data->map)) if (!check_cubfile(argv[1], data->map))
return (ft_printf("Error: Wrong map file. Reason: %s\n", return (ft_printf("Error: Wrong map file. Reason: %s\n",
data->map->error), free_map(data->map), exit(1)); data->map->error), free_map(data->map), exit(1));