05-30-2022, 01:41 PM
For Memorial Day
Code: (Select All)
_Title "For Memorial Day mod x3" 'trans 2019-05-29 B+ from wave mod2x
'For Memorial Day.txt for Just Basic v1.01 [B+=MGA] 2016-05-29
' plus ad lib
' notes: American Flag close to proportion standards
'
' verticals:
' Hoist Flag = 1.0 vertical height use 650 pixels because divided by 13 = 50 each stripe
'Hoist Union = 7/13 = 350
' stripe = 1/13 = 50
' star space = .054 = 350/(10 spaces) = 35 pixels 35/650 ~ .5385
'
' horizontals:
' Fly Flag length = 1.9 = 650 * 1.9 = 1235
' Fly Union length = .76 = 650 * .76 = 494
' star space = .063 494/(12 spaces) ~ 41.167 using 41 * 12 = 492 add 1 pixel before and after stars
'star outer diameter = .0616 * 650 ~ 40 (40.04) so outer radius is 20
' and inner (20 / 2.5) = 8 < does not look right try 7
Const xMaxScreen = 1280
Const yMaxScreen = 780
Const xMaxFlag = 1235 '<=== actual drawing space needed
Const yMaxFlag = 650 '<=== actual drawing space needed
Const PI = _Pi
Const DEG = 180 / PI
Const RAD = PI / 180
Const White = &HFFFFFFFF
'https://www.google.com/search?client=opera&q=US+flag+blue+spec&sourceid=opera&ie=UTF-8&oe=UTF-8
Const OldGloryRed = &HFFBF0A30
Const OldGloryBlue = &HFF002868
Const Sky& = &H2F40A0FF
Dim Shared Flag As Long, p
Screen _NewImage(xMaxScreen, yMaxScreen, 32)
Flag = _NewImage(xMaxFlag, yMaxFlag, 32)
_ScreenMove 70, 0
_Dest Flag
Line (0, 0)-(xMaxFlag, yMaxFlag), OldGloryRed, BF
For row = 1 To 12 Step 2
Line (0, row * 50)-(xMaxFlag - 1, (row + 1) * 50 - 1), White, BF
Next
'the "Union"
Line (0, 0)-(494, 350), OldGloryBlue, BF
For row = 1 To 9
ystar = 35 * row
If row Mod 2 = 1 Then
For col = 0 To 5
xstar = 42 + col * 2 * 41
star xstar, ystar, 7.5, 19.5, 5, 18, White
Next
Else
For col = 0 To 4
xstar = 83 + col * 2 * 41
star xstar, ystar, 7.5, 19.5, 5, 18, White
Next
End If
Next
_Dest 0
_Source Flag
Color Sky, Sky
_SetAlpha 150, &H00000000 To &HFFFFFFFF, Flag
Do
Line (0, 0)-(xMaxScreen, yMaxScreen), Sky, BF
sc = Rnd * yMaxFlag * .5 + 10
rw = sc * 1.9
rh = sc
_PutImage (Rnd * xMaxScreen - .5 * rw, Rnd * (yMaxScreen) - .5 * rh)-Step(rw, rh), Flag, 0
_Display
_Limit 2
Loop
Sub star (x, y, rInner, rOuter, nPoints, angleOffset, K As _Unsigned Long)
' x, y are same as for circle,
' rInner is center circle radius
' rOuter is the outer most point of star
' nPoints is the number of points,
' angleOffset = angle offset IN DEGREES, it will be converted to radians in sub
' this is to allow us to spin the polygon of n sides
pAngle = RAD * (360 / nPoints): radAngleOffset = RAD * angleOffset
x1 = x + rInner * Cos(radAngleOffset)
y1 = y + rInner * Sin(radAngleOffset)
For i = 0 To nPoints - 1
x2 = x + rOuter * Cos(i * pAngle + radAngleOffset + .5 * pAngle)
y2 = y + rOuter * Sin(i * pAngle + radAngleOffset + .5 * pAngle)
x3 = x + rInner * Cos((i + 1) * pAngle + radAngleOffset)
y3 = y + rInner * Sin((i + 1) * pAngle + radAngleOffset)
ftri x1, y1, x2, y2, x3, y3, K
'triangles leaked
Line (x1, y1)-(x2, y2), White
Line (x2, y2)-(x3, y3), White
Line (x3, y3)-(x1, y1), White
x1 = x3: y1 = y3
Next
Paint (x, y), White, White
End Sub
Sub ftri (x1, y1, x2, y2, x3, y3, K As _Unsigned Long)
a& = _NewImage(1, 1, 32)
predest = _Dest
_Dest a&
PSet (0, 0), K
_Dest predest
_MapTriangle _Seamless(0, 0)-(0, 0)-(0, 0), a& To(x1, y1)-(x2, y2)-(x3, y3)
_FreeImage a& '<<< this is important!
End Sub
b = b + ...