/*
	GLPRINTF.C

	This program demonstrates how to use glprintf to print some text on
	the lcd screen. If you are using Dynamic C Deluxe, you can uncomment
	the glXFontInit call and comment out the glFontInit call.
*/

#use engfontl.lib
#use engfnt2l.lib
#use op71p.lib					//	specify underlying LCD
#use op71hw.lib						//	specify high level graphics library
#use vdriver.lib

main() {
	auto struct _fontInfo fi, bigFi;	//	declare struct to hold font information

	VdInit();		// let the virtual driver hit the watchdog timer . . .	
	glInit();		//	initialize the software and hardware modules
	
	op71BackLight(1);
	op71SetContrast(35);
	
	//	the following call is possible only for Deluxe versions of the
	//	compiler because it relies on the "xdata" construct to place
	//	the font bitmap in xmem

	glBlankScreen();		//	blank the screen

	glSetBrushType(GL_BLOCK);		//	set block mode
	glXFontInit(	//	initialize the font info structure needed later
		&fi,			//	pointer to the font info structure to fill
		6,				//	horizontal size (in pixels) of each character
		8,				//	vertical size (in pixels) of each character
		32,			//	beginning code of printable characters
		255,			//	ending code of printable characters
		engFont6x8	//	address of font bitmap in xmem
		);
	glXFontInit(	//	initialize the font info structure needed later
		&bigFi,		//	pointer to the font info structure to fill
		17,				//	horizontal size (in pixels) of each character
		35,				//	vertical size (in pixels) of each character
		32,			//	beginning code of printable characters
		127,			//	ending code of printable characters
		engFont17x35a	//	address of font bitmap in xmem
		);
	//	the following call works for both standard and deluxe versions of
	//	the compiler because the font bitmap is in root memory.
/*
	glFontInit(		//	initialize the font info structure needed later
		&fi,			//	pointer to the font info structure to fill
		6,				//	horizontal size (in pixels) of each character
		8,				//	vertical size (in pixels) of each character
		32,			//	beginning code of printable characters
		127,			//	ending code of printable characters
		engFont6x8R	//	address of font bitmap in root memory
		);
*/		
	glPrintf(		//	print some text on the screen!
		0,				//	x-position of right extreme of text to display
		0,				//	y-position of top extreme of text to display
		&fi,			//	font info structure
		"Something on\nthe screen!"	//	the string to print out
		);
	glPrintf(		//	print some text on the screen!
		0,				//	x-position of right extreme of text to display
		16,				//	y-position of top extreme of text to display
		&bigFi,			//	font info structure
		"BIG"	//	the string to print out
		);
	glSetBrushType(GL_XOR);
	glPrintf(		//	print some text on the screen!
		8,				//	x-position of right extreme of text to display
		24,				//	y-position of top extreme of text to display
		&bigFi,			//	font info structure
		"BIG"	//	the string to print out
		);
	
	glSetBrushType(GL_SET);
	glPrintf(		//	print some text on the screen!
		16,				//	x-position of right extreme of text to display
		32,				//	y-position of top extreme of text to display
		&bigFi,			//	font info structure
		"BIG"	//	the string to print out
		);
	
	glSetBrushType(GL_CLEAR);
	glPrintf(		//	print some text on the screen!
		24,				//	x-position of right extreme of text to display
		40,				//	y-position of top extreme of text to display
		&bigFi,			//	font info structure
		"BIG"	//	the string to print out
		);
	
}