Foxglovz

Foxglovz is a new Graphics Library for the VZ computer. Basically this name derives from Fox Graphics Library On VZ.

It was originally developed for the VZ 200 and VZ 300 computers by Dick Smith, but technically should work on any platform supported by the Z88DK development kit so long as it supports monochrome graphics sprites.

It was written by Jason Oakley because the Z88DK seems to only have great support for graphics and, hence, fonts for Spectrum computers. A lot of work has been put in for them, but the others have fallen on the wayside.

Initially, Foxglovz will support rendering fonts in monochrome graphics but will hopefully be expanded with other functionality in the future.

image

Foxglovz is being released under Creative Commons Attribution-ShareAlike 3.0 Unported License so that others may benefit.

v0.2: This is an early release with limited functionality but is very usable. You can download it from the Tools Downloads page on this site.

v0.3: Released 9 November 2019. This version supports proportional fonts. Hence, all font.h files must contain a charwidth int array with the width of each individual character.

Usage:
The function to display text on the screen using the included font is called fox_textat. Before calling this function you need to set up some parameters in a struct. Eg.

struct myfontspecs myfont;
strcpy(myfont.name, "sansserif5x7");
myfont.xpos = 0;
myfont.ypos = 0;
myfont.spacing = 1;
myfont.colour = _vzred;
myfont.fx = _fxnormal;
myfont.fx |= (1<<_fxunderline);

The first parameter is the font name. This is unused in v0.2 and only included for future expansion.
xpos and ypos are the x and y pixel locations on the screen to display your text. spacing denotes how many pixels between each character. colour is at this time unused and may be removed if not supported by z88dk. fx has a few options at the moment. If you leave it as _fxnormal then all text will be displayed without any change. If you add _fxunderline a line will be drawn under the text. You can also use _fxinverse to inverse the text a’la old computer systems. You may want to draw a box around each character first and this may become an option or mandatory in the future depending on feedback.

You should also edit foxglovz.c and hard-code the x and y maximum pixel limits for the resolution of your computer screen. I’m open to better ideas for implementing this in the future.

Finally call the function thus:
fox_textat(&myfont,”Text to display”);
and your text will appear on the screen. You should set your platform into its graphics mode, if required. See below for more information.

You may also require including a bunch of header files for your relevant platform in your main.c file. An example main.c file is below:

#include <games.h>
#include <vz.h>
#include <stdlib.h>
#include <string.h>
#include <balloc.h> 
#include "font.h"
#include "foxglovz.c"

int main(void)
{
	clg();

	struct myfontspecs myfont;
	strcpy(myfont.name, "sansserif5x7");
	myfont.xpos = 0;
	myfont.ypos = 0;
	myfont.spacing = 1;
	myfont.colour = _vzred;
	myfont.fx = _fxnormal;
	myfont.fx |= (1<<_fxunderline);

	fox_textat(&myfont,"Testing 1,2,3");
		
	while(1) {}
}

I compile this on my computer using:

zcc.exe +vz -pragma-redirect:scrbase=base_graphics -DAMALLOC -o main.vz main.c

I will upload different fonts to use in the Fox Fonts Download page. They are designed with Spedito. I design each character of the ASCII table from <space> to at least <tilde> ~
The header (first 3 values) of font.h are the name of the font, the width of the font characters and the height of the font characters. eg for sansserif5x7 this is:

extern char font[] = { "sansserif5x7", 5, 7,

After defining the font array you will need an int array of character widths of each character in pixels in charwidth[]

An example of the output on a VZ200 emulator is below:

Font test output

Z88dk now supports the VZ MODE() changes and COLOR m,n commands:

#include <sys/ioctl.h>
int mode = 1;
console_ioctl(IOCTL_GENCON_SET_MODE, &mode);
// Change sprite font colour
textcolor(4);

The next version of Foxglovz will have this built-in using the myfont struct.
Due to how Z88dk works, this is also supported in blocky MODE(0) format:

MODE COLOR changes : to change to the Orange background in MODE(0) use
int mode = 32;
For the MODE(1) COLOR ,1 buff graphics Mode use:
int mode = 33;
In the latest Z88dk build to use the actual VZ colours correctly, you need to add the following switch while building:
-pragma-define:CLIB_CONIO_NATIVE_COLOUR=1

© 2019: Blue Bilby | GREEN EYE Theme by: D5 Creation | Powered by: WordPress