_TITLE " *** Screen Saver #3 - Mystic Rectangles *** by bplus 2018-03-01" ' translated from
' Screen Saver #3 Mystic Rectangles.bas SmallBASIC 0.12.11 (B+=MGA) 2018-02-28
' instead of wire frame triangles try solid color rectangles
' arrays? we don't need no dang arrays!
' oh to share everything use GOSUBs instead of SUBs
nT = 150 'number of Things per screen
savex1 = x1: savey1 = y1: savedx1 = dx1: savedy1 = dy1
savex2 = x2: savey2 = y2: savedx2 = dx2: savedy2 = dy2
cN = nT
'reset color Number back to beginning + 1
cN = cN - nT + 1
'reset rect back to beginning and then update it once and save this for next round
x1 = savex1: y1 = savey1: dx1 = savedx1: dy1 = savedy1
x2 = savex2: y2 = savey2: dx2 = savedx2: dy2 = savedy2
savex1 = x1: savey1 = y1: savedx1 = dx1: savedy1 = dy1
savex2 = x2: savey2 = y2: savedx2 = dx2: savedy2 = dy2
LINE (x1
- 12, y1
- 7)-(x2
, y2
), , BF
'inverse image and color
xx1 = xmax - x1: yy1 = ymax - y1
xx2 = xmax - x2: yy2 = ymax - y2
LINE (xx1
- 12, yy1
- 7)-(xx2
, yy2
), invColor&&
, BF
newRect:
dx1
= (RND * 9 + 3) * rdir
dy1
= (RND * 5 + 2) * rdir
dx2
= (RND * 9 + 3) * rdir
dy2
= (RND * 5 + 2) * rdir
'keep x1, y1 the lesser corner and x2, y2 the greater
updateRect:
IF x1
+ dx1
< 0 THEN dx1
= -dx1
IF x1
+ dx1
> xmax
THEN dx1
= -dx1
x1 = x1 + dx1
IF y1
+ dy1
< 0 THEN dy1
= -dy1
IF y1
+ dy1
> ymax
THEN dy1
= -dy1
y1 = y1 + dy1
IF x2
+ dx2
< 0 THEN dx2
= -dx2
IF x2
+ dx2
> xmax
THEN dx2
= -dx2
x2 = x2 + dx2
IF y2
+ dy2
< 0 THEN dy2
= -dy2
IF y2
+ dy2
> ymax
THEN dy2
= -dy2
y2 = y2 + dy2
'keep x1, y1 the lesser corner and x2, y2 the greater
changePlasma:
cN = cN + 1
COLOR _RGB32(127 + 127 * SIN(pR
* .2 * cN
), 127 + 127 * SIN(pG
* .2 * cN
), 127 + 127 * SIN(pB
* .2 * cN
)) invColor&&
= _RGB32(255 - (127 + 127 * SIN(pR
* .2 * cN
)), 255 - (127 + 127 * SIN(pG
* .2 * cN
)), 255 - (127 + 17 * SIN(pB
* .2 * cN
)))
resetPlasma: