RotatedText - pyöriteltävä teksti
Posted: Wed Jun 29, 2011 5:59 pm
Tässä ajattelin että pyöriteltävä teksti olisi mukava. Juttu oli helppo toteuttaa joten tulosta tuli! RotatedText tarvitsee neljä parametria toimiakseen. x ja y akselit. Montako astetta tekstiä pyöritetään ja itse tekstin.
Itse functio:
Sitten functio kökköisellä esimerkillä:
Jos koodissa on joitain epäkohtia niin mainitkaa.
Itse functio:
Code: Select all
Function RotatedText(x,y,aste,tex$)
pituus = TextWidth(tex$)
korkeus = TextHeight(tex$)
teksti = MakeImage(pituus,korkeus)
DrawToImage teksti
Text 0,0, "" +tex$
DrawToScreen
Smooth2D ON
RotateImage teksti,aste
DrawImage teksti,x,y
Smooth2D OFF
DeleteImage teksti
EndFunction
Code: Select all
font = LoadFont("Impact",50)
SetFont font
Repeat
Color cbred
RotatedText(200,200,aste,"MOI")
DrawScreen
If takas = 0 Then
aste = aste+5
Else
aste = aste-5
EndIf
If aste > 50 Then
takas = 1
EndIf
If aste < -50 Then
takas = 0
EndIf
Forever
Function RotatedText(x,y,aste,tex$)
pituus = TextWidth(tex$)
korkeus = TextHeight(tex$)
teksti = MakeImage(pituus,korkeus)
DrawToImage teksti
Text 0,0, "" +tex$
DrawToScreen
Smooth2D ON
RotateImage teksti,aste
DrawImage teksti,x,y
Smooth2D OFF
DeleteImage teksti
EndFunction