/* ** EPITECH PROJECT, 2018 ** task01 ** File description: ** I do task */ #include #include "lib/my_graphics.h" #include "game/kinematic.h" #include "game/message.h" #include "game/ascii.h" #include "game/game.h" #include "game/core.h" #include "game/draw.h" #include "game/menu.h" #include "game/memory.h" static void set_text_suicide(sfml_t *sfml, int nb_dead, uint32_t *option) { int pos[] = {0, sfml->height >> 3}; my_print(sfml, pos, "Doh ! Looks like you missed the secret" " ending...\nPress [A] if you want to find it.\nOr [SPACE] key to" " return to main menu.\n\nNumber of dead: 0", option); pos[1] = (sfml->height >> 1) + 250; pos[0] = 258; my_print_nbr(sfml, nb_dead, option, pos); } static void set_text_win(sfml_t *sfml, int nb_dead, uint32_t *option) { int pos[] = {0, sfml->height >> 3}; my_print(sfml, pos, "...and they lived happily" " ever after.\nWell, almost.\n\nPress [A] or" " [SPACE] to return to main menu.", option); } int text_end(sfml_t *sfml, int nb_dead) { void (*set_text[2])(sfml_t*, int, uint32_t*) = { &set_text_suicide, &set_text_win}; uint32_t *option; sfml->key = 0x00; option = my_print_set_option(3, 0x000000ff, 0xffffffff, ASCII_CENTER_X | ASCII_REVERSE | ASCII_CENTER_Y); my_clear_vram(sfml, 0x000000ff); draw_endtext_bmp(sfml); set_text[(nb_dead) ? 0 : 1](sfml, nb_dead, option); free(option); fade(sfml, FADE_OPEN); while (sfRenderWindow_isOpen(sfml->window) && !((!(sfml->key & PRES_A) && sfml->key & KEY_A) || (!(sfml->key & PRES_SPACE) && sfml->key & KEY_SPACE))) get_key(sfml); fade(sfml, FADE_CLOSE); return ((!(sfml->key & PRES_A) && sfml->key & KEY_A) ? 1 : 0); }