Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - B+

Pages: [1] 2 3 ... 34
1
Code and examples / Re: Text search
« on: 20. May 2018, 19:34:23 »
Rick, JJ cool application!

Thanks JJ

2
Code and examples / Re: Text search
« on: 28. April 2018, 16:54:00 »
Quote
jrs@jrs-laptop:~/sb/examples/test$ ls -l warpeace.txt
-rw-rw-r-- 1 jrs jrs 3202941 Aug 29  2017 warpeace.txt
jrs@jrs-laptop:~/sb/examples/test$ tail -n 20 results.findit
[062743] flight from it, the death of Prince Andrew, Natasha's despair, Petya's
[062871] At the beginning of winter Princess Mary came to Moscow. From
[062876] "I never expected anything else of him," said Princess Mary to
[062951] by Nicholas, Princess Mary confessed to herself that she had been
[062999] "Good-by, Princess!" said he.
[063012] "Yes, Princess," said Nicholas at last with a sad smile, "it doesn't
[063042] why. "Thank you, Princess," he added softly. "Sometimes it is hard."
[063044] "So that's why! That's why!" a voice whispered in Princess Mary's
[063065] "Princess, for God's sake!" he exclaimed, trying to stop her.
[063066] "Princess!"
[063079] In the winter of 1813 Nicholas married Princess Mary and moved to
[063313] and Sonya, blaming himself and commending her. He had asked Princess
[063649] when she and Countess Mary spoke of Prince Andrew (she never mentioned
[063650] him to her husband, who she imagined was jealous of Prince Andrew's
[063837] Rostovs he had received a letter from Prince Theodore, asking him to
[063962] "And have you talked everything well over with Prince Theodore?" she
[064250] questions as to whether Prince Vasili had aged and whether Countess
[064297] translate things into his mother's language, "Prince Alexander
[064305] "Well, and how is Prince Alexander to blame? He is a most
[064479] his brows. "Prince Theodore and all those. To encourage culture and
jrs@jrs-laptop:~/sb/examples/test$

Here is searching John's text for word Prince:
Code: [Select]
REM SmallBASIC Search Text File by B+
REM created: 28/04/2018

tload "Johns Prince Search.txt", flines
for i in flines
  if instr(i, "Prince ") then ? i
next

3
Community news and announcements / Re: Conforums closing down
« on: 26. April 2018, 17:21:41 »
Dang! Richard now too!  :'(

Man I liked that guy allot! Very knowledgeable and helpful, also true a little cranky and technical but with people you have to take the less-than-great with the great.

Hey! Maybe he has some time now for here?  ;)



4
Code and examples / Re: Binary ASCII fractal
« on: 21. April 2018, 23:54:07 »
Code: [Select]
'quick test.bas for SmallBASIC 0.12.12 by bplus 2018-04-21"
'yes, we didi this before, I have a file dated 2016-09-21 for asc mandelbrot
'here is a mod of that

for y = -35 to 35
  for x = -10 to 89
    m = 0 : r = 0
    for k = 1 to 113
      j = r^2 - m^2 - 2 + x/25
      m = 2*r*m + y/25
      r = j
      l = k & 15
      if j^2 + m^2 > 11 then k=114
    next
    color 16-l, 0
    text (x + 10)*8, (y + 35)*8, 8, rnd*2\1
  next
next
pause

sub text(x, y, size, s) ' a sub to make translating to SmallBASIC from SdlBasic easier
  'when this sub is used text size is altered for the rest of the run
  local l
  l.w = window() : l.w.setfont(size, "pt", 0, 0)
  at x, y : ? s
  showpage
end

Edit: oops did not need ? = print between two loops using sub text.

