Mail Archives: djgpp/1997/08/28/20:35:28
Avallone wrote:
>
> Is there a way to display black text on a white background in graphics
> 0x101?
Here's some code, I can't remember where I found it. I think I never
used it because it wouldn't work with mem protection on our something.
Email me with a fix or somethin.
***************************************************************
#include <stdlib.h>
#include <dos.h>
#include <go32.h>
#include <sys/nearptr.h>
#include <sys/farptr.h>
#include "vesag.h"
#define CHAR_WIDTH 8
#define CHAR_HEIGHT 8
char *rom_char_set = (char *)0xFFA6E;
void blit_char(int x, int y, int color, unsigned char c)
{
int offset, x2, y2;
char *work_char;
unsigned char bit_mask = 0x80;
_farpokeb(_dos_ds, rom_char_set + c * CHAR_HEIGHT, work_char);
offset = y * SCREEN_H + x;
for(y2=0; y2<CHAR_HEIGHT; y2++)
{
bit_mask = 0x80;
for(x2=0; x2<CHAR_WIDTH; x2++)
{
if((*work_char & bit_mask))
VG_DB[offset+x2] = color;
bit_mask = (bit_mask >> 1);
}
offset += SCREEN_W;
work_char++;
}
}
void blit_string(int x, int y, int color, char *string)
{
int index;
for(index=0; string[index] != 0; index++)
{
blit_char(x+(index<<3),y,color,string[index]);
}
}
void main(void)
{
unsigned count;
rom_char_set += __djgpp_conventional_base;
VG_InitGraph(VG_640x480);
VG_InitDB();
for(count = 0; count < 32000; count++)
{
blit_string(rand() % 296, rand() % 192, rand() % 256, "Hello");
}
VG_ShowDB();
delay(1500);
VG_CloseGraph();
return;
}
- Raw text -