' $Id$ Import noddybox.bitmapfont 'Import "BitmapFont.bmx" Incbin "bmaxtest3.bmf" Const SCRW=640 Const SCRH=480 SetGraphicsDriver GLMax2DDriver() Graphics SCRW,SCRH,32,60' Or HARDSYNC fnt:BitmapFont=BitmapFont.Load("incbin::bmaxtest3.bmf",0) If fnt=Null RuntimeError "Failed to open font" EndIf c=255 ci=-5 Type Star Field x Field y,sp Function Create:Star() Local s:Star=New Star s.x=Rand(0,SCRW) s.y=Rand(0,SCRH) s.sp=Rand(1,3) Return s End Function Method Update() Plot(x,y) y:+sp y:Mod SCRH End Method End Type Const NO=10000 Local st:Star[]=New Star[NO] For f=0 Until NO st[f]=Star.Create() Next SetBlend(ALPHABLEND) While Not KeyHit(KEY_ESCAPE) Cls For f=0 Until NO st[f].Update() Next SetTransform(0,2,2) fnt.DrawColoured("DRAWCOLOURED",0,10,c/2,c/2,c) 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 fnt.DrawColoured(MemAlloced(),0,300,255,0,0) If KeyHit(KEY_SPACE) Then FlushMem Flip Wend sc=10 t$="THIS IS SOME VERY, VERY, *VERY* ~~LARGE SCROLLING TEXT....." x#=0 ang#=0 angi#=0.2 While Not KeyHit(KEY_ESCAPE) Cls For f=0 Until NO st[f].Update() Next SetTransform(0,1,1) Rem DrawText("x="+x+" width="+(-fnt.TextWidth(t[0..1]))+" mem="+MemAlloced(),0,100) DrawText("t="+t,0,110) EndRem SetTransform(ang,sc,sc) ang:+angi If ang<=-10 Or ang>=10 Then angi=-angi fnt.DrawColoured(t$,x,0,255,255,255)'128,128) If Not KeyDown(KEY_P) x:-5 If x<-fnt.TextWidth(t[0..1]) x:+fnt.TextWidth(t[0..1]) t=t[1..]+t[0..1] EndIf EndIf FlushMem Flip Wend