5
Code and examples / Sierpinski Circled
« on: 04. April 2018, 23:59:47 »
Code: [Select]
A new twist on an old fractal. Sierpinski triangle generalized and made dynamic for any regular poly though does not work well beyond 8 or 9.
[c_TITLE "Sierepinski Circled by bplus 2018-04-04 QB64 v 11-06-2017"
CONST xmax = 800
CONST ymax = 600
RANDOMIZE TIMER
SCREEN _NEWIMAGE(xmax, ymax, 32)
_SCREENMOVE 360, 60
FOR n = 3 TO 8
    a = 0
    COLOR _RGBA((RND * 155 + 100) * INT(RND * 2), RND * 155 + 100, (RND * 155 + 100) * INT(RND * 2), 40)
    WHILE a < _PI(2) - _PI(1 / 360)
        CLS
        a = a + _PI(1 / 360)
        levels = 9 - n + 3
        RecurringCircles xmax / 2, ymax / 2, ymax / 8, n, a, levels
        _DISPLAY
        _LIMIT 200
    WEND
    _DELAY 5
NEXT
SUB RecurringCircles (x, y, r, n, rao, level)
    fcirc x, y, r
    IF level > 0 THEN
        ra = _PI(2) / n
        FOR i = 0 TO n - 1
            x1 = x + 1.5 * r * COS(i * ra + rao + _PI(-.5))
            y1 = y + 1.5 * r * SIN(i * ra + rao + _PI(-.5))
            RecurringCircles x1, y1, r * .5, n, 2 * rao, level - 1
        NEXT
    END IF
END SUB

'Steve McNeil's  copied from his forum   note: Radius is too common a name
SUB fcirc (CX AS LONG, CY AS LONG, R AS LONG)
    DIM subRadius AS LONG, RadiusError AS LONG
    DIM X AS LONG, Y AS LONG

    subRadius = ABS(R)
    RadiusError = -subRadius
    X = subRadius
    Y = 0

    IF subRadius = 0 THEN PSET (CX, CY): EXIT SUB

    ' Draw the middle span here so we don't draw it twice in the main loop,
    ' which would be a problem with blending turned on.
    LINE (CX - X, CY)-(CX + X, CY), , BF

    WHILE X > Y
        RadiusError = RadiusError + Y * 2 + 1
        IF RadiusError >= 0 THEN
            IF X <> Y + 1 THEN
                LINE (CX - Y, CY - X)-(CX + Y, CY - X), , BF
                LINE (CX - Y, CY + X)-(CX + Y, CY + X), , BF
            END IF
            X = X - 1
            RadiusError = RadiusError - X * 2
        END IF
        Y = Y + 1
        LINE (CX - X, CY - Y)-(CX + X, CY - Y), , BF
        LINE (CX - X, CY + Y)-(CX + X, CY + Y), , BF
    WEND
END SUB

ode]


The screen shots are still shots of final positions (or start).

6
Community news and announcements / Re: Conforums closing down
« on: 02. April 2018, 18:10:58 »
THERE IT IS!  (How come I couldn't access it before?)

7
Community news and announcements / Re: Conforums closing down
« on: 31. March 2018, 14:23:02 »
And new proboard site for Just Basic:
http://justbasiccom.proboards.com

8
Community news and announcements / Re: Conforums closing down
« on: 30. March 2018, 20:11:44 »
huh?

9
Community news and announcements / Re: Conforums closing down
« on: 30. March 2018, 18:24:26 »
Well I see Liberty has found a new home already:
http://libertybasiccom.proboards.com

sorry to see that it is proboards though.
http://retrogamecoding.org/board/index.php?topic=597.0

I add this to my list of complaints with proboards:
http://qb64.freeforums.net/thread/84/bouncing

On the PLUS side, with proboards you can post screen shots!

10
Article about moving to github:
https://smallbasic.sourceforge.io/?q=node/1784

Checkout the new site:
http://smallbasic.github.io/

11
Code and examples / Re: Only for fun
« on: 26. March 2018, 16:51:38 »
Yeah Peter, another gif gift!  :)

12
Code and examples / Re: Goldwave
« on: 26. March 2018, 16:50:37 »
Hey Johnno!

Here are some QB64 guys playing around with this and similar code:
https://www.qb64.org/forum/index.php?topic=179.0

