This program loads up a font (provided), and using a few arrays displays it where you want, you also need to download three files from an email account called
[email protected] password jacobs,
these files are base.bmp,font.txt and charspace.txt.
sync on : sync rate 0
set display mode 640,480,32
open to read 1,"font.txt"
open to read 2,"charspace.txt"
load image "base.bmp",1
count = 1
dim stringref$(200)
dim string_space(200)
dim strings$(20)
dim strings_exist(20)
dim strings_x(20)
dim strings_y(20)
dim strings_d(20)
strings_exist(1)=1 : strings$(1)= ".:Hello and welcome:." : strings_x(1)=320 : strings_y(1)=150
strings_exist(2)=1 : strings$(2)= ".:Hello:." : strings_x(2)=320 : strings_y(2)=70
strings_exist(3)=1 : strings$(3)= "" : strings_x(3)=0 : strings_y(3)=300 : strings_d(3)=2
strings_exist(4)=1 : strings$(4)= "" : strings_x(4)=0 : strings_y(4)=14 : strings_d(4)=2
strings_exist(5)=1 : strings$(5)= "Frame rate:" : strings_x(5)=320 : strings_y(5)=14
strings_exist(6)=1 : strings$(6)= "[email protected]" : strings_x(6)=320 : strings_y(6)=400
paste image 1,0,0
get image count,0,0,16,20,1
stringref$(count)=" "
string_space(count)=10
for y = 1 to 5
for x = 1 to 20
inc count
read string 1,name$
read string 2,spacev$
spacer = val(spacev$)
get image count,(19*x)+2,(25*y)+2,(19*x)+18,(25*y)+23,1
stringref$(count)=name$
string_space(count)= spacer
next x
next y
close file 1
close file 2
backdrop on
do
gosub fps
gosub draw_strings
gosub command
gosub _enter_thisentry
sync
loop
draw_strings:
for checker = 1 to 10
if strings_exist(checker)=1
accume_space=0
tot_length=0
xposition = strings_x(checker)
yposition = strings_y(checker)
value$ = strings$(checker)
lengthc = len(value$)
for lin = 1 to lengthc
letter$ = left$(value$,lin) : letter$ = right$(letter$,1)
char_no = 100
for search = 1 to 100
if letter$ = stringref$(search) then char_no = search
next search
char_s_val = string_space(char_no)
tot_length = tot_length + string_space(char_no)-2
justifyer = tot_length/2
next lin
for ex = 1 to lengthc
extract$ = left$(value$,ex)
extract$ = right$(extract$,1)
value2 = 100
for find = 1 to 100
if stringref$(find) = extract$ then value2 = find : own_space = string_space(find) :goto found
next find
found:
dec own_space,2
if strings_d(checker)=0
buffer = (16 - own_space)/2
paste image value2,(xposition - buffer) + accume_space - justifyer,yposition-10,1
endif
if strings_d(checker)=2
buffer = (16 - own_space)/2
paste image value2,(xposition - buffer) + accume_space,yposition-10,1
endif
accume_space = accume_space + own_space
next ex
endif
next checker
return
command:
id$ = left$(command$,1)
if id$ = "\"
length = len(command$)-1
rest$ = right$(command$,length)
if rest$ = "exit" then end
command$ = "error: illegal call"
endif
strings$(4) = command$
return
fps:
strings$(5) = "Frame rate " + str$(screen fps())
strings_x(5) = mousex()
strings_y(5) = mousey()
return
_enter_thisentry:
if scancode() 28
cc=1-cc : if cc=0 then cc$="_" else cc$=" "
k$=entry$()
clear entry buffer
for k=1 to len(k$)
y$=mid$(k$,k)
if asc(y$)=8
strings$(3)=left$(strings$(3),len(strings$(3))-1)
else
if asc(y$)>=32
strings$(3)=strings$(3)+y$
endif
endif
next k
else
if oldk$ = ""
command$ = strings$(3) : strings$(3) = "" : oldk$ = inkey$() : return
endif
endif
oldk$ = inkey$()
return