Import backup from 2004-03-09
This commit is contained in:
1 parent
8d0e6de040
commit
7f886e44e1
12 files changed
+211
-119
No files matched your search
+11
-5
@@ -525,14 +525,20 @@ StdFont fonts[] = {
|
||||
{stdfont10x7, 10, 7}
|
||||
};
|
||||
|
||||
//Returns the standard font size, 0 = invalid font
|
||||
// bits 0-7 = font width
|
||||
// bits 8-15 = font height
|
||||
unsigned int stdfont_getFontSize(unsigned int fontNumber)
|
||||
//Returns the width of a given, 0 = invalid font
|
||||
unsigned int stdfont_getFontWidth(unsigned int fontNumber)
|
||||
{
|
||||
if (fontNumber >= STDFONTS)
|
||||
return 0;
|
||||
return (fonts[fontNumber].charHeight << 8) | fonts[fontNumber].charWidth;
|
||||
return fonts[fontNumber].charWidth;
|
||||
}
|
||||
|
||||
//Returns the height of a given, 0 = invalid font
|
||||
unsigned int stdfont_getFontHeight(unsigned int fontNumber)
|
||||
{
|
||||
if (fontNumber >= STDFONTS)
|
||||
return 0;
|
||||
return fonts[fontNumber].charHeight;
|
||||
}
|
||||
|
||||
//Returns a pointer to the desired font's bitmap representation
|
||||
|
||||
@@ -15,9 +15,10 @@ typedef struct {
|
||||
} StdFont;
|
||||
|
||||
//Returns the standard font size, 0 = invalid font
|
||||
// bits 0-7 = font width
|
||||
// bits 8-15 = font height
|
||||
unsigned int stdfont_getFontSize(unsigned int fontNumber);
|
||||
unsigned int stdfont_getFontWidth(unsigned int fontNumber);
|
||||
|
||||
//Returns the height of a given, 0 = invalid font
|
||||
unsigned int stdfont_getFontHeight(unsigned int fontNumber);
|
||||
|
||||
//Returns a pointer to the desired font's bitmap representation
|
||||
unsigned char *stdfont_getBitmap(unsigned int fontNumber);
|
||||
|
||||
+21
-32
@@ -10,7 +10,6 @@ dword videoMode = 0; //what video mode # we are in, 0 for console mode
|
||||
word *vid_ptr16 = (word *)0xF0000000;
|
||||
byte *vid_ptr24 = (byte *)0xF0000000;
|
||||
dword *vid_ptr32 = (dword *)0xF0000000;
|
||||
word console_memory[2000]; //holds a copy of the console's memory
|
||||
void (*video_psetp)(int, dword) = video_psetpnull; //function pointer to set a pixel
|
||||
|
||||
//Initialized the video mode information block video_mode and allocated double-buffer memory for graphics display
|
||||
@@ -37,17 +36,22 @@ void video_init()
|
||||
}
|
||||
|
||||
//Renders a character using stdfont[] as a bitmask
|
||||
void video_renderChar(int x, int y, int character, dword color)
|
||||
void video_renderChar(int x, int y, int character, int font, dword color)
|
||||
{
|
||||
int charpos = (character & 0xFF) * 8;
|
||||
int charWidth = stdfont_getFontWidth(font);
|
||||
if (!charWidth)
|
||||
return;
|
||||
int charHeight = stdfont_getFontHeight(font);
|
||||
int charpos = (character & 0xFF) * charHeight;
|
||||
byte *charBMP = (byte *)stdfont_getBitmap(font);
|
||||
int row;
|
||||
int col;
|
||||
for (row = 0; row < 8; row++)
|
||||
for (row = 0; row < charHeight; row++)
|
||||
{
|
||||
for (col = 0; col < 5; col++)
|
||||
for (col = 0; col < charWidth; col++)
|
||||
{
|
||||
if ((stdfont[charpos+row] >> (col+3)) & 0x01)
|
||||
video_pset(x+(5-col), y+row, color);
|
||||
if ((charBMP[charpos + row] << col) & 0x80)
|
||||
video_pset(x + col, y + row, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -161,31 +165,6 @@ void video_psetp32(int pixel, dword color)
|
||||
void video_psetpnull(int pixel, dword color) {}
|
||||
|
||||
|
||||
// This function draws a simple "console" window in graphical mode to display text
|
||||
void video_drawConsole()
|
||||
{
|
||||
video_rectf(9, 9, 490, 260, 0);
|
||||
video_rect(8, 8, 491, 261, 0x00777777);
|
||||
int x, y;
|
||||
for (x = 0; x < 80; x++)
|
||||
{
|
||||
for (y = 0; y < 25; y++)
|
||||
{
|
||||
video_renderChar(x*6+10, y*10+10, console_memory[y*80+x], 0x00FFFFFF);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// This function draws a "console" character to the graphical video screen
|
||||
void video_drawConsoleChar(dword position)
|
||||
{
|
||||
int x = position % 80;
|
||||
int y = position / 80;
|
||||
video_renderChar(x*6+10, y*10+10, console_memory[y*80+x], 0x00FFFFFF);
|
||||
}
|
||||
|
||||
|
||||
int video_getWidth()
|
||||
{
|
||||
return video_mode.XResolution;
|
||||
@@ -196,6 +175,16 @@ int video_getHeight()
|
||||
return video_mode.YResolution;
|
||||
}
|
||||
|
||||
byte video_getBitsPerPixel()
|
||||
{
|
||||
return video_mode.BitsPerPixel;
|
||||
}
|
||||
|
||||
dword video_getPhysBasePtr()
|
||||
{
|
||||
return video_mode.PhysBasePtr;
|
||||
}
|
||||
|
||||
dword video_Mode()
|
||||
{
|
||||
return videoMode;
|
||||
|
||||
@@ -18,11 +18,11 @@ void video_psetp16(int pixel, dword color);
|
||||
void video_psetp24(int pixel, dword color);
|
||||
void video_psetp32(int pixel, dword color);
|
||||
void video_psetpnull(int pixel, dword color);
|
||||
void video_renderChar(int x, int y, int character, dword color);
|
||||
void video_drawConsole();
|
||||
void video_drawConsoleChar(dword position);
|
||||
void video_renderChar(int x, int y, int character, int font, dword color);
|
||||
int video_getWidth();
|
||||
int video_getHeight();
|
||||
byte video_getBitsPerPixel();
|
||||
dword video_getPhysBasePtr();
|
||||
dword video_Mode();
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user