RetroBASIC ReadOnly Archive
_TITLE "For Memorial Day" 'trans 2019-05-27 B+ from'For Memorial Day.txt for Just Basic v1.01 [B+=MGA] 2016-05-29' plus ad liberty' 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 7CONST XMAX = 1235 '<=== actual drawing space neededCONST YMAX = 650 '<=== actual drawing space neededCONST PI = _PICONST DEG = 180 / PICONST RAD = PI / 180CONST White = &HFFFFFFFF'https://www.google.com/search?client=opera&q=US+flag+blue+spec&sourceid=opera&ie=UTF-8&oe=UTF-8CONST OldGloryRed = &HFFBF0A30CONST OldGloryBlue = &HFF002868SCREEN _NEWIMAGE(XMAX, YMAX, 32)_SCREENMOVE 100, 50LINE (0, 0)-(XMAX, YMAX), OldGloryRed, BFFOR row = 1 TO 12 STEP 2 LINE (0, row * 50 - b)-(XMAX, (row + 1) * 50 + b), White, BFNEXT'the "Union"LINE (0, 0)-(494, 350), OldGloryBlue, BFFOR 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 IFNEXT_DISPLAYSLEEPSUB 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, WhiteEND SUBSUB ftri (x1, y1, x2, y2, x3, y3, K AS _UNSIGNED LONG) a& = _NEWIMAGE(1, 1, 32) _DEST a& PSET (0, 0), K _DEST 0 _MAPTRIANGLE _SEAMLESS(0, 0)-(0, 0)-(0, 0), a& TO(x1, y1)-(x2, y2)-(x3, y3) _FREEIMAGE a& '<<< this is important!END SUB