13
Code and examples / Re: Happy St Patrick's Day
« on: 10. March 2018, 12:36:41 »
A Shamrock Slot Machine: How many Shamrocks will it take to get a 7 leafed one with 1 in 625 chance?
Code: [Select]
' Shamrock Luck.bas SmallBASIC 0.12.11 (B+=MGA) 2018-03-10
' from: QB64 version of Shamrock 2018-03-09.bas
' lessons learned with JB version 2018-03-09 tsh tips
' from N Leafed Shamrocks 2018-03-08
' Draw Angled Heart.bas SmallBASIC 0.12.11 (b+=mga) 2018-03-07
randomize timer
dim counts(7)
color 15, rgb(60, 30, 15)
cls
while nLeafs < 7
   luck = rnd
   if luck < 1 / 625 then
      nLeafs = 7
   elif luck < 1 / 125 then
      nLeafs = 6
   elif luck < 1 / 25
      nLeafs = 5
   elif luck < 1 / 5
      nLeafs = 4
   else
      nLeafs = 3
   fi
   counts(nLeafs) = counts(nLeafs) + 1
   counts(1) = counts(1) + 1
   stat$ = str$(counts(3))
   for i = 4 to 7
      stat$ = stat$ + " : " + str$(counts(i))
   next
   stat$ = stat$ + " = " + str$(counts(1))
   cc1 = rnd * 100 + 50
   cc2 = rnd * 100 + 50
   while abs(cc1 - cc2) < 30 'for contrast of 2 colors
      cc2 = rnd * 100 + 50
   wend
   xp = rnd * (xmax - 100) + 50
   yp = rnd * (ymax - 100) + 50
   size = int(rnd * 40) + 10
   ang = rnd * pi * 2
   color rgb(0, cc1, 0)
   drawShamrockN xp + 1, yp, size, ang, nLeafs, 1
   color rgb(0, cc2, 0)
   for r = 1 to size
      drawShamrockN xp, yp, r, ang, nLeafs, 0
   next
   color 15
   at 1, 1 : ? stat$ + " N Leafed Shamrocks, 1 in 625 chance for 7 Leafed Shamrock.
   showpage
   delay 10
wend
pause

sub drawHeart (x, y, r, rl, a, solid)
  local x1, x2, x3, x4, x5, x6, y1, y2, y3, y4, y5, y6
  'clockwise from due east, the v
  x1 = x + r * cos(a)
  y1 = y + r * sin(a)
  x2 = x + rl * cos(a + pi / 2)
  y2 = y + rl * sin(a + pi / 2)
  x3 = x + r * cos(a + pi)
  y3 = y + r * sin(a + pi)
  x4 = x + r * cos(a + 3 * pi / 2)
  y4 = y + r * sin(a + 3 * pi / 2)
  x5 = (x3 + x4) / 2
  y5 = (y3 + y4) / 2
  x6 = (x4 + x1) / 2
  y6 = (y4 + y1) / 2
  if solid then
    drawpoly [x1, y1, x2, y2, x3, y3, x4, y4, x1, y1] filled
    circle x5, y5, .5 * r * 2 ^ .5 filled
    circle x6, y6, .5 * r * 2 ^ .5 filled
  else
    line x1, y1, x2, y2
    line x2, y2, x3, y3
    'left hump
    myArc x5, y5, .5 * r * 2 ^ .5, deg(a) + 135, 180
    'right hump
    myArc x6, y6, .5 * r * 2 ^ .5, deg(a) + 235, 180
  end if
end sub

sub drawShamrockN (x, y, r, a, nleafed, solid)
  local bigr, leaf, x1, y1
  bigr = 2.11 * r * nleafed / (2 * pi)
  for leaf = 0 to nleafed - 1
    x1 = x + bigr * cos(a + leaf * 2 * pi / nleafed + 3 * pi / 2)
    y1 = y + bigr * sin(a + leaf * 2 * pi / nleafed + 3 * pi / 2)
    drawHeart x1, y1, r, bigr, a + leaf * 2 * pi / nleafed, solid
  next
