Skip to content

Commit

Permalink
Merge pull request #11 from KallistiOSUnchained/biosfont_icon
Browse files Browse the repository at this point in the history
Biosfont icon
  • Loading branch information
andressbarajas authored Dec 11, 2024
2 parents d16dd03 + 131ac86 commit ad706e0
Show file tree
Hide file tree
Showing 4 changed files with 760 additions and 171 deletions.
58 changes: 29 additions & 29 deletions examples/dreamcast/video/bfont/bfont.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <unistd.h>

int main(int argc, char **argv) {
int x, y, o;
int x, y;

for(y = 0; y < 480; y++)
for(x = 0; x < 640; x++) {
Expand All @@ -19,47 +19,47 @@ int main(int argc, char **argv) {
| ((c >> 3) << 0);
}

/* Set our starting offset to one letter height away from the
/* Set our starting offset to one letter height away from the
top of the screen and two widths from the left */
o = (640 * BFONT_HEIGHT) + (BFONT_THIN_WIDTH * 2);
x = BFONT_WIDE_WIDTH;
y = BFONT_HEIGHT;

/* Test with ISO8859-1 encoding */
bfont_set_encoding(BFONT_CODE_ISO8859_1);
bfont_draw_str(vram_s + o, 640, 1, "Test of basic ASCII");
/* After each string, we'll increment the offset down by one row */
o += 640 * BFONT_HEIGHT;
bfont_draw_str(vram_s + o, 640, 1, "Parlez-vous fran軋is?");
o += 640 * BFONT_HEIGHT;

bfont_draw_str_vram_fmt(x, y, true,
"Test of basic ASCII\nParlez-vous fran�ais?");
y += 2 * BFONT_HEIGHT;
/* Do a second set drawn transparently */
bfont_draw_str(vram_s + o, 640, 0, "Test of basic ASCII");
o += 640 * BFONT_HEIGHT;
bfont_draw_str(vram_s + o, 640, 0, "Parlez-vous fran軋is?");
o += 640 * BFONT_HEIGHT;
bfont_draw_str_vram_fmt(x, y, false,
"Test of basic ASCII\nParlez-vous fran�ais?");

y += 2 * BFONT_HEIGHT;

/* Test with EUC encoding */
bfont_set_encoding(BFONT_CODE_EUC);
bfont_draw_str(vram_s + o, 640, 1, "、ウ、ヒ、チ、マ EUC!");
o += 640 * BFONT_HEIGHT;
bfont_draw_str(vram_s + o, 640, 0, "、ウ、ヒ、チ、マ EUC!");
o += 640 * BFONT_HEIGHT;
bfont_draw_str_vram_fmt(x, y, true, "����ˤ��� EUC!");
y += BFONT_HEIGHT;
bfont_draw_str_vram_fmt(x, y, false, "����ˤ��� EUC!");

y += BFONT_HEIGHT;

/* Test with Shift-JIS encoding */
bfont_set_encoding(BFONT_CODE_SJIS);
bfont_draw_str(vram_s + o, 640, 1, "アドレス変換 SJIS");
o += 640 * BFONT_HEIGHT;
bfont_draw_str(vram_s + o, 640, 0, "アドレス変換 SJIS");
o += 640 * BFONT_HEIGHT;
bfont_draw_str_vram_fmt(x, y, true, "�A�h���X�ϊ� SJIS");
y += BFONT_HEIGHT;
bfont_draw_str_vram_fmt(x, y, false, "�A�h���X�ϊ� SJIS");

/* Drawing the special symbols is a bit convoluted. First we'll draw some
standard text as above. */
bfont_set_encoding(BFONT_CODE_ISO8859_1);
bfont_draw_str(vram_s + o, 640, 1, "To exit, press ");
y += 2 * BFONT_HEIGHT;

/* Then we set the mode to raw to draw the special character. */
bfont_set_encoding(BFONT_CODE_RAW);
/* Adjust the writing to start after "To exit, press " and draw the one char */
bfont_draw_wide(vram_s + o + (BFONT_THIN_WIDTH * 15), 640, 1, BFONT_STARTBUTTON);
bfont_set_encoding(BFONT_CODE_ISO8859_1);
bfont_draw_str_vram_fmt(x, y, true,
"We now support DC/VMU icons in printf statements!\n"
"Use diXX for DC icons and viXX for VMU icons in your\n"
"strings. Enhance your text with visual icons like \n"
DI_UPARROW DI_DOWNARROW DI_LEFTARROW DI_RIGHTARROW " for navigation, and make your UI more\n"
"intuitive. You can display buttons like " DI_ABUTTON DI_BBUTTON DI_XBUTTON DI_YBUTTON "\n"
DI_LTRIGGER DI_RTRIGGER " and icons like " VI_HOURGLASS_ONE VI_VMUICON VI_CHERRIES VI_FISH VI_CRAB " effortlessly.\n\n"
"\tTo exit, press " DI_STARTBUTTON);

/* If Start is pressed, exit the app */
cont_btn_callback(0, CONT_START, (cont_btn_callback_t)arch_exit);
Expand Down
5 changes: 5 additions & 0 deletions kernel/arch/dreamcast/exports-pristine.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ bfont_find_char
bfont_find_char_jp
bfont_find_char_jp_half
bfont_find_icon
bfont_find_dc_icon
bfont_draw_ex
bfont_draw
bfont_draw_thin
Expand All @@ -111,6 +112,10 @@ bfont_draw_str
bfont_draw_str_fmt
bfont_draw_str_vram_vfmt
bfont_draw_str_vram_fmt
bfont_draw_vmu_icon_ex
bfont_draw_vmu_icon
bfont_draw_dc_icon_ex
bfont_draw_dc_icon

# CD-Rom
cdrom_reinit
Expand Down
Loading

0 comments on commit ad706e0

Please sign in to comment.