hBasic > hManual > Samples

hBasic Manual
Examples and Demos

Code Samples

How to use a font family

How to load a console font
Demos
0413 demo
demo package as zip file
( click link to download )
gdemo1

demo package as zip file
hManual Utility.
download as a .bas file.
How to use a font family

CONSOLE.SET "FONT sans-serif.BOLD"
or
.CS "FONT sans-serif.BOLD"      % .cs is a shortcut command

How to load a console font

FONT.LOAD fptr, "../source/LCDMN___.ttf"

IF fptr = -1 THEN PRINT "Error loading font" : END

CONSOLE.SET "FONT "+ int$(fptr)

.CS "TEXTSIZE 30"
? "Loaded Font"

Demo 0413
This was the demo with release v3.28. It now only works for v4.13+ because of the added menu command.

The demo shows the capabilities of hBasic's re-engineered console. Particularly with CONSOLE.SET and PRINT.AT.

Click to download the demo package as zip file
Unzip and copy all the files into the source/ directory.
Then run demo.bas.

The demo is really 3 demo files run in sequence (with the RUN command).
demo.bas -> font-fam.bas -> font-load.bas

gDemo1
Originally the demo with experimental release of hBasix (with libGdx).
This has now been ported over to hBasic v5.00+ (without libGdx).
It demonstrates a simple game where you need to catch droplets of water into a bucket.

Click to download the demo package as zip file
Unzip and copy all the files into the source/ directory.
Then run gdemo1.bas.
The demo demonstrates sprite movement and animation.