end sub

'draws an arc with center at xCenter, yCenter, radius from center is arcRadius
sub myArc( xCenter, yCenter, arcRadius, dAStart, dAMeasure)
   'notes:
   'you may want to adjust size and color for line drawing
   'using angle measures in degrees to match Just Basic ways with pie and piefilled
   'this sub assumes drawing in a CW direction if dAMeasure positive

   'for Just Basic angle 0 degrees is due East and angle increases clockwise towards South

   'dAStart is degrees to start Angle, due East is 0 degrees

   'dAMeasure is degrees added (Clockwise) to dAstart for end of arc

   rAngleStart = RAD(dAStart)
   rAngleEnd = RAD(dAMeasure) + rAngleStart
   Stepper = RAD(1/(.1 * arcRadius)) 'fixed
   for rAngle = rAngleStart to rAngleEnd step Stepper
       if rAngle = rAngleStart then
           lastX = xCenter + arcRadius * cos(rAngle)
           lastY = yCenter + arcRadius * sin(rAngle)
       else
           nextX = xCenter + arcRadius * cos(rAngle)
           if nextX <= lastX then useX = nextX -1 else useX = nextX + 1
           nextY = yCenter + arcRadius * sin(rAngle)
           if nextY <= lastY then useY = nextY -1 else useY = nextY + 1
           line lastX, lastY, nextX, nextY
           lastX = nextX
           lastY = nextY
       end if
   next
end sub


SmallBASIC has an arc sub but the handmade one draws better lines here.

14
Code and examples / Happy St Patrick's Day
« on: 07. March 2018, 20:56:47 »
SmallBASIC version
Code: [Select]
' Draw Angled Heart.bas SmallBASIC 0.12.11 (B+=MGA) 2018-03-07

while 1
  cc1 = rgb(0, rnd*100 +50, 0)
  cc2 = rgb(0, rnd*100 +50, 0)
  xp = rnd * xmax
  yp = rnd * ymax
  size = int(rnd*100) + 10
  ang = rnd*2*pi
  color cc1
  for r = 1 to size
    drawShamrock xp+1, yp, r, ang
    drawShamrock xp-1, yp, r, ang
    drawShamrock xp, yp+1, r, ang
    drawShamrock xp, yp-1, r, ang
    drawShamrock xp+1, yp+1, r, ang
  next
  color cc2
  for r = 1 to size
    drawShamrock xp, yp, r, ang
  next
  showpage
  delay 10
wend
pause

'draws an arc with center at xCenter, yCenter, radius from center is arcRadius
sub myArc( xCenter, yCenter, arcRadius, dAStart, dAMeasure)
    'notes:
    'you may want to adjust size and color for line drawing
    'using angle measures in degrees to match Just Basic ways with pie and piefilled
    'this sub assumes drawing in a CW direction if dAMeasure positive

    'for Just Basic angle 0 degrees is due East and angle increases clockwise towards South

    'dAStart is degrees to start Angle, due East is 0 degrees

    'dAMeasure is degrees added (Clockwise) to dAstart for end of arc

    rAngleStart = RAD(dAStart)
    rAngleEnd = RAD(dAMeasure) + rAngleStart
    Stepper = RAD(1/(.1 * arcRadius)) 'fixed
    for rAngle = rAngleStart to rAngleEnd step Stepper
        if rAngle = rAngleStart then
            lastX = xCenter + arcRadius * cos(rAngle)
            lastY = yCenter + arcRadius * sin(rAngle)
        else
            nextX = xCenter + arcRadius * cos(rAngle)
            if nextX <= lastX then useX = nextX -1 else useX = nextX + 1
            nextY = yCenter + arcRadius * sin(rAngle)
            if nextY <= lastY then useY = nextY -1 else useY = nextY + 1
            line lastX, lastY, nextX, nextY
            lastX = nextX
            lastY = nextY
        end if
    next
end sub

sub drawHeart( x, y, r, a)
  local x1, x2, x3, x4, x5, x6, y1, y2, y3, y4, y5, y6
  'clockwise from due East, the V
  x1 = x + r * cos(a)
  y1 = y + r * sin(a)
  x2 = x + r * cos(a + pi/2)
  y2 = y + r * sin(a + pi/2)
  x3 = x + r * cos(a + pi)
  y3 = y + r * sin(a + pi)
  x4 = x + r * cos(a + 3*pi/2)
  y4 = y + r * sin(a + 3*pi/2)
  x5 = (x3 + x4)/2
  y5 = (y3 + y4)/2
  x6 = (x4 + x1)/2
  y6 = (y4 + y1)/2
  line x1, y1, x2, y2
  line x2, y2, x3, y3
  'left hump
  myArc x5, y5, .5 * r * 2 ^ .5, deg(a) + 135, 180
  'right hump
  myArc x6, y6, .5 * r * 2 ^ .5, deg(a) + 225, 180
end sub

sub drawShamrock(x, y, r, a)
  local x1, x2, x3, y1, y2, y3
  x1 = x + r * cos(a + 3*pi/2)
  y1 = y + r * sin(a + 3*pi/2)
  x2 = x + r * cos(a + pi/6)
  y2 = y + r * sin(a + pi/6)
  x3 = x + r * cos(a + 5*pi/6)
  y3 = y + r * sin(a + 5*pi/6)
  drawHeart x1, y1, r, a
  drawHeart x2, y2, r, a + 2*pi/3
  drawHeart x3, y3, r, a + 4*pi/3
end sub

QB version
Code: [Select]
_TITLE "Happy St Patrick's Day by bplus 2018-03-07"
' from
' Draw Angled Heart.bas SmallBASIC 0.12.11 (B+=MGA) 2018-03-07
CONST xmax = 1280
CONST ymax = 760
SCREEN _NEWIMAGE(xmax, ymax, 32)
_SCREENMOVE 70, 0


WHILE 1
    cc1&& = _RGB32(0, RND * 100 + 50, 0)
    cc2&& = _RGB32(0, RND * 100 + 50, 0)
    xp = RND * xmax
    yp = RND * ymax
    size = INT(RND * 100) + 10
    ang = RND * _PI(2)
    COLOR cc1&&
    FOR r = 1 TO size
        drawShamrock xp + 1, yp, r, ang
        drawShamrock xp - 1, yp, r, ang
        drawShamrock xp, yp + 1, r, ang
        drawShamrock xp, yp - 1, r, ang
        drawShamrock xp + 1, yp + 1, r, ang
    NEXT
    COLOR cc2&&
    FOR r = 1 TO size
        drawShamrock xp, yp, r, ang
    NEXT
    _DISPLAY
    _LIMIT 20
WEND


'draws an arc with center at xCenter, yCenter, radius from center is arcRadius
SUB myArc (xCenter, yCenter, arcRadius, dAStart, dAMeasure)
    'notes:
    'you may want to adjust size and color for line drawing
    'using angle measures in degrees to match Just Basic ways with pie and piefilled
    'this sub assumes drawing in a CW direction if dAMeasure positive

    'for Just Basic angle 0 degrees is due East and angle increases clockwise towards South

    'dAStart is degrees to start Angle, due East is 0 degrees

    'dAMeasure is degrees added (Clockwise) to dAstart for end of arc

    rAngleStart = RAD(dAStart)
    rAngleEnd = RAD(dAMeasure) + rAngleStart
    Stepper = RAD(1 / (.1 * arcRadius)) 'fixed
    FOR rAngle = rAngleStart TO rAngleEnd STEP Stepper
        IF rAngle = rAngleStart THEN
            lastX = xCenter + arcRadius * COS(rAngle)
            lastY = yCenter + arcRadius * SIN(rAngle)
        ELSE
            nextX = xCenter + arcRadius * COS(rAngle)
            IF nextX <= lastX THEN useX = nextX - 1 ELSE useX = nextX + 1
            nextY = yCenter + arcRadius * SIN(rAngle)
            IF nextY <= lastY THEN useY = nextY - 1 ELSE useY = nextY + 1
            LINE (lastX, lastY)-(nextX, nextY)
            lastX = nextX
            lastY = nextY
        END IF
    NEXT
