''Bouncing Polygon screensaver' by Brian Adriance at PSC txtCodeId=52063.
'
Option Explicit
Private Const PolyName As String = "PolygonIV"
Public lngTimer As Long
Private bDoingReset As Boolean
Public lngCol As Long
Public lngFat As Long
Public bLoadingList As Boolean
Public BSelecting As Boolean
Public Motion As Long
Public Spinner As Long
Public Const SettingHighSmall As Long = 4035
Public Const SettingHighLarge As Long = 7020
Public bRndCol As Boolean
Public VertMin As Long ' min = 1 a dot
Public VertMax As Long ' max = 20 could be higher but not likely to give visible differences
Public Type SPOLYGON
XCenter As Long
YCenter As Long
XVertex(1 To 21) As Long ' the upper range must maximum value for VertMax + 1
YVertex(1 To 21) As Long
DispX As Long
DispY As Long
Mass As Double
Angle As Double
RSpeed As Double
AngleR As Double
Color As Long
NVertex As Long
DispVector As Double
Displacement As Double
IncVert As Boolean
SpinC As Boolean
End Type
Public MSpeed As Long 'at very high speeds(2000+) some of the objects disappear as the distance between draws is so great that they spend most of the time off screen
Public SCount As Long 'no real limit but above about 250 (on a PII) the redraw cycle is too slow for good animation
Public SetMode As Long
Private Polygon() As SPOLYGON
Private Const PIDiv180 As Double = 3.14159265358979 / 180
Public Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long 'mouse visible(0 or 1)
Public Function AtBoundry(poly As SPOLYGON) As Boolean
'detect edge of screen
With poly
If .XCenter + (.Mass * 2 + lngFat * 1.5) >= Screen.Width Then