diff --git a/CMakeLists.txt b/CMakeLists.txt index b3d4bab..de26c66 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,6 +48,9 @@ set(SOURCES set(ASSETS_cg assets-cg/tileset.png + assets-cg/dialogue.png + assets-cg/capacite.png + assets-cg/battle_ui.png assets-cg/maps/inside/tileset_in.png assets-cg/maps/testCarte.json assets-cg/maps/1.json diff --git a/assets-cg/battle_ui.png b/assets-cg/battle_ui.png new file mode 100644 index 0000000..205a2c4 Binary files /dev/null and b/assets-cg/battle_ui.png differ diff --git a/assets-cg/capacite.png b/assets-cg/capacite.png new file mode 100644 index 0000000..72212fb Binary files /dev/null and b/assets-cg/capacite.png differ diff --git a/assets-cg/dialogue.png b/assets-cg/dialogue.png new file mode 100644 index 0000000..ee279bf Binary files /dev/null and b/assets-cg/dialogue.png differ diff --git a/assets-cg/fxconv-metadata.txt b/assets-cg/fxconv-metadata.txt index 845e22f..3655373 100644 --- a/assets-cg/fxconv-metadata.txt +++ b/assets-cg/fxconv-metadata.txt @@ -11,7 +11,21 @@ uf8x9: type: font name: uf8x9 charset: unicode - grid.size: 8x11 - grid.padding: 1 + grid.size: 14x44 proportional: true - height: 9 + height: 16 + +dialogue.png: + type: bopti-image + name: img_dialogue + profile: p4 + +capacite.png: + type: bopti-image + name: img_capacite + profile: p4 + +battle_ui.png: + type: bopti-image + name: img_battle + profile: p4 diff --git a/assets-cg/monsters/test.png b/assets-cg/monsters/test.png index 3eac728..495468b 100644 Binary files a/assets-cg/monsters/test.png and b/assets-cg/monsters/test.png differ diff --git a/assets-cg/uf8x9/U+0020.png b/assets-cg/uf8x9/U+0020.png index c36367b..ba41f2b 100644 Binary files a/assets-cg/uf8x9/U+0020.png and b/assets-cg/uf8x9/U+0020.png differ diff --git a/assets-cg/uf8x9/U+00A0.png b/assets-cg/uf8x9/U+00A0.png index 761f42d..a0e645c 100644 Binary files a/assets-cg/uf8x9/U+00A0.png and b/assets-cg/uf8x9/U+00A0.png differ diff --git a/assets-cg/uf8x9/U+0100.png b/assets-cg/uf8x9/U+0100.png index 172fce2..6fb8740 100644 Binary files a/assets-cg/uf8x9/U+0100.png and b/assets-cg/uf8x9/U+0100.png differ diff --git a/src/battle.c b/src/battle.c index 09c6c14..459cfe3 100644 --- a/src/battle.c +++ b/src/battle.c @@ -19,9 +19,10 @@ void create_battle(struct Game *game) { //gain d'xp int xp = ceil((monster->stats->xp*monster->stats->level*1.5)/7); - const int rect_size = 100; - drect(0,DHEIGHT,DWIDTH,DHEIGHT-rect_size,C_WHITE); - dprint(10,DHEIGHT-rect_size/2-8, C_BLACK, "Vous remportez %d points d'experience", xp); + extern bopti_image_t img_dialogue; + dimage(42,DHEIGHT-75,&img_dialogue); + + dprint(50,DHEIGHT-75/2-10, C_BLACK, "Vous remportez %d points d'experience", xp); dupdate(); wait_for_input(KEY_SHIFT); @@ -32,8 +33,8 @@ void create_battle(struct Game *game) { for(int i = game->player->stats.level; i < calc_level; i++) { dclear(C_RGB(25,25,25)); draw_battle(game->player, monster); - drect(0,DHEIGHT,DWIDTH,DHEIGHT-rect_size,C_WHITE); - dprint(10,DHEIGHT-rect_size/2-8,C_BLACK,"Vous passez au niveau %d !", i+1); + dimage(42,DHEIGHT-75,&img_dialogue); + dprint(50,DHEIGHT-75/2-10,C_BLACK,"Vous passez au niveau %d !", i+1); dupdate(); wait_for_input(KEY_SHIFT); } @@ -120,32 +121,36 @@ int select_move(struct Player *player, struct Monster *monster, int prec_selecte } void draw_battle(struct Player *player, struct Monster *monster) { - const int WIDTH_HP = 100; + extern bopti_image_t img_battle; + const int WIDTH_HP = 74; if(player->stats.pv < 0) player->stats.pv = 0; if(monster->stats->pv < 0) monster->stats->pv = 0; + dimage(0,0,&img_battle); int posHP = (float)player->stats.pv / player->stats.max_pv * WIDTH_HP; - drect(10,15,10+WIDTH_HP,25,C_BLACK); - drect(10,15,10+posHP,25,C_GREEN); + drect(290,138,290+WIDTH_HP,142,C_WHITE); + drect(290,138,290+posHP,142,C_GREEN); - dprint(15+WIDTH_HP,15,C_BLACK,"%d/%d", player->stats.pv, player->stats.max_pv); + dprint(333,124,C_BLACK,"%d",player->stats.level); + dprint(246,124,C_BLACK,"%d/%d", player->stats.pv, player->stats.max_pv); int posHPmonster = (float)monster->stats->pv / monster->stats->max_pv * WIDTH_HP; - dprint(240,2,C_BLACK,"%s",monster->name); - drect(240,15,240+WIDTH_HP,25,C_BLACK); - drect(240,15,240+posHPmonster,25,C_GREEN); - dprint(245+WIDTH_HP,2,C_BLACK,"%d",monster->stats->level); - dprint(245+WIDTH_HP,15,C_BLACK,"%d/%d", monster->stats->pv, monster->stats->max_pv); - dimage(260,30,monster->sprite); + dprint(2,8,C_BLACK,"%s",monster->name); + drect(48,23,48+WIDTH_HP,27,C_WHITE); + drect(48,23,48+posHPmonster,27,C_GREEN); + dprint(90,9,C_BLACK,"%d",monster->stats->level); + dprint(127,11,C_BLACK,"%d/%d", monster->stats->pv, monster->stats->max_pv); + + dimage(265,10,monster->sprite); } void draw_executed_move(struct Move move, struct Monster *monster, int is_monster) { - const int rect_size = 100; - drect(0,DHEIGHT,DWIDTH,DHEIGHT-rect_size,C_WHITE); + extern bopti_image_t img_dialogue; + dimage(42,DHEIGHT-75,&img_dialogue); if(is_monster) { - dprint(10,DHEIGHT-rect_size/2-8, C_BLACK, "%s lance %s !", monster->name, move.name); + dprint(50,DHEIGHT-75/2-10, C_BLACK, "%s lance %s !", monster->name, move.name); } else { - dprint(10,DHEIGHT-rect_size/2-8, C_BLACK, "Vous lancez %s !", move.name); + dprint(50,DHEIGHT-75/2-10, C_BLACK, "Vous lancez %s !", move.name); } } \ No newline at end of file diff --git a/src/capacite.c b/src/capacite.c index 91146cc..f31d34a 100644 --- a/src/capacite.c +++ b/src/capacite.c @@ -16,10 +16,11 @@ struct Move get_move_id(int id) { } void draw_move(int x, int y, int x2, int y2, struct Move move) { + extern bopti_image_t img_capacite; const int font_size = 8; - drect(x, y, x2, y2, C_WHITE); - dprint(x+5, y+5, C_BLACK, "PP : %d", move.pp); - dprint(x+5, y2-15, C_BLACK, "ATK : %d", move.atk); + dimage(x, y, &img_capacite); + dprint(x+15, y+5, C_BLACK, "PP : %d", move.pp); + dprint(x+15, y2-20, C_BLACK, "ATK : %d", move.atk); dprint((int)((x+x2)/2)-(int)(strlen(move.name)/2*font_size), (int)((y+y2)/2)-font_size/2, C_BLACK, "%s", move.name); diff --git a/src/player.c b/src/player.c index 89611c4..e5fde92 100644 --- a/src/player.c +++ b/src/player.c @@ -119,6 +119,6 @@ void draw_ui(struct Player *player) { int index = get_nb_moves(player); for(int i = 0; i < index; i++) { - draw_classic_move(2+132*i,DHEIGHT-80, player->moves[i]); + draw_classic_move(2+132*i,DHEIGHT-70, player->moves[i]); } } \ No newline at end of file diff --git a/src/talkable.c b/src/talkable.c index d02e0d8..8366955 100644 --- a/src/talkable.c +++ b/src/talkable.c @@ -16,14 +16,15 @@ struct Talkable default_value = { /*draw the dialog of a specified talkable tile*/ void draw_dialog(struct Talkable *talkable) { + extern bopti_image_t img_dialogue; const char *delim = ";"; char *str = strdup(talkable->text); char *curr_line = strtok(str, delim); while(curr_line != NULL) { - drect(20,10,370,80,C_WHITE); - dprint(25,20, C_BLACK, "%s", talkable->name); + dimage(43,31,&img_dialogue); + dprint(50,40, C_BLACK, "%s", talkable->name); //TODO Il y a moyen de faire mieux avec seulement curr_line. //Cela semble globalement fonctionner, mais j'ai pu observer des petites erreurs @@ -44,12 +45,12 @@ void draw_dialog(struct Talkable *talkable) { strncpy(split,&remain[0],indexSpace); strncpy(remain,&remain[indexSpace]+1,strlen(remain)); - dprint(25,40+indexLine*15, C_BLACK, "%s", split); + dprint(50,60+indexLine*15, C_BLACK, "%s", split); indexLine++; } - dprint(25,40+indexLine*15, C_BLACK, "%s", remain); + dprint(50,60+indexLine*15, C_BLACK, "%s", remain); } else { - dprint(25,40, C_BLACK, "%s", curr_line); + dprint(50,60, C_BLACK, "%s", curr_line); } dupdate();