/* ** 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 text_rendering(sfml_t *sfml) { int pos[2] = {0, 16}; uint32_t *option; option = my_print_set_option(3, 0x000000ff, 0xffffffff, ASCII_CENTER_X | ASCII_REVERSE); my_print(sfml, pos, "I think that the\nlast thing to do.", option); free(option); } static void rendering(sfml_t *sfml) { get_key(sfml); update_thrower(sfml, sfml->scene->thrower, sfml->scene->level); game_camera_update(sfml->scene, sfml->width, sfml->height); my_clear_vram(sfml, 0xffffffff); map_rendering(sfml); player_rendering(sfml); draw_thrower_object(sfml); collision_show(sfml); text_rendering(sfml); } static int suicide_main(sfml_t *sfml, int *fade_active) { sfml->scene->player->nb_dead = 0; while (sfRenderWindow_isOpen(sfml->window) && !(sfml->scene->player->action & PLAYER_WIN) && !sfml->scene->player->nb_dead){ rendering(sfml); if (!*fade_active) fade(sfml, FADE_OPEN); else my_display_vram(sfml); *fade_active = 1; if (!(sfml->scene->player->action & PLAYER_DEAD)) update_player(sfml); set_exit(sfml); } return ((!sfml->scene->player->nb_dead) ? 2 : 1); } void suicide(sfml_t *sfml, int nb_dead) { int fade_active = 0; int exit = 1; sfml->scene = new_scene("src/scene_map/map_suicide.txt", SCENE_LOAD_PLAYER | SCENE_LOAD_THROWER); if (sfml->scene == NULL) return; while (exit > 0 && sfRenderWindow_isOpen(sfml->window)){ sfml->key = 0x00; exit = suicide_main(sfml, &fade_active); if (exit == 2){ free_scene(sfml->scene); end(sfml, 0); return; } exit = text_end(sfml, ++nb_dead); } free_scene(sfml->scene); }