_TITLE "Prithak's Solor Mouse mod B+"
TYPE planetType
'all info needed to draw a planet
'setup solar center
'setup planets array
'load the planets array data
'' newPlanet (index, planetName$, distFromSun, radius, Kolr AS _UNSIGNED LONG)
newPlanet
0, "Sun", 0, 43, 1, _RGB32(255, 255, 160)newPlanet
1, "Mercury", 57.9, 2, 87.97, _RGB32(255, 120, 150)newPlanet
2, "Venus", 108.2, 4, 224.7, _RGB32(0, 200, 255)newPlanet
3, "Earth", 149.6, 4, 365.26, _RGB32(0, 50, 180)newPlanet
4, "Mars", 227.9, 2, 686.98, _RGB32(200, 0, 0)'DATA "Mercury",57.9,87.97 radius 1.5+ thousands of miles
'DATA "Venus",108.2,224.7 3.7
'DATA "Earth",149.6,365.26 3.9
'DATA "Mars",227.9,686.98 2.1
' 432 sun so take 10 x's less
'see SUB planetXY for locating the planet and SUB drawPlanet
'y1 = y - 100 'not used
mx = sunX
my = sunY
'DIM SHARED r, g, b
'CLS
days = days + 1
'FOR degreeAngle = 0 TO 360
'r = 135: g = 135: b = 79
'rotate x, y, i, 50
'r = 135: g = 79: b = 79
'rotate x, y, i, 100
'r = 100: g = 150: b = 255
'rotate x, y, i, 150
'r = 109: g = 43: b = 43
'CIRCLE (x, y), 20, _RGB32(255, 150, 100)
drawPlanet i
sunX = sunX - 1
sunX = sunX + 1
sunY = sunY - 1
sunY = sunY + 1
'NEXT
'SUB rotate (X, y, i, l)
' x2 = X + COS(_D2R(i)) * l
' y2 = y + SIN(_D2R(i)) * l / 2
' CIRCLE (x2, y2), 10, _RGB32(r, g, b)
'END SUB
SUB drawPlanet
(planetIndex
) planetXY planetIndex, setX, setY
CIRCLE (setX
, setY
), planets
(planetIndex
).radius
, planets
(planetIndex
).kolor
PAINT (setX
, setY
), planets
(planetIndex
).kolor
, planets
(planetIndex
).kolor
'load a planet's data in a single call
SUB newPlanet
(index
, planetName$
, distFromSun
, radius
, oneYearInEarthDays
, Kolr
AS _UNSIGNED LONG) 'all info needed to draw a planet planets(index).pName = planetName$
planets(index).distanceFromSun = distFromSun
planets(index).radius = radius
planets
(index
).oneDayAngleChange
= _PI(2) / oneYearInEarthDays
planets(index).kolor = Kolr
' locate the planets current position in relation to sun center
SUB planetXY
(planetIndex
, pX
, pY
) pX
= sunX
+ planets
(planetIndex
).distanceFromSun
* COS(days
* planets
(planetIndex
).oneDayAngleChange
) pY
= sunY
+ planets
(planetIndex
).distanceFromSun
* SIN(days
* planets
(planetIndex
).oneDayAngleChange
)