From 26c98ba56e72beaf8a99eafbedd2b0c64ac13954 Mon Sep 17 00:00:00 2001 From: Ian C Date: Sat, 27 May 2006 23:24:02 +0000 Subject: Updates --- types.bmx | 886 ++++++++++++++++++++++++++++++++------------------------------ 1 file changed, 460 insertions(+), 426 deletions(-) (limited to 'types.bmx') diff --git a/types.bmx b/types.bmx index dbe5cbd..8d8d57b 100644 --- a/types.bmx +++ b/types.bmx @@ -1,426 +1,460 @@ -' Hardwire -' -' Copyright 2005 Ian Cowburn -' -' $Id$ -' -' -' This should really be called Global.bmx probably... -' -Strict -Import brl.pngloader - -Import noddybox.bitmapfont -Import noddybox.gfxmenu - - -' Included binaries -' -Incbin "GFX/font.bmf" -Incbin "GFX/small.bmf" -Incbin "GFX/large.bmf" -Incbin "GFX/pointer.png" -Incbin "GFX/play_button.png" -Incbin "GFX/quit_button.png" -Incbin "GFX/keys_button.png" -Incbin "GFX/rules_button.png" -Incbin "GFX/left_button.png" -Incbin "GFX/right_button.png" -Incbin "GFX/copper.png" -Incbin "GFX/copperslice.png" -Incbin "GFX/dust.png" -Incbin "GFX/title.png" -Incbin "GFX/gameover.png" -Incbin "GFX/bdropstar.png" - -Incbin "TILES/tile.png" -Incbin "TILES/pit_top.png" -Incbin "TILES/pit_bottomleft.png" -Incbin "TILES/pit_bottomright.png" -Incbin "TILES/pit_bottom.png" -Incbin "TILES/pit_side.png" -Incbin "TILES/trode_left.png" -Incbin "TILES/trode_right.png" -Incbin "TILES/trode_bottom.png" -Incbin "TILES/top_bottom.png" -Incbin "TILES/left_right.png" -Incbin "TILES/cross.png" -Incbin "TILES/top_left.png" -Incbin "TILES/top_right.png" -Incbin "TILES/bottom_left.png" -Incbin "TILES/bottom_right.png" - -Incbin "TILES/special_bomb.png" -Incbin "TILES/special_twister.png" -Incbin "TILES/special_nuke.png" -Incbin "TILES/special_cross.png" - -Const HERTZ:Int=60 - -Type Lookup - Global si:Double[] - Global co:Double[] - - Function Init() - si=New Double[360] - co=New Double[360] - - For Local a:Int=0 To 359 - si[a]=Sin(a) - co[a]=Cos(a) - Next - End Function -End Type - - -Type GameGFX - Global font:TBitmapFont - Global small:TBitmapFont - Global large:TBitmapFont - - Global title:TImage - Global gameover:TImage - - Global pointer:TImage - Global copper:TImage - Global copperslice:TImage - Global dust:TImage - - Global play_button:TImage - Global quit_button:TImage - Global left_button:TImage - Global right_button:TImage - Global rules_button:TImage - Global keys_button:TImage - - Global tile:TImage - - Global pit_top:TImage - Global pit_bottomleft:TImage - Global pit_bottomright:TImage - Global pit_bottom:TImage - Global pit_side:TImage - - Global trode_left:TImage - Global trode_right:TImage - Global trode_bottom:TImage - - Global top_bottom:Timage - Global left_right:Timage - Global cross:Timage - Global top_left:Timage - Global top_right:Timage - Global bottom_left:Timage - Global bottom_right:Timage - - Global special_bomb:TImage - Global special_twister:TImage - Global special_nuke:TImage - Global special_cross:TImage - - Global bdropstar:TImage - - Function SafeLoadImage:TImage(p:String, mode:Int) - Local i:TImage=LoadImage(p,mode) - Assert i,"Failed to load " + p - Return i - End Function - - Function SafeLoadAnimImage:TImage(p:String, w:Int, h:Int, f:Int, c:Int, mode:Int) - Local i:TImage=LoadAnimImage(p,w,h,f,c,mode) - Assert i,"Failed to load " + p - Return i - End Function - - Function Init() - font=TBitmapFont.Load("incbin::GFX/font.bmf",0) - small=TBitmapFont.Load("incbin::GFX/small.bmf",0) - large=TBitmapFont.Load("incbin::GFX/large.bmf",0) - - Assert font,"Failed to load incbin::GFX/font.bmf" - Assert small,"Failed to load incbin::GFX/small.bmf" - Assert large,"Failed to load incbin::GFX/large.bmf" - - title=SafeLoadImage("incbin::GFX/title.png",0) - gameover=SafeLoadImage("incbin::GFX/gameover.png",0) - MidHandleImage(gameover) - - pointer=SafeLoadImage("incbin::GFX/pointer.png",0) - - copper=SafeLoadImage("incbin::GFX/copper.png",0) - copperslice=SafeLoadImage("incbin::GFX/copperslice.png",0) - - dust=SafeLoadImage("incbin::GFX/dust.png",FILTEREDIMAGE) - MidHandleImage(dust) - - play_button=SafeLoadImage("incbin::GFX/play_button.png",0) - quit_button=SafeLoadImage("incbin::GFX/quit_button.png",0) - rules_button=SafeLoadImage("incbin::GFX/rules_button.png",0) - keys_button=SafeLoadImage("incbin::GFX/keys_button.png",0) - left_button=SafeLoadImage("incbin::GFX/left_button.png",0) - right_button=SafeLoadImage("incbin::GFX/right_button.png",0) - - tile=SafeLoadImage("incbin::TILES/tile.png",0) - - pit_top=SafeLoadImage("incbin::TILES/pit_top.png",0) - pit_bottom=SafeLoadImage("incbin::TILES/pit_bottom.png",0) - pit_bottomleft=SafeLoadImage("incbin::TILES/pit_bottomleft.png",0) - pit_bottomright=SafeLoadImage("incbin::TILES/pit_bottomright.png",0) - pit_side=SafeLoadImage("incbin::TILES/pit_side.png",0) - - trode_left=SafeLoadImage("incbin::TILES/trode_left.png",0) - trode_right=SafeLoadImage("incbin::TILES/trode_right.png",0) - trode_bottom=SafeLoadImage("incbin::TILES/trode_bottom.png",0) - - top_bottom=SafeLoadImage("incbin::TILES/top_bottom.png",0) - left_right=SafeLoadImage("incbin::TILES/left_right.png",0) - cross=SafeLoadImage("incbin::TILES/cross.png",0) - top_left=SafeLoadImage("incbin::TILES/top_left.png",0) - top_right=SafeLoadImage("incbin::TILES/top_right.png",0) - bottom_left=SafeLoadImage("incbin::TILES/bottom_left.png",0) - bottom_right=SafeLoadImage("incbin::TILES/bottom_right.png",0) - - special_bomb=SafeLoadAnimImage("incbin::TILES/special_bomb.png",32,32,0,4,DYNAMICIMAGE) - special_twister=SafeLoadAnimImage("incbin::TILES/special_twister.png",32,32,0,4,DYNAMICIMAGE) - special_nuke=SafeLoadAnimImage("incbin::TILES/special_nuke.png",32,32,0,4,DYNAMICIMAGE) - special_cross=SafeLoadAnimImage("incbin::TILES/special_cross.png",32,32,0,4,DYNAMICIMAGE) - - bdropstar=SafeLoadAnimImage("incbin::GFX/bdropstar.png",8,8,0,6,0)'FILTEREDIMAGE) - End Function -End Type - -Type GameConfig - Global kleft:Int - Global kright:Int - Global krotright:Int - Global krotleft:Int - Global kdrop:Int - Global kpause:Int - Global start_level:Int - Global hiscore:Int - - Function Load() - Local s:TStream=ReadStream("hardwire.config") - - If s=Null - kleft=KEY_LEFT - kright=KEY_RIGHT - krotright=KEY_UP - krotleft=KEY_DOWN - kdrop=KEY_SPACE - kpause=KEY_P - start_level=1 - hiscore=0 - Return - EndIf - - s=LittleEndianStream(s) - - kleft=s.ReadInt() - kright=s.ReadInt() - krotright=s.ReadInt() - krotleft=s.ReadInt() - kdrop=s.ReadInt() - kpause=s.ReadInt() - start_level=s.ReadInt() - hiscore=s.ReadInt() - - s.Close() - End Function - - Function Save() - Local s:TStream=WriteStream("hardwire.config") - - If s=Null - Return - EndIf - - s=LittleEndianStream(s) - - s.WriteInt(kleft) - s.WriteInt(kright) - s.WriteInt(krotright) - s.WriteInt(krotleft) - s.WriteInt(kdrop) - s.WriteInt(kpause) - s.WriteInt(start_level) - s.WriteInt(hiscore) - - s.Close() - End Function -EndType - -Type TEasyLink - Field l:TLink - - Function Create:TEasyLink(l:TList) - Local o:TEasyLink=New TEasyLink - o.l=l.FirstLink() - Return o - End Function - - Method Value:Object() - If l - Return l.Value() - Else - Return Null - EndIf - End Method - - Method MoveNext() - If l - l=l.NextLink() - EndIf - End Method - - Method Remove() - Local ol:TLink=l - MoveNext() - ol.Remove() - End Method -End Type - - -Type TMenuBdrop Extends TGfxMenuBackdrop - Field msg:String - Field msgp:Int - Field msgx:Int - Field msgy:Int - - Method New() - msg=" " - msg=" " - msg:+"Welcome to Hardwire. " - msg:+"Hardwire was written using BlitzMax -- http://www.blitzbasic.com/ -- and a variety of tools available at " - msg:+"http://www.noddybox.demon.co.uk/ Please feel free to forward this game to whoever you hate enough " - msg:+"to inflict this monstrosity upon. Enjoy. This game written under the influence of Slay Radio -- http://www.slayradio.org" - - msgx=0 - msgp=0 - msgy=560 - End Method - - Method Create:TGfxMenuBackdrop() - Return Self - End Method - - Method Update() - GameGFX.large.Draw(msg[..80],msgx,msgy) - - msgx:-2 - If msgx<-GameGFX.large.TextWidth(msg[0..1]) - msgx:+GameGFX.large.TextWidth(msg[0..1]) - msg=msg[1..]+msg[0..1] - EndIf - End Method -End Type - -Type TFadeScreen - Field a:Double - Field ai:Double - - Function Create:TFadeScreen(a:Double, ai:Double) - Local o:TFadeScreen=New TFadeScreen - o.a=a - o.ai=ai - Return o - End Function - - Function FadeOut:TFadeScreen() - Return Create(0,0.05) - End Function - - Function FadeIn:TFadeScreen() - Return Create(1,-0.05) - End Function - - Function DoFadeOut() - Local fade:TFadeScreen=TFadeScreen.FadeOut() - Local pm:TPixmap=GrabPixmap(0,0,GraphicsWidth(),GraphicsHeight()) - - While fade.Fade() - Cls - DrawPixmap(pm,0,0) - fade.Draw() - Flip - Wend - End Function - - Method Fade:Int() - a:+ai - Return a>0 And a<1 - End Method - - Method Draw() - Local r:Int,g:Int,b:Int - Local oa:Double=GetAlpha() - GetColor(r,g,b) - SetAlpha(a) - SetColor(0,0,0) - DrawRect(0,0,GraphicsWidth(),GraphicsHeight()) - SetColor(r,g,b) - SetAlpha(oa) - End Method -End Type - -Type TGameBackdropStar - Field x:Double - Field y:Double - Field dy:Double - Field r:Int - Field g:Int - Field b:Int - Field frame:Int - Field cnt:Int - - Method New() - x=Rnd(0,GraphicsWidth()) - y=Rnd(0,GraphicsHeight()) - dy=Rnd(0.1,2) - r=Rand(128,255) - g=Rand(128,255) - b=Rand(128,255) - frame=Rand(0,5) - cnt=5 - End Method - - Method Draw(anim:Int) - If anim - frame=(frame+1) Mod 6 - EndIf - - y:+dy - If y>GraphicsHeight()+8 - y=-8 - EndIf - SetColor(r,g,b) - DrawImage(GameGFX.bdropstar,x,y,frame) - End Method -End Type - - -Type TGameBackdrop - Field num:Int - Field star:TGameBackdropStar[] - Field cnt:Int - - Method New() - num=100 - star=New TGameBackdropStar[num] - cnt=5 - - For Local f:Int=0 Until num - star[f]=New TGameBackdropStar - Next - End Method - - Method Draw() - For Local f:Int=0 Until num - star[f].Draw(cnt=0) - Next - cnt:-1 - If cnt=-1 - cnt=5 - EndIf - End Method -End Type \ No newline at end of file +' Hardwire +' +' Copyright (C) 2005 Ian Cowburn (ianc@noddybox.co.uk) +' +' This program is free software; you can redistribute it and/or modify +' it under the terms of the GNU General Public License as published by +' the Free Software Foundation; either version 2 of the License, or +' (at your option) any later version. +' +' This program is distributed in the hope that it will be useful, +' but WITHOUT ANY WARRANTY; without even the implied warranty of +' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +' GNU General Public License for more details. +' +' You should have received a copy of the GNU General Public License +' along with this program; if not, write to the Free Software +' Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +' +' ------------------------------------------------------------------------- +' +' $Id$ +' +' +' This should really be called Global.bmx probably... +' +Strict +Import brl.pngloader + +Import noddybox.bitmapfont +Import noddybox.gfxmenu + + +' Included binaries +' +Incbin "GFX/font.bmf" +Incbin "GFX/small.bmf" +Incbin "GFX/large.bmf" +Incbin "GFX/pointer.png" +Incbin "GFX/play_button.png" +Incbin "GFX/quit_button.png" +Incbin "GFX/keys_button.png" +Incbin "GFX/rules_button.png" +Incbin "GFX/left_button.png" +Incbin "GFX/right_button.png" +Incbin "GFX/copper.png" +Incbin "GFX/copperslice.png" +Incbin "GFX/dust.png" +Incbin "GFX/title.png" +Incbin "GFX/gameover.png" +Incbin "GFX/bdropstar.png" + +Incbin "TILES/tile.png" +Incbin "TILES/pit_top.png" +Incbin "TILES/pit_bottomleft.png" +Incbin "TILES/pit_bottomright.png" +Incbin "TILES/pit_bottom.png" +Incbin "TILES/pit_side.png" +Incbin "TILES/trode_left.png" +Incbin "TILES/trode_right.png" +Incbin "TILES/trode_bottom.png" +Incbin "TILES/top_bottom.png" +Incbin "TILES/left_right.png" +Incbin "TILES/cross.png" +Incbin "TILES/top_left.png" +Incbin "TILES/top_right.png" +Incbin "TILES/bottom_left.png" +Incbin "TILES/bottom_right.png" + +Incbin "TILES/special_bomb.png" +Incbin "TILES/special_twister.png" +Incbin "TILES/special_nuke.png" +Incbin "TILES/special_cross.png" + +Const HERTZ:Int=60 + +Type Lookup + Global si:Double[] + Global co:Double[] + + Function Init() + si=New Double[360] + co=New Double[360] + + For Local a:Int=0 To 359 + si[a]=Sin(a) + co[a]=Cos(a) + Next + End Function +End Type + + +Type GameGFX + Global font:TBitmapFont + Global small:TBitmapFont + Global large:TBitmapFont + + Global title:TImage + Global gameover:TImage + + Global pointer:TImage + Global copper:TImage + Global copperslice:TImage + Global dust:TImage + + Global play_button:TImage + Global quit_button:TImage + Global left_button:TImage + Global right_button:TImage + Global rules_button:TImage + Global keys_button:TImage + + Global tile:TImage + + Global pit_top:TImage + Global pit_bottomleft:TImage + Global pit_bottomright:TImage + Global pit_bottom:TImage + Global pit_side:TImage + + Global trode_left:TImage + Global trode_right:TImage + Global trode_bottom:TImage + + Global top_bottom:Timage + Global left_right:Timage + Global cross:Timage + Global top_left:Timage + Global top_right:Timage + Global bottom_left:Timage + Global bottom_right:Timage + + Global special_bomb:TImage + Global special_twister:TImage + Global special_nuke:TImage + Global special_cross:TImage + + Global bdropstar:TImage + + Function SafeLoadImage:TImage(p:String, mode:Int) + Local i:TImage=LoadImage(p,mode) + Assert i,"Failed to load " + p + Return i + End Function + + Function SafeLoadAnimImage:TImage(p:String, w:Int, h:Int, f:Int, c:Int, mode:Int) + Local i:TImage=LoadAnimImage(p,w,h,f,c,mode) + Assert i,"Failed to load " + p + Return i + End Function + + Function Init() + font=TBitmapFont.Load("incbin::GFX/font.bmf",0) + small=TBitmapFont.Load("incbin::GFX/small.bmf",0) + large=TBitmapFont.Load("incbin::GFX/large.bmf",0) + + Assert font,"Failed to load incbin::GFX/font.bmf" + Assert small,"Failed to load incbin::GFX/small.bmf" + Assert large,"Failed to load incbin::GFX/large.bmf" + + title=SafeLoadImage("incbin::GFX/title.png",0) + gameover=SafeLoadImage("incbin::GFX/gameover.png",0) + MidHandleImage(gameover) + + pointer=SafeLoadImage("incbin::GFX/pointer.png",0) + + copper=SafeLoadImage("incbin::GFX/copper.png",0) + copperslice=SafeLoadImage("incbin::GFX/copperslice.png",0) + + dust=SafeLoadImage("incbin::GFX/dust.png",FILTEREDIMAGE) + MidHandleImage(dust) + + play_button=SafeLoadImage("incbin::GFX/play_button.png",0) + quit_button=SafeLoadImage("incbin::GFX/quit_button.png",0) + rules_button=SafeLoadImage("incbin::GFX/rules_button.png",0) + keys_button=SafeLoadImage("incbin::GFX/keys_button.png",0) + left_button=SafeLoadImage("incbin::GFX/left_button.png",0) + right_button=SafeLoadImage("incbin::GFX/right_button.png",0) + + tile=SafeLoadImage("incbin::TILES/tile.png",0) + + pit_top=SafeLoadImage("incbin::TILES/pit_top.png",0) + pit_bottom=SafeLoadImage("incbin::TILES/pit_bottom.png",0) + pit_bottomleft=SafeLoadImage("incbin::TILES/pit_bottomleft.png",0) + pit_bottomright=SafeLoadImage("incbin::TILES/pit_bottomright.png",0) + pit_side=SafeLoadImage("incbin::TILES/pit_side.png",0) + + trode_left=SafeLoadImage("incbin::TILES/trode_left.png",0) + trode_right=SafeLoadImage("incbin::TILES/trode_right.png",0) + trode_bottom=SafeLoadImage("incbin::TILES/trode_bottom.png",0) + + top_bottom=SafeLoadImage("incbin::TILES/top_bottom.png",0) + left_right=SafeLoadImage("incbin::TILES/left_right.png",0) + cross=SafeLoadImage("incbin::TILES/cross.png",0) + top_left=SafeLoadImage("incbin::TILES/top_left.png",0) + top_right=SafeLoadImage("incbin::TILES/top_right.png",0) + bottom_left=SafeLoadImage("incbin::TILES/bottom_left.png",0) + bottom_right=SafeLoadImage("incbin::TILES/bottom_right.png",0) + + special_bomb=SafeLoadAnimImage("incbin::TILES/special_bomb.png",32,32,0,4,DYNAMICIMAGE) + special_twister=SafeLoadAnimImage("incbin::TILES/special_twister.png",32,32,0,4,DYNAMICIMAGE) + special_nuke=SafeLoadAnimImage("incbin::TILES/special_nuke.png",32,32,0,4,DYNAMICIMAGE) + special_cross=SafeLoadAnimImage("incbin::TILES/special_cross.png",32,32,0,4,DYNAMICIMAGE) + + bdropstar=SafeLoadAnimImage("incbin::GFX/bdropstar.png",8,8,0,6,0)'FILTEREDIMAGE) + End Function +End Type + +Type GameConfig + Global kleft:Int + Global kright:Int + Global krotright:Int + Global krotleft:Int + Global kdrop:Int + Global kpause:Int + Global start_level:Int + Global hiscore:Int + + Function Load() + Local s:TStream=ReadStream("hardwire.config") + + If s=Null + kleft=KEY_LEFT + kright=KEY_RIGHT + krotright=KEY_UP + krotleft=KEY_DOWN + kdrop=KEY_SPACE + kpause=KEY_P + start_level=1 + hiscore=0 + Return + EndIf + + s=LittleEndianStream(s) + + kleft=s.ReadInt() + kright=s.ReadInt() + krotright=s.ReadInt() + krotleft=s.ReadInt() + kdrop=s.ReadInt() + kpause=s.ReadInt() + start_level=s.ReadInt() + hiscore=s.ReadInt() + + s.Close() + End Function + + Function Save() + Local s:TStream=WriteStream("hardwire.config") + + If s=Null + Return + EndIf + + s=LittleEndianStream(s) + + s.WriteInt(kleft) + s.WriteInt(kright) + s.WriteInt(krotright) + s.WriteInt(krotleft) + s.WriteInt(kdrop) + s.WriteInt(kpause) + s.WriteInt(start_level) + s.WriteInt(hiscore) + + s.Close() + End Function +EndType + +Type TEasyLink + Field l:TLink + + Function Create:TEasyLink(l:TList) + Local o:TEasyLink=New TEasyLink + o.l=l.FirstLink() + Return o + End Function + + Method Value:Object() + If l + Return l.Value() + Else + Return Null + EndIf + End Method + + Method MoveNext() + If l + l=l.NextLink() + EndIf + End Method + + Method Remove() + Local ol:TLink=l + MoveNext() + ol.Remove() + End Method +End Type + + +Type TMenuBdrop Extends TGfxMenuBackdrop + Field msg:String + Field msgp:Int + Field msgx:Int + Field msgy:Int + + Method New() + msg=" " + msg=" " + msg:+"Welcome to Hardwire. " + msg:+"Hardwire was written using BlitzMax -- http://www.blitzbasic.com/ -- and a variety of tools available at " + msg:+"http://www.noddybox.demon.co.uk/ Please feel free to forward this game to whoever you hate enough " + msg:+"to inflict this monstrosity upon. Enjoy. This game written under the influence of Slay Radio -- http://www.slayradio.org" + + msgx=0 + msgp=0 + msgy=560 + End Method + + Method Create:TGfxMenuBackdrop() + Return Self + End Method + + Method Update() + GameGFX.large.Draw(msg[..80],msgx,msgy) + + msgx:-2 + If msgx<-GameGFX.large.TextWidth(msg[0..1]) + msgx:+GameGFX.large.TextWidth(msg[0..1]) + msg=msg[1..]+msg[0..1] + EndIf + End Method +End Type + +Type TFadeScreen + Field a:Double + Field ai:Double + + Function Create:TFadeScreen(a:Double, ai:Double) + Local o:TFadeScreen=New TFadeScreen + o.a=a + o.ai=ai + Return o + End Function + + Function FadeOut:TFadeScreen() + Return Create(0,0.05) + End Function + + Function FadeIn:TFadeScreen() + Return Create(1,-0.05) + End Function + + Function DoFadeOut() + Local fade:TFadeScreen=TFadeScreen.FadeOut() + Local pm:TPixmap=GrabPixmap(0,0,GraphicsWidth(),GraphicsHeight()) + + While fade.Fade() + Cls + DrawPixmap(pm,0,0) + fade.Draw() + Flip + Wend + End Function + + Method Fade:Int() + a:+ai + Return a>0 And a<1 + End Method + + Method Draw() + Local r:Int,g:Int,b:Int + Local oa:Double=GetAlpha() + GetColor(r,g,b) + SetAlpha(a) + SetColor(0,0,0) + DrawRect(0,0,GraphicsWidth(),GraphicsHeight()) + SetColor(r,g,b) + SetAlpha(oa) + End Method +End Type + +Type TGameBackdropStar + Field x:Double + Field y:Double + Field dy:Double + Field r:Int + Field g:Int + Field b:Int + Field frame:Int + Field cnt:Int + + Method New() + x=Rnd(0,GraphicsWidth()) + y=Rnd(0,GraphicsHeight()) + dy=Rnd(0.1,2) + r=Rand(128,255) + g=Rand(128,255) + b=Rand(128,255) + frame=Rand(0,5) + cnt=5 + End Method + + Method Draw(anim:Int) + If anim + frame=(frame+1) Mod 6 + EndIf + + y:+dy + If y>GraphicsHeight()+8 + y=-8 + EndIf + SetColor(r,g,b) + DrawImage(GameGFX.bdropstar,x,y,frame) + End Method +End Type + + +Type TGameBackdrop + Field num:Int + Field star:TGameBackdropStar[] + Field cnt:Int + + Method New() + num=100 + star=New TGameBackdropStar[num] + cnt=5 + + For Local f:Int=0 Until num + star[f]=New TGameBackdropStar + Next + End Method + + Method Draw() + For Local f:Int=0 Until num + star[f].Draw(cnt=0) + Next + cnt:-1 + If cnt=-1 + cnt=5 + EndIf + End Method +End Type + + +Type Number + Function Format:String(num:Int) + Local c:Int=0 + Local ret:String="" + Local a:String=String.FromInt(num) + + For Local f:Int=a.length-1 To 0 Step -1 + If ret.length And (c Mod 3)=0 + ret=","+ret + EndIf + ret=a[f..f+1]+ret + c:+1 + Next + Return ret + End Function +End Type -- cgit v1.2.3