X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=dosdemo;a=blobdiff_plain;f=src%2Ftinyfps.c;h=d7d1f80a0730b775c0a86f02ffdebbe6dafd7962;hp=4b9d9dbdc4700f6b67519cd1d8c5d9309aa39e66;hb=637ca39c29b03bd3a2beb99521753e83c043283f;hpb=a8d502c1e163a95f25b2f5aec1478d2cb61027c2 diff --git a/src/tinyfps.c b/src/tinyfps.c index 4b9d9db..d7d1f80 100644 --- a/src/tinyfps.c +++ b/src/tinyfps.c @@ -1,11 +1,13 @@ +#include #include #include "tinyfps.h" #include "demo.h" -// TinyFPS, just a minimal fraps like font to show FPS during the demo and not just after. -// I'll be using it in my effects for my performance test purposes, just adding it here. -// Maybe it would be nice if initFpsFonts would be called in demo.c once but I avoided touching that code. +/* TinyFPS, just a minimal fraps like font to show FPS during the demo and not just after. + * I'll be using it in my effects for my performance test purposes, just adding it here. + * Maybe it would be nice if initFpsFonts would be called in demo.c once but I avoided touching that code. + */ /* 1110 0010 1110 1110 1010 1110 1110 1110 1110 1110 @@ -15,29 +17,30 @@ 1110 0010 1110 1110 0010 1110 1110 0010 1110 1110 */ -const unsigned char miniDecimalData[] = { 0xE2, 0xEE, 0xAE, 0xEE, 0xEE, +static const unsigned char miniDecimalData[] = { 0xE2, 0xEE, 0xAE, 0xEE, 0xEE, 0xA2, 0x22, 0xA8, 0x82, 0xAA, 0xA2, 0xE6, 0xEE, 0xE2, 0xEE, 0xA2, 0x82, 0x22, 0xA2, 0xA2, 0xE2, 0xEE, 0x2E, 0xE2, 0xEE }; -unsigned short miniDecimalFonts[FPS_FONT_NUM_PIXELS]; +static unsigned short miniDecimalFonts[FPS_FONT_NUM_PIXELS]; -unsigned long startingFpsTime = 0; -int fpsFontsInit = 0; -int nFrames = 0; +static unsigned long startingFpsTime = 0; +static int fpsFontsInit = 0; +static int nFrames = 0; void initFpsFonts() { if (fpsFontsInit == 0) { unsigned char miniDecimalPixels[FPS_FONT_NUM_PIXELS]; + int i, j, k = 0; + int x, y, n; - int k = 0; - for (int i = 0; i < FPS_FONT_NUM_PIXELS / 8; i++) + for (i = 0; i < FPS_FONT_NUM_PIXELS / 8; i++) { unsigned char d = miniDecimalData[i]; - for (int j = 0; j < 8; j++) + for (j = 0; j < 8; j++) { unsigned char c = (d & 0x80) >> 7; miniDecimalPixels[k++] = c; @@ -45,12 +48,12 @@ void initFpsFonts() } } - int i = 0; - for (int n = 0; n < FPS_FONTS_NUM; n++) + i = 0; + for (n = 0; n < FPS_FONTS_NUM; n++) { - for (int y = 0; y < FPS_FONT_HEIGHT; y++) + for (y = 0; y < FPS_FONT_HEIGHT; y++) { - for (int x = 0; x < FPS_FONT_WIDTH; x++) + for (x = 0; x < FPS_FONT_WIDTH; x++) { miniDecimalFonts[i++] = miniDecimalPixels[n * FPS_FONT_WIDTH + x + y * FPS_FONT_WIDTH * FPS_FONTS_NUM] * 0xFFFF; } @@ -61,7 +64,7 @@ void initFpsFonts() } } -void drawFont(unsigned char decimal, int posX, int posY, unsigned char zoom, unsigned short *vram) +static void drawFont(unsigned char decimal, int posX, int posY, unsigned char zoom, unsigned short *vram) { int x, y, j, k; unsigned short c; @@ -95,12 +98,12 @@ void drawFont(unsigned char decimal, int posX, int posY, unsigned char zoom, uns } } -void drawDecimal(unsigned int number, int posX, int posY, unsigned char zoom, unsigned short *vram) +static void drawDecimal(unsigned int number, int posX, int posY, unsigned char zoom, unsigned short *vram) { int i = 0; char buffer[8]; - itoa(number, buffer, 10); + sprintf(buffer, "%d", number); while(i < 8 && buffer[i] != 0) { @@ -121,5 +124,7 @@ void drawFps(unsigned short *vram) startingFpsTime = time_msec; nFrames = 0; } - drawDecimal(fps, 4, 4, 2, vram); + /*drawDecimal(fps, 4, 4, 2, vram);*/ + /* Moving this on the lower left side of screen for now, since the lack of double buffering generates flickering for this atm */ + drawDecimal(fps, 4, fb_height - 12, 2, vram); }