Would you guys recommend writing new function for the new BMax commands. For example I did this to replace the DrawText command and to do away with the need to setalpha,rotation manualy. A similar function could be used for DrawImage, would do this byte me in the ass later on?
Graphics 640,480,16,60
Global txtAlpha#,txtScaleX#=1,txtScaleY#=1,txtRotation#
Repeat ; Cls
txtRotation#=txtRotation#+0.5
If txtRotation#>360 Then txtRotation#=0
txtAlpha#=txtAlpha#+0.005
If txtAlpha#>1.0 Then txtAlpha#=0
txtScaleX#=txtScaleX#+0.1
If txtScaleX#>10 Then txtScaleX#=0
txtScaleY#=txtScaleY#+0.1
If txtScaleY#>10 Then txtScaleY#=0
SetColor 0,155,0 ; DrawRect 10,100,200,200
SetColor 255,255,255
Text("text with no effects",10,10)
Text("text with rotation",100,100,5,1,txtRotation#)
Text("text with rotation and alpha",100,200,5,txtAlpha,txtRotation#)
Text("text with Scale",300,300,5,1,0,txtScaleX#,txtScaleY#)
Flip ; Until KeyHit(key_escape)
Function Text(txt$,X,Y,Handle=1,Alpha#=1,Rotation#=0.0,ScaleX#=1.0,ScaleY#=1.0)
Local Width=TextWidth(txt$) ' Get Width
Local Height=TextHeight(txt$) ' Get Height
If Handle=1 Then SetHandle 0,0 ' Top Left
If Handle=2 Then SetHandle Width,0 ' Top Right
If Handle=3 Then SetHandle Height,0 ' Bottom Left
If Handle=4 Then SetHandle Width,Height ' Bottom Right
If Handle=5 Then SetHandle Width/2,Height/2 ' Centered
If Alpha#<1.0 Then SetBlend ALPHABLEND ' Set AlphaBlend
SetAlpha Alpha# ' Set Alpha Value
SetScale ScaleX#,ScaleY# ' Set Scale Value
SetRotation Rotation# ' Set Rotation Value
DrawText txt$,X,Y ' Display the text
SetRotation 0.0 ' Reset Rotation Value
SetScale 1.0,1.0 ' Reset Scale Value
SetAlpha 1.0 ' Reset Alpha Value
End Function
|