added custom font support for both plateform + created a dummy font + corrected dialog text line spacing

This commit is contained in:
SlyVTT 2023-07-10 20:55:27 +02:00
parent 17758d07f0
commit 5f55b46bad
7 changed files with 28 additions and 1 deletions

View file

@ -52,6 +52,7 @@ set(ASSETS
set(ASSETS_cg
assets-cg/demo_player.png
assets-cg/player_face.png
assets-cg/font.png
)
set(ASSETS_cg_2b
@ -65,6 +66,7 @@ set(ASSETS_cg_EGA64
set(ASSETS_fx
assets-fx/demo_player.png
assets-fx/player_face.png
assets-fx/font.png
# ...
)

View file

@ -14,6 +14,7 @@ A ce stade, on a déjà implémenté :
- [x] Carte Multilayer (Background, Foreground + accessibilité / Dommages) avec transparence du calque Foreground
- [x] Personnage
- [ ] Dialogues
- [ ] Fontes de caractères
- [ ] Interraction
- [ ] NPC
- [ ] Changement de map

BIN
assets-cg/font.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View file

@ -5,3 +5,13 @@ demo_player.png:
player_face.png:
type: bopti-image
name: player_face_img
font.png:
name: fontRPG
type: font
charset: print
grid.size: 10x10
grid.padding: 2
grid.border: 0
proportional: true
height: 10

BIN
assets-fx/font.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View file

@ -5,3 +5,14 @@ demo_player.png:
player_face.png:
type: bopti-image
name: player_face_img
font.png:
name: fontRPG
type: font
charset: print
grid.size: 5x5
grid.padding: 1
grid.border: 0
proportional: true
height: 5

View file

@ -5,7 +5,10 @@
#define BOX_HEIGHT (F_HEIGHT/PXSIZE+8)
extern font_t fontRPG;
void showtext(Game *game, bopti_image_t *face, char *text) {
dfont(&fontRPG);
unsigned int i;
for(i=0;i<BOX_HEIGHT;i++){
draw(game);
@ -22,7 +25,7 @@ void showtext(Game *game, bopti_image_t *face, char *text) {
/* Show a little message that showing text in dialogs is not implemented
* yet. */
dtext(BOX_HEIGHT*PXSIZE, 1, C_BLACK, "Dialogs not implemented");
dtext(BOX_HEIGHT*PXSIZE, 8, C_BLACK, "Press any key");
dtext(BOX_HEIGHT*PXSIZE, 8*PXSIZE, C_BLACK, "Press any key");
dupdate();
getkey();
for(i=0;i<strlen(text);i++){