SuperStrict Framework brl.GLmax2d Import brl.Random Import brl.bmploader Graphics 1024, 768, 32, 75 SeedRnd MilliSecs() Const GenQ : Float = 1.05 Global LightingList : TList = New TList Global LImage : TImage = CreateImage(9, 1, 1, MipMappedImage | FilteredImage | dynamicimage) Local p : TPixmap = LockImage(LImage) RestoreData IData Local Color : Int For Local index : Int = 0 To 8 ReadData Color WritePixel p, index,0, color Next UnlockImage LImage SetImageHandle LImage, 5, 0 HideMouse Repeat If KeyHit(Key_Space) Or Rand(0,1000) < 7 Then NewLighting() EndIf SetAlpha 1 SetColor 255,255,255 UpdateLighting(5) SetBlend AlphaBlend SetAlpha 0.075 SetColor 0,0,0 SetRotation 0 SetScale 1,1 DrawRect 0,0,1024,768 Flip GCCollect() Until KeyHit(key_escape) End Type TLightingElement Field Width : Float Field Length : Float Field x : Float Field y : Float Field tx : Float Field ty : Float Field angle : Float Field Updateable : Byte = True Method Update() If self.Updateable Then self.updateable = False If self.y < 768 Then For Local index : Int = 0 To Floor(Rnd(0, GenQ)) Local e : TLightingElement = New TLightingElement e.x = self.tx e.y = self.ty e.width = self.width*0.98 e.tx = self.tx+Rnd(-25, 25) e.ty = self.ty + Rnd(15, 35) e.angle = ATan2(e.x-e.tx, e.ty-e.y) e.length = Sqr((e.x-e.tx)*(e.x-e.tx)+(e.ty-e.y)*(e.ty-e.y)) LightingList.AddLast(e) Next Else LightingList.clear() EndIf EndIf End Method Method Draw() SetRotation self.angle SetScale self.width*0.1, self.length DrawImage limage, self.x, self.y End Method End Type Function NewLighting() Local e : TLightingElement = New TLightingElement e.x = 512+Rnd(-100, 100) e.y = 0 e.width = Rnd(3, 7) e.tx = Rnd(-25, 25)+e.x e.ty = Rnd(15, 35) e.angle = ATan2(e.x-e.tx, e.ty-e.y) e.length = Sqr((e.x-e.tx)*(e.x-e.tx)+(e.ty-e.y)*(e.ty-e.y)) LightingList.AddLast(e) End Function Function UpdateLighting(steps : Int) For Local s : Int = 1 To steps Local c : Int = CountList(LightingList) Local d : Int = 0 For Local e : TLightingElement = EachIn LightingList d :+1 If d <= c Then e.Update() If s = steps Then e.Draw() EndIf Next Next End Function #IData DefData $FF000060 DefData $FF0000DA DefData $FF2A2AFF DefData $FFB3B3FF DefData $FFFFFFFF DefData $FFB3B3FF DefData $FF2A2AFF DefData $FF0000DA DefData $FF000060 |