I'm using 5 different sprintf+VDP_drawText(...),10 fps less than not use them.
I'm not using a "big" sprintf( %d1 %d2 %d3 etc), then sprintf will delete HUD tiles when printing "space" characters.
Alternatives?
Print HUD with sprites and numbers with sprintf+VDP_drawText() ?
Don't want to waste sprites in HUD, if possible. Maybe in bottom UI I must use sprites, to avoid being covered with main character...
Maybe use PLAN_B? Don't want to use as in another part of game this plan will get some horizontal scroll.
This is my code (just for bottom UI only, top UI is similar):
Code: Select all
//HUD
Game.IU2 = unpackMap(IU_bottom.map, NULL);
VDP_loadTileSet(IU_bottom.tileset, Game.id_tile_final_IU_top, CPU);
VDP_setMapEx(PLAN_A, Game.IU2, TILE_ATTR_FULL(PAL1, FALSE, FALSE, FALSE, Game.id_tile_final_IU_top), 23, 25, 0, 0, 19, 2);
[...]
[...]
//HUD:numbers
char s1[7], s2[7], s3[2], s4[2], s5[2];
sprintf(s1, "%4u", Game.score);
sprintf(s2, "%4u", Game.high_score);
sprintf(s3, "%1u", Player.lives);
sprintf(s4, "%1u", Player.money);
sprintf(s5, "%1u", Player.magic);
VDP_drawText(s1, 06, 0);
VDP_drawText(s2, 18, 0);
VDP_drawText(s3, 26, 26);
VDP_drawText(s4, 32, 26);
VDP_drawText(s5, 37, 26);
Screenshot: