Code: Select all
/* program under development - work in progress!
See suggestions area of forum for problems in taking forward.
*/
'g'
GRAPHICS
OPTION BASE 1
DIM A$(1000)
LIST FONTS TO A$,N
fs=40 'default font size
f=100 'default font
Slidval=.1
Change=0 'user input monitor
/* program requires the the user provide a text file (can be anything) in order for typefaces to display something. It needs to be called demotext.txt or change next prog line to suit yourself.
*/
FILE "demotext.txt" READLINE Demotext$
GOSUB CheckScreenOrientation
GOSUB CreateButtons
GOSUB CreatePointSizeSlider
'b'
Main:
GRAPHICS CLEAR 0,0,0
GOSUB CheckScreenOrientation
Screen$=Orient$
GOSUB CreateButtons
GOSUB CreatePointSizeSlider
IF Orient$= "landscape" THEN SPRITE "screen" BEGIN 1024,560
IF Orient$= "portrait" THEN SPRITE "screen" BEGIN 768,810
GRAPHICS CLEAR .2,.2,.2
DRAW COLOR 0,.7,2
DRAW FONT SIZE fs
DRAW FONT NAME A$(f)
'Uncomment next line to display your text file, then comment out the following line.
'DRAW TEXT Demotext$ at 8,60
/*Next line just displays font name in its own typeface. Comment out if demotext$ used otherwise display corrupted. */
DRAW TEXT A$(f) AT 8,60
SPRITE "screen" END
SPRITE "screen" SHOW
SPRITE "screen" AT 0,60
Loop:
GOSUB CheckScreenOrientation
IF change=1 THEN GOTO Main
GOSUB CheckButtons
IF change=1 THEN GOTO Main
gosub CheckPointSizeSlider
IF change=1 THEN GOTO Main
GOTO Loop
GOTO Main
'r'
CheckScreenOrientation:
Change=0
IF SCREEN_WIDTH() < SCREEN_HEIGHT() THEN
Orient$="portrait"
hwo=O 'horizontal width offset
vho=255 'vertical height offset
ENDIF
IF SCREEN_WIDTH() > SCREEN_HEIGHT() THEN
Orient$="landscape"
hwo=253
vho=0
ENDIF
IF Orient$<>Screen$ THEN Change=1
RETURN
CreateButtons:
b$=A$(f)
c$="#"&f&" of "&N&" - "&fs&" point"
BUTTON 0 TITLE b$ AT 8,10
BUTTON 1 TITLE c$ AT 8,685+vho
BUTTON 23 TITLE "-10" AT 415+hwo,10
BUTTON 24 TITLE "-5" AT 474+hwo,10
BUTTON 25 TITLE "Prev." AT 522+hwo,10
BUTTON 26 TITLE "Next" AT 592+hwo,10
BUTTON 27 TITLE "+5" AT 660+hwo,10
BUTTON 28 TITLE "+10" AT 710+hwo,10
RETURN
CreatePointSizeSlider:
GOSUB CheckScreenOrientation
SLIDER 0 VALUE slidval AT 230,(685+(vho)) SIZE (530+(hwo))
Slidval=SLIDER_VALUE ("0")
RETURN
CheckButtons:
Change=0
IF BUTTON_PRESSED("23") THEN
f=f-10
Change=1
IF f<1 THEN f=N
ENDIF
IF BUTTON_PRESSED("24") THEN
f=f-5
Change=1
IF f<1 THEN f=N
ENDIF
IF BUTTON_PRESSED("25") THEN
f=f-1
Change=1
IF f<1 THEN f=N
ENDIF
IF BUTTON_PRESSED("26") THEN
f=f+1
Change=1
IF f>N THEN f=1
ENDIF
IF BUTTON_PRESSED("27") THEN
f=f+5
Change=1
IF f>N THEN f=1
ENDIF
IF BUTTON_PRESSED("28") THEN
f=f+10
Change=1
IF f>N THEN f=1
ENDIF
RETURN
CheckPointSizeSlider: 'modified as suggested by Mr K.
IF SLIDER_CHANGED("0")=1 THEN
Change=1
Slidval=SLIDER_VALUE ("0")
sv=Slidval*1000
sfs=(sv/100)*50
fs=int(sfs)
ENDIF
RETURN