diff options
Diffstat (limited to 'imagefont/test.bmx')
-rw-r--r-- | imagefont/test.bmx | 76 |
1 files changed, 42 insertions, 34 deletions
diff --git a/imagefont/test.bmx b/imagefont/test.bmx index b1da6df..0f38d29 100644 --- a/imagefont/test.bmx +++ b/imagefont/test.bmx @@ -1,14 +1,19 @@ ' $Id$ -Import "imagefont.bmx" +Import noddybox.bitmapfont + +'Import "BitmapFont.bmx" Incbin "bmaxtest.bmi" -Graphics 800,600,32,60 +Const SCRW=640 +Const SCRH=480 + +Graphics SCRW,SCRH,32,60 -fnt:ImageFont=ImageFont.Load("incbin::bmaxtest.bmi") +fnt:BitmapFont=BitmapFont.Load("incbin::bmaxtest.bmi") -c=0 -ci=5 +c=255 +ci=-5 Type Star Field x @@ -16,8 +21,8 @@ Type Star Function Create:Star() Local s:Star=New Star - s.x=Rand(0,800) - s.y=Rand(0,600) + s.x=Rand(0,SCRW) + s.y=Rand(0,SCRH) s.sp=Rand(1,3) Return s End Function @@ -25,7 +30,7 @@ Type Star Method Update() Plot(x,y) y:+sp - y:Mod 600 + y:Mod SCRH End Method End Type @@ -37,7 +42,7 @@ For f=0 Until NO st[f]=Star.Create() Next -While Not KeyHit(KEY_ESCAPE) +While False ' Not KeyHit(KEY_ESCAPE) Cls For f=0 Until NO @@ -46,13 +51,15 @@ While Not KeyHit(KEY_ESCAPE) SetTransform(0,2,2) fnt.DrawColoured("DRAWCOLOURED",0,10,c/2,c/2,c) - fnt.Draw("DRAW",0,20) - fnt.CentreColoured("CENTRECOLOURED",30,c/2,c/2,c) - fnt.Centre("CENTRE",40) - - c:+ci - - If (c=0 Or c=255) ci=-ci + fnt.Draw("DRAW",c-120,30) + fnt.CentreColoured("CENTRECOLOURED",50,c/2,c/2,c) + fnt.Centre("CENTRE",70) + + If Not KeyDown(KEY_P) + c:+ci + + If (c=100 Or c=255) ci=-ci + EndIf DrawText(MemAlloced(),0,100) @@ -62,9 +69,9 @@ While Not KeyHit(KEY_ESCAPE) Wend -SetTransform(0,1,1) - -ch=33 +sc=10 +t$="THIS IS SOME VERY, VERY, *VERY* LARGE SCROLLING TEXT....." +x#=0 While Not KeyHit(KEY_ESCAPE) Cls @@ -73,23 +80,24 @@ While Not KeyHit(KEY_ESCAPE) st[f].Update() Next - a$=Chr$(ch) - - ch:+1 - If ch>Asc("Z") Then ch=33 - - For x=0 To 800 Step 8 - For y=0 To 600 Step 8 - fnt.DrawColoured(a$,x,y,c,c,c) - Next - Next - - c:+ci - - If (c=0 Or c=255) ci=-ci + SetTransform(0,1,1) + + DrawText("x="+x+" width="+(-fnt.TextWidth(t[0..1]))+" mem="+MemAlloced(),0,100) + DrawText("t="+t,0,110) - DrawText(MemAlloced(),0,100) + SetTransform(0,sc,sc) + + fnt.Draw(t$,x,200) + If Not KeyDown(KEY_P) + x:-sc + + If x<-fnt.TextWidth(t[0..1]) + x:+fnt.TextWidth(t[0..1]) + t=t[1..]+t[0..1] + EndIf + EndIf + FlushMem Flip |