projects
/
dosdemo
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
- VBE banked mode fixes backported from rbench
[dosdemo]
/
src
/
tinyfps.c
diff --git
a/src/tinyfps.c
b/src/tinyfps.c
index
4b9d9db
..
269c965
100644
(file)
--- a/
src/tinyfps.c
+++ b/
src/tinyfps.c
@@
-1,11
+1,14
@@
+#include <stdio.h>
#include <stdlib.h>
#include "tinyfps.h"
#include "demo.h"
#include <stdlib.h>
#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
/*
1110 0010 1110 1110 1010 1110 1110 1110 1110 1110
@@
-15,29
+18,30
@@
1110 0010 1110 1110 0010 1110 1110 0010 1110 1110
*/
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 };
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];
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];
{
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;
{
unsigned char c = (d & 0x80) >> 7;
miniDecimalPixels[k++] = c;
@@
-45,12
+49,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;
}
{
miniDecimalFonts[i++] = miniDecimalPixels[n * FPS_FONT_WIDTH + x + y * FPS_FONT_WIDTH * FPS_FONTS_NUM] * 0xFFFF;
}
@@
-61,14
+65,14
@@
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;
unsigned short *fontData = (unsigned short*)&miniDecimalFonts[decimal * FPS_FONT_WIDTH * FPS_FONT_HEIGHT];
{
int x, y, j, k;
unsigned short c;
unsigned short *fontData = (unsigned short*)&miniDecimalFonts[decimal * FPS_FONT_WIDTH * FPS_FONT_HEIGHT];
- vram += posY * fb_width + posX;
+ vram += posY * FB_WIDTH + posX;
if (zoom < 1) zoom = 1;
if (zoom > 4) zoom = 4;
if (zoom < 1) zoom = 1;
if (zoom > 4) zoom = 4;
@@
-85,22
+89,22
@@
void drawFont(unsigned char decimal, int posX, int posY, unsigned char zoom, uns
{
for (k=0; k<zoom; k++)
{
{
for (k=0; k<zoom; k++)
{
- *(vram + j * fb_width + k) ^= c;
+ *(vram + j * FB_WIDTH + k) ^= c;
}
}
}
vram += zoom;
}
}
}
}
vram += zoom;
}
- vram += (-FPS_FONT_WIDTH * zoom + fb_width * zoom);
+ vram += (-FPS_FONT_WIDTH * zoom + FB_WIDTH * zoom);
}
}
}
}
-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];
{
int i = 0;
char buffer[8];
- itoa(number, buffer, 10);
+ sprintf(buffer, "%d", number);
while(i < 8 && buffer[i] != 0)
{
while(i < 8 && buffer[i] != 0)
{
@@
-121,5
+125,7
@@
void drawFps(unsigned short *vram)
startingFpsTime = time_msec;
nFrames = 0;
}
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);
}
}