/******************************************************************/
/* ClassX Amiga Rexx script - Copyright © 1996 ClassX Development */
/******************************************************************/

/*
	$VER: TUT_FontGroviera.rexx 1.0
	$INF: Esempio guidato per la creazione di un font in stile Groviera.
*/

MYPORT = 'FontMachine'

IF ~SHOW('P', MYPORT) THEN DO
	IF EXISTS('FontMachine:FontMachine') THEN DO
		ADDRESS COMMAND 'Run >NIL: FontMachine:FontMachine'
		DO 30 WHILE ~SHOW('P',MYPORT)
			 ADDRESS COMMAND 'Wait >NIL: 1 SEC'
		END
	END
	ELSE DO
		SAY "FontMachine could not be loaded."
		EXIT 10
	END
END

IF ~SHOW('P', MYPORT) THEN DO
	SAY 'FontMachine Rexx port could not be opened.'
	EXIT 10
END

ADDRESS VALUE MYPORT
OPTIONS RESULTS
OPTIONS FAILAT 10000

/******************************************************************/

/* Make sure rexxsupport library is opened */
IF ~SHOW('L','rexxsupport.library') THEN CALL ADDLIB('rexxsupport.library',0,-30)

LockGui

SetAttr "Emboss" 0
SetAttr "Bevel" 0
SetAttr "3D" 0
SetAttr "Shadow" 0
SetAttr "Outline" 0
SetAttr "OutTexture" 0

Request '"Tutorial Message"' '"Esempio 1: come creare un font .... al formaggio."' 'Ok'

Request '"Tutorial Message"' '"Impostare la risoluzione a 8 colori"' 'Ok'
Resolution 3

Request '"Tutorial Message"' '"Caricare la tessitura di fronte: brush Groviera."' 'Ok'
LoadTexture "Front" "Brush" "FontMachine:Brush/Groviera"
CALL WaitRedraw (FM_RESULT)

Request '"Tutorial Message"' '"Caricare il font Balloon, dimensione 100 punti."' 'Ok'
LoadFont "Balloon.font" 100
CALL WaitRedraw (FM_RESULT)

Request '"Tutorial Message"' '"Impostare una palette adatta."' 'Ok'
EditPal 1 0 0 0
EditPal 2 72 33 0 
EditPal 3 145 67 0
EditPal 4 217 100 0
EditPal 5 221 121 0
EditPal 6 222 140 0
EditPal 7 223 159 0
CALL WaitRedraw (FM_RESULT)

Request '"Tutorial Message"' '"Impostare la mappatura in modo Random (RndMap)."' 'Ok'
SetMapMode "SolidMappedRnd"
CALL WaitRedraw (FM_RESULT)

Request '"Tutorial Message"' '"Impostare uno sbalzo di 3 pixels con luce in alto a sinistra."' 'Ok'
SetAttr "Emboss" 3 "UL"
CALL WaitRedraw (FM_RESULT)

Request '"Tutorial Message"' '"Impostare una ombra di 8 pixels, posizionata in basso a destra."' 'Ok'
SetAttr "Shadow" 8 "DR" 1
CALL WaitRedraw (FM_RESULT)

Request '"ARexx Message"' '"Fine."' 'Ok'

UnLockGui

EXIT

/******************************************************************/

WaitRedraw:
	ARG Res
	/* wait the rendering of the font */
	DO WHILE Res ~= 0
		CheckRedraw
		Res = FM_RESULT
		ADDRESS COMMAND 'Wait >NIL: 1 SEC'
	END
	RETURN

/******************************************************************/