END SUB

SUB drawHeart (x, y, r, a)
    'local x1, x2, x3, x4, x5, x6, y1, y2, y3, y4, y5, y6
    'clockwise from due East, the V
    x1 = x + r * COS(a)
    y1 = y + r * SIN(a)
    x2 = x + r * COS(a + _PI(1 / 2))
    y2 = y + r * SIN(a + _PI(1 / 2))
    x3 = x + r * COS(a + _PI)
    y3 = y + r * SIN(a + _PI)
    x4 = x + r * COS(a + 3 * _PI / 2)
    y4 = y + r * SIN(a + 3 * _PI / 2)
    x5 = (x3 + x4) / 2
    y5 = (y3 + y4) / 2
    x6 = (x4 + x1) / 2
    y6 = (y4 + y1) / 2
    LINE (x1, y1)-(x2, y2)
    LINE (x2, y2)-(x3, y3)
    'left hump
    myArc x5, y5, .5 * r * 2 ^ .5, DEG(a) + 135, 180
    'right hump
    myArc x6, y6, .5 * r * 2 ^ .5, DEG(a) + 225, 180
END SUB

SUB drawShamrock (x, y, r, a)
    'local x1, x2, x3, y1, y2, y3
    x1 = x + r * COS(a + 3 * _PI / 2)
    y1 = y + r * SIN(a + 3 * _PI / 2)
    x2 = x + r * COS(a + _PI / 6)
    y2 = y + r * SIN(a + _PI / 6)
    x3 = x + r * COS(a + 5 * _PI / 6)
    y3 = y + r * SIN(a + 5 * _PI / 6)
    drawHeart x1, y1, r, a
    drawHeart x2, y2, r, a + 2 * _PI / 3
    drawHeart x3, y3, r, a + 4 * _PI / 3
END SUB

FUNCTION RAD (a)
    RAD = _PI(a / 180)
END FUNCTION

FUNCTION DEG (a)
    DEG = a * 180 / _PI
END FUNCTION

JB version
Code: [Select]
'from QB64
' _TITLE "Happy St Patrick's Day by bplus 2018-03-07"
' from
' Draw Angled Heart.bas SmallBASIC 0.12.11 (B+=MGA) 2018-03-07

global H$, XMAX, YMAX, PI, DEG, RAD
H$ = "gr"
XMAX = 1200 '<======================================== actual drawing space needed
YMAX = 720 '<======================================== actual drawing space needed
PI = acs(-1)
DEG = 180 / PI
RAD = PI / 180

nomainwin

WindowWidth = XMAX + 8
WindowHeight = YMAX + 32
UpperLeftX = (1200 - XMAX) / 2  'or delete if XMAX is 1200 or above
UpperLeftY = (720 - YMAX) / 2   'or delete if YMAX is 700 or above

open "     Happy St Patrick's Day by bplus 2018-03-07" for graphics_nsb_nf as #gr
#gr "setfocus"
#gr "trapclose quit"
#gr "down"
#gr "size 2"

WHILE 1
    scan
    cc1 = RND(0) * 100 + 50
    cc2 = RND(0) * 100 + 50
    xp = RND(0) * XMAX
    yp = RND(0) * YMAX
    sz = INT(RND(0) * 40) + 10
    ang = RND(0) * PI*2
    #gr "size 2"
    call fore 0, cc1, 0
    FOR r = 1 TO sz
        scan
        call drawShamrock xp +1, yp, r, ang
        'call drawShamrock xp - 1, yp, r, ang
        'call drawShamrock xp, yp + 1, r, ang
        'call drawShamrock xp, yp - 1, r, ang
        'call drawShamrock xp + 1, yp + 1, r, ang
    NEXT
    #gr "size 1"
    call fore 0, cc2, 0
    FOR r = 1 TO sz
        scan
        call drawShamrock xp, yp, r, ang
    NEXT
WEND
wait

sub fore r, g, b
    #gr "color ";r;" ";g;" ";b
end sub

sub aline x0, y0, x1, y1
    #gr "line ";x0;" ";y0;" ";x1;" ";y1  'add 1 to end point
end sub

'Need line: #gr "trapclose quit"
sub quit H$
    close #H$ '<=== this needs Global H$ = "gr"
    end       'Thanks Facundo, close graphic wo error
end sub

'draws an arc with center at xCenter, yCenter, radius from center is arcRadius
sub arc xCenter, yCenter, arcRadius, dAStart, dAMeasure
    'notes:
    'you may want to adjust size and color for line drawing
    'using angle measures in degrees to match Just Basic ways with pie and piefilled
    'this sub assumes drawing in a CW direction if dAMeasure positive

    'for Just Basic angle 0 degrees is due East and angle increases clockwise towards South

    'dAStart is degrees to start Angle, due East is 0 degrees

    'dAMeasure is degrees added (Clockwise) to dAstart for end of arc

    rAngleStart = RAD * dAStart
    rAngleEnd = RAD * dAMeasure + rAngleStart
    Stepper = RAD / (.1 * arcRadius) 'fixed
    for rAngle = rAngleStart to rAngleEnd step Stepper
        if rAngle = rAngleStart then
            lastX = xCenter + arcRadius * cos(rAngle)
            lastY = yCenter + arcRadius * sin(rAngle)
        else
            nextX = xCenter + arcRadius * cos(rAngle)
            if nextX <= lastX then useX = nextX -1 else useX = nextX + 1
            nextY = yCenter + arcRadius * sin(rAngle)
            if nextY <= lastY then useY = nextY -1 else useY = nextY + 1
            #gr "line ";lastX;" ";lastY;" ";nextX;" ";nextY
            lastX = nextX
            lastY = nextY
        end if
    next
end sub

SUB drawHeart x, y, r, a
    scan
    'local x1, x2, x3, x4, x5, x6, y1, y2, y3, y4, y5, y6
    'clockwise from due East, the V
    x1 = x + r * COS(a)
    y1 = y + r * SIN(a)
    x2 = x + r * COS(a + PI / 2)
    y2 = y + r * SIN(a + PI / 2)
    x3 = x + r * COS(a + PI)
    y3 = y + r * SIN(a + PI)
    x4 = x + r * COS(a + 3 * PI / 2)
    y4 = y + r * SIN(a + 3 * PI / 2)
    x5 = (x3 + x4) / 2
    y5 = (y3 + y4) / 2
    x6 = (x4 + x1) / 2
    y6 = (y4 + y1) / 2
    #gr "line ";x1;" ";y1;" ";x2;" ";y2
    #gr "line ";x2;" ";y2;" ";x3;" ";y3
    'left hump
    call arc x5, y5, .5 * r * 2 ^ .5, DEG*a + 135, 180
    'right hump
    call arc x6, y6, .5 * r * 2 ^ .5, DEG*a + 225, 180
END SUB

SUB drawShamrock x, y, r, a
    'local x1, x2, x3, y1, y2, y3
    scan
    x1 = x + r * COS(a + 3 * PI / 2)
    y1 = y + r * SIN(a + 3 * PI / 2)
    x2 = x + r * COS(a + PI / 6)
    y2 = y + r * SIN(a + PI / 6)
    x3 = x + r * COS(a + 5 * PI / 6)
    y3 = y + r * SIN(a + 5 * PI / 6)
    call drawHeart x1, y1, r, a
    call drawHeart x2, y2, r, a + 2 * PI / 3
    call drawHeart x3, y3, r, a + 4 * PI / 3
END SUB


15
Community news and announcements / Re: QB64 world
« on: 21. February 2018, 11:31:24 »
If anyone has problems signing up or logging in at QB64.org send me PM and I will pass along message.

I am wondering if there is a snag with gate keeper.

Pages: [1] 2 3 ... 34