This is a colored text system I made, It displays colored text for a period of time, simply using the function: Display(text$,x,y,r,g,b,seconds), and adding UpdateText() to the main loop. This also works pretty well with games.
Graphics3D 900,700,32,2
Type DisplayText
Field txt$,x,y,r,g,b,finish#
End Type
Function Display(Txt$,x,y,r,g,b,seconds#)
T.DisplayText = New DisplayText
T\txt$ = txt$
T\r=r: T\g=g: T\b=b
T\finish# = MilliSecs() + (seconds#*1000)
T\x=x: T\y=y
End Function
Function UpdateText()
For T.DisplayText = Each DisplayText
R = ColorRed()
G = ColorGreen()
B = ColorBlue()
Color T\r,T\g,T\b
Text T\x,T\y,T\txt$
Color R,G,B
If MilliSecs() >= T\finish#
Delete T
EndIf
Next
End Function
While Not KeyHit(1)
Cls
If KeyHit(200)
Display("You clicked the up arrow key!",100,100,255,105,0,5.5)
EndIf
UpdateWorld()
RenderWorld()
UpdateText()
Flip
Wend
|