Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- Randomize , 1
- Const fpslimit = 100
- Const pi = 3.1415926535897
- Dim As Integer scrw = 800, scrh = 600
- Dim As UByte charh = 8, charw = 8
- ScreenRes scrw, scrh, 8
- Dim xcol As ubyte
- Dim ycol As Integer
- Dim As Double frameintv = 1.0 / fpslimit
- Dim As Integer sleepintv
- Dim As Double TimeStart
- '''''''''''''''''''''''''''''''''''''''''''''''''''''''''
- 'Set the pallete
- Do
- xcol += 1
- If xcol < 64 Then
- Palette xcol, 4*xcol, xcol, 0
- Else
- If xcol > 180 Then
- ycol = ycol + 3
- EndIf
- Palette xcol, 255, xcol, ycol
- EndIf
- Loop Until xcol = 255
- 'rotater var, and positioning the fps meter
- Dim x As UInteger
- Dim As Integer fpsx, fpsy
- 'fps coutner stuff
- Dim As Integer fps, fps2, seconds
- Dim As double starttime
- 'Spinning dot vars
- Dim As Integer radius = 80
- Dim As Double OldX, OldY, Angle = (-11 * .017453)
- Dim As Double XX, YY = radius
- Dim As Integer VX = (scrw / 2), VY = (scrh / 2)
- 'filter vars
- Dim As Integer filter(scrw,scrh), flx, fly, flz, newcolor
- 'Put the fps in the corner
- fpsx = (scrw - Len(Str(fps2))*charw) - 10
- fpsy = (scrh - charh) - 10
- 'Random line at bottom
- Dim liner As Integer
- ''''' DO '''''
- Do
- 'Lay the timer start
- TimeStart = Timer
- 'Get ready to draw!
- ScreenLock
- '' Lets spin a dot!
- ' If I want to spin a dot 360* per second, and there are 30
- ' frames in a second, then I need to move 360 / 30 degrees per frame
- ' radians = degrees * pi / 180
- ' degrees = radians * 180 / pi
- OldX = XX
- OldY = YY
- XX = (OldX * Cos(Angle)) + (OldY * Sin(Angle))
- YY = (OldY * Cos(Angle)) - (OldX * Sin(Angle))
- Circle(XX + VX, YY + VY), 5, 255
- 'Some dots for flavor
- For liner = 1 To scrw
- PSet(liner, scrh-1), (Rnd * 255)
- Next
- ''' Filter time! '''
- 'Dim As Integer filter(scrw,scrh), flx, fly, flz, newcolor'
- For flx = 1 To scrw
- For fly = 1 To scrh
- If (fly > scrh-2) Then
- newcolor = 0
- filter(flx, fly) = newcolor
- Else
- newcolor = (Point(flx, fly + 1) + Point(flx + 1, fly + 1) + _
- Point(flx - 1, fly + 1) + Point(flx, fly + 2)) / 5
- filter(flx, fly) = newcolor
- EndIf
- Next
- Next
- For flx = 1 To scrw
- For fly = 1 To scrh
- PSet(flx, fly), filter(flx, fly)
- Next
- Next
- 'draw the FPS
- Draw String (fpsx, fpsy), Str(fps2 - 1), 255
- ScreenUnLock
- 'Adjust our time per frame to 1 / fpslimit
- sleepintv = CInt((TimeStart + frameintv - Timer)*1000.0)
- If sleepintv > 1 Then
- Sleep sleepintv
- Else
- 'memory usage!
- Sleep 1
- EndIf
- 'Calculate actual FPS
- fps += 1
- If starttime + 1 < Timer Then
- fps2 = fps
- fps = 0
- seconds += 1
- starttime = Timer
- EndIf
- Loop Until Inkey <> ""
- End
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement