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.


Topics - bplus

Pages: 1 ... 19 20 [21]
301
QB64 Discussion / Getting git
« on: February 16, 2018, 12:10:14 pm »
Ah skimming through
https://github.com/wfbarnes/sprezzo/blob/master/HELP.txt
(for BOTify your code)

I see I need to bring this topic from NET to ORG.

Here is the gist of that, study Pro Git first (as in try learning at the shallow end of the pool before jumping into the deep end):
https://git-scm.com/book/en/v2

I have since learned that git comes automatically for Windows users with GitHub Setup.exe

I have GitHubDesktopSetup.exe downloaded but for some reason am balking... yikes this is getting complicated!

Ha! but looks at the project link in BOTify your code thread, yikes! ^ 2

What's a (lazy) Basic Beginner to do?

Gird one's loins, I guess.

302
QB64 Discussion / BOTify your code
« on: February 16, 2018, 11:29:32 am »
So who knows what about code connecting to Internet and interacting with stuff on it?

Fellipe showed me this project which looks very interesting:
https://github.com/wfbarnes/sprezzo/blob/master/HELP.txt

I'd like to be ready for the Singularity or at least The Terminator.

303
Programs / Maze Mirrors
« on: February 15, 2018, 02:56:19 pm »
Code: QB64: [Select]
  1. _TITLE "1 Maze in 3 Reflectionss, press any key for next image..."
  2. ' 2017-10-19 (B+=MGA) Maze Mirrors.bas
  3.  
  4. CONST xmax = 800 'set screen width to this
  5. CONST ymax = 600 'set screen height to this
  6.  
  7. SCREEN _NEWIMAGE(xmax, ymax, 32) ' this sets the screen to the above settings
  8. _SCREENMOVE 360, 60
  9.  
  10. DEFINT A-Z
  11. CONST w = 14
  12. CONST h = 7
  13.  
  14. COMMON SHARED maze(), x2pixel!, xThk!, y2pixel!, yThk!
  15. DIM maze(w + 1, h + 1)
  16. x2pixel! = xmax / (w + 2)
  17. xThk! = .5 * x2pixel!
  18. y2pixel! = ymax / (h + 2)
  19. yThk! = .5 * y2pixel!
  20.  
  21. FOR y = 1 TO h 'read in data for maze
  22.     FOR x = 1 TO w
  23.         READ maze(x, y)
  24.     NEXT
  25.  
  26. COLOR _RGB(200, 200, 255)
  27.     drawMaze: ck
  28.     drawMazeHorizontalMirror: ck
  29.     drawMaze: ck
  30.     drawMazeVerticalMirror: ck
  31.     drawMaze: ck
  32.     drawMazeBothMirror: ck
  33.  
  34. SUB ck 'check key
  35.     SLEEP: CLS: IF _KEYDOWN(27) THEN END
  36.  
  37. SUB drawMaze
  38.     PRINT "Maze from array:"
  39.     FOR y = 1 TO h
  40.         FOR x = 1 TO w
  41.             IF maze(x, y) AND maze(x, y + 1) THEN
  42.                 LINE (x * x2pixel!, y * y2pixel!)-(x * x2pixel! + xThk!, (y + 1) * y2pixel! + yThk!), , BF
  43.             END IF
  44.             IF maze(x, y) AND maze(x + 1, y) THEN
  45.                 LINE (x * x2pixel!, y * y2pixel!)-((x + 1) * x2pixel! + xThk!, y * y2pixel! + yThk!), , BF
  46.             END IF
  47.         NEXT
  48.     NEXT
  49.  
  50. SUB drawMazeHorizontalMirror
  51.     PRINT "Maze upside down:"
  52.     FOR y = 1 TO h
  53.         FOR x = 1 TO w
  54.             IF maze(x, y) AND maze(x, y + 1) THEN
  55.                 LINE (x * x2pixel!, ymax - (y * y2pixel!))-(x * x2pixel! + xThk!, ymax - ((y + 1) * y2pixel! + yThk!)), , BF
  56.             END IF
  57.             IF maze(x, y) AND maze(x + 1, y) THEN
  58.                 LINE (x * x2pixel!, ymax - (y * y2pixel!))-((x + 1) * x2pixel! + xThk!, ymax - (y * y2pixel! + yThk!)), , BF
  59.             END IF
  60.         NEXT
  61.     NEXT
  62.  
  63. SUB drawMazeVerticalMirror
  64.     PRINT "Maze mirror (vertical):"
  65.     FOR y = 1 TO h
  66.         FOR x = 1 TO w
  67.             IF maze(x, y) AND maze(x, y + 1) THEN
  68.                 LINE (xmax - (x * x2pixel!), y * y2pixel!)-(xmax - (x * x2pixel! + xThk!), (y + 1) * y2pixel! + yThk!), , BF
  69.             END IF
  70.             IF maze(x, y) AND maze(x + 1, y) THEN
  71.                 LINE (xmax - (x * x2pixel!), y * y2pixel!)-(xmax - ((x + 1) * x2pixel! + xThk!), y * y2pixel! + yThk!), , BF
  72.             END IF
  73.         NEXT
  74.     NEXT
  75.  
  76. SUB drawMazeBothMirror
  77.     PRINT "Maze upside down and mirrored:"
  78.     FOR y = 1 TO h
  79.         FOR x = 1 TO w
  80.             IF maze(x, y) AND maze(x, y + 1) THEN
  81.                 LINE (xmax - (x * x2pixel!), ymax - (y * y2pixel!))-(xmax - (x * x2pixel! + xThk!), ymax - ((y + 1) * y2pixel! + yThk!)), , BF
  82.             END IF
  83.             IF maze(x, y) AND maze(x + 1, y) THEN
  84.                 LINE (xmax - (x * x2pixel!), ymax - (y * y2pixel!))-(xmax - ((x + 1) * x2pixel! + xThk!), ymax - (y * y2pixel! + yThk!)), , BF
  85.             END IF
  86.         NEXT
  87.     NEXT
  88.  
  89. 'maze
  90. DATA 1,1,1,1,1,1,1,1,1,1,1,1,1,1
  91. DATA 1,0,0,0,0,0,0,0,0,0,0,0,0,1
  92. DATA 1,0,1,1,1,0,1,1,1,1,1,1,0,1
  93. DATA 1,0,0,0,1,0,0,0,0,0,0,0,0,1
  94. DATA 1,0,1,0,1,0,1,1,1,1,1,1,0,1
  95. DATA 1,0,1,0,0,0,0,0,0,0,0,1,0,1
  96. DATA 1,0,1,1,1,1,1,0,1,1,1,1,1,1
  97.  
  98.  
  99.  

This is old code from net but I wanted to check out screen shots here at org, besides I don't think this code got enough press coverage at net ;-))

304
Programs / Fall Foliage
« on: October 21, 2017, 01:57:45 pm »
Where were we? Oh Ashish was doing fractals and his last was a marvelous 3D Tree but I thought it a bit bare so I will show how to do leaves. :) maybe then he can make them 3D too!

Code: QB64: [Select]
  1. _TITLE "Fall Foliage 2017-10-21 by bplus"
  2. 'fall foliage.bas SmallBASIC 0.12.9 (B+=MGA) 2017-10-21
  3. 'test landscape and portrait views for Android
  4. 'xmx = min(xmax, 400) : ymx = min(700, ymax) 'portrait
  5. 'OK it's just plain better in landscape view
  6.  
  7. 'now for full viewing enjoyment
  8. 'xmx = xmax : ymx = ymax
  9.  
  10. CONST xmx = 1200
  11. CONST ymx = 700
  12. DEFSNG A-Z
  13.  
  14. rad = _PI(1 / 180)
  15. SCREEN _NEWIMAGE(xmx, ymx, 32)
  16. _SCREENMOVE 100, 20 'adjust as needed _MIDDLE needs a delay .5 or more for me
  17.  
  18.  
  19. n = 3
  20.     IF n < 15 THEN n = n + 3
  21.     horizon = rand%(.8 * ymx, .9 * ymx)
  22.     FOR i = 0 TO horizon
  23.         midInk 0, 0, 128, 10, 120, 128, i / horizon
  24.         lien 0, i, xmx, i
  25.     NEXT
  26.     FOR i = horizon TO ymx
  27.         midInk 70, 108, 30, 60, 10, 5, (i - horizon) / (ymx - horizon)
  28.         lien 0, i, xmx, i
  29.     NEXT
  30.     FOR i = 1 TO xmx * ymx * .00018
  31.         leaf rand%(0, xmx), rand%(horizon * 1.002, ymx)
  32.     NEXT
  33.     IF n < .01 * xmx THEN trees = n ELSE trees = rand%(.002 * xmx, .03 * xmx)
  34.     FOR i = 1 TO trees
  35.         y = horizon + .04 * ymx + i / trees * (ymx - horizon - .1 * ymx)
  36.         r = .01 * y: h = rand%(y * .15, y * .18)
  37.         branch rand%(10, xmx - 10), y, r, 90, h, 0
  38.     NEXT
  39.     fRect xmx, 0, xmax, ymax, 0
  40.     fRect 0, ymx, xmx, ymax, 0
  41.     _DISPLAY
  42.     SLEEP 2
  43.  
  44. SUB branch (xx, yy, startrr, angDD, lengthh, levv)
  45.     x = xx: y = yy
  46.     lev = levv
  47.     length = lengthh
  48.     angD = angDD
  49.     startr = startrr
  50.     x2 = x + COS(rad * (angD)) * length
  51.     y2 = y - SIN(rad * (angD)) * length
  52.     dx = (x2 - x) / length
  53.     dy = (y2 - y) / length
  54.     bc& = _RGB(30 + 6 * lev, 15 + 3 * lev, 5 + 2 * lev)
  55.     FOR i = 0 TO length
  56.         COLOR bc&
  57.         fCirc x + dx * i, y + dy * i, startr
  58.     NEXT
  59.     IF lev > 1 THEN leaf x2, y2
  60.     IF .8 * startr < .1 OR lev > 7 OR length < 3 THEN EXIT SUB
  61.     lev = lev + 1
  62.     branch x2, y2, .8 * startr, angD + 22 + rand%(-10, 19), rand%(.75 * length, .9 * length), lev
  63.     branch x2, y2, .8 * startr, angD - 22 - rand%(-10, 19), rand%(.75 * length, .9 * length), lev
  64.  
  65. 'Steve McNeil's  copied from his forum   note: Radius is too common a name
  66. SUB fCirc (CX AS LONG, CY AS LONG, R AS LONG)
  67.     DIM subRadius AS LONG, RadiusError AS LONG
  68.     DIM X AS LONG, Y AS LONG
  69.  
  70.     subRadius = ABS(R)
  71.     RadiusError = -subRadius
  72.     X = subRadius
  73.     Y = 0
  74.  
  75.     IF subRadius = 0 THEN PSET (CX, CY): EXIT SUB
  76.  
  77.     ' Draw the middle span here so we don't draw it twice in the main loop,
  78.     ' which would be a problem with blending turned on.
  79.     LINE (CX - X, CY)-(CX + X, CY), , BF
  80.  
  81.     WHILE X > Y
  82.         RadiusError = RadiusError + Y * 2 + 1
  83.         IF RadiusError >= 0 THEN
  84.             IF X <> Y + 1 THEN
  85.                 LINE (CX - Y, CY - X)-(CX + Y, CY - X), , BF
  86.                 LINE (CX - Y, CY + X)-(CX + Y, CY + X), , BF
  87.             END IF
  88.             X = X - 1
  89.             RadiusError = RadiusError - X * 2
  90.         END IF
  91.         Y = Y + 1
  92.         LINE (CX - X, CY - Y)-(CX + X, CY - Y), , BF
  93.         LINE (CX - X, CY + Y)-(CX + X, CY + Y), , BF
  94.     WEND
  95.  
  96. SUB fRect (x1, y1, x2, y2, c&)
  97.     LINE (x1, y1)-(x2, y2), c&, BF
  98.  
  99. SUB fRectStep (x1, y1, x2, y2)
  100.     LINE (x1, y1)-STEP(x2, y2), , BF
  101.  
  102. SUB lien (x1, y1, x2, y2)
  103.     LINE (x1, y1)-(x2, y2)
  104.  
  105. SUB leaf (x, y)
  106.     sp = 15: leafs = rand%(xmx * ymx * .00001, xmx * ymx * .00002)
  107.     FOR n = 1 TO leafs
  108.         COLOR _RGB(rand%(50, 250), rand%(25, 255), rand%(0, 40))
  109.         xoff = x + RND * sp - RND * sp
  110.         yoff = y + RND * sp - RND * sp
  111.         woff = 3 + RND * 3
  112.         hoff = 3 + RND * 3
  113.         fRectStep xoff, yoff, woff, hoff
  114.     NEXT
  115.  
  116. SUB midInk (r1%, g1%, b1%, r2%, g2%, b2%, fr##)
  117.     COLOR _RGB(r1% + (r2% - r1%) * fr##, g1% + (g2% - g1%) * fr##, b1% + (b2% - b1%) * fr##)
  118.  
  119. FUNCTION rand% (lo%, hi%)
  120.     rand% = INT(RND * (hi% - lo% + 1)) + lo%
  121.  
  122.  

Here is alternate code and screen shot:
http://www.thejoyfulprogrammer.com/qb64/forum/showthread.php?tid=1051&pid=4609&rndtime=1508574661435543493#pid4609

305
InForm Discussion / InForm
« on: July 25, 2017, 12:50:56 pm »
Hi All,

I just downloaded InForm and first of all want to say, Thank You Fellippe!

This looks more a VB style that I have used in 90's than JB's current version.

Are there any know issues using it with Walter's fork of QB64 1.1? (ie should I get a different version QB64?)

There is probably a wealth of stuff at [abandoned, outdated and now likely malicious qb64 dot net website - don’t go there] but could we get a few small samples here for getting started?

I am especially interested in using a texteditor control all the ins & outs, if there is one.

Also watching the Tic Tac Toe demo, I see ways to align controls that I don't remember having in 90's, cool!


Append: I guess there is an issue with the fork, I am getting blank screen running UiEditor.exe and .bas.

306
Programs / Plasma Waves
« on: July 21, 2017, 11:18:54 pm »
Press spacebar for new sea:
Code: QB64: [Select]
  1. 'Wavy with Plama.bas for QB64 fork (B+=MGA) 2017-05-05
  2. ' Wavy with Plasma Treatment.bas SmallBASIC 0.12.9 (B+=MGA) 2017-05-03
  3. ' from: animated circles started by Admin at SdlBasic 2017-05-03
  4. ' I added Plasma treatment and spacebar  changer
  5.  
  6.  
  7. '===================================================================
  8.  
  9. ' Instructions: press spacebar for new injection of plasma
  10.  
  11. '==================================================================
  12.  
  13. CONST sqr12! = .5 ^ .5
  14. CONST xmax = 1100
  15. CONST ymax = 700
  16. CONST DPI = 3.141516 * 2
  17. CONST PHIDELTA = DPI / 15
  18. CONST PHISTEP = DPI / 50
  19. CONST RADIUS = 20
  20. CONST SMALL_R = 20
  21. CONST DISTANCE = 23
  22. CONST W = xmax
  23. CONST H = ymax
  24.  
  25. SCREEN _NEWIMAGE(xmax, ymax, 32)
  26. _TITLE "Wavy with Plasma trans by bplus, Press Spacebar for New Plasma Injection."
  27. DIM SHARED pR, pG, pB AS INTEGER
  28. DIM x, y, xball, yball AS INTEGER
  29. DIM current_phi, phiIndex, phi AS DOUBLE
  30. current_phi = 0
  31. cN = 1
  32. resetPlasma
  33.     CLS
  34.     _LIMIT 10
  35.     IF _KEYHIT = 32 THEN cN = 1: resetPlasma
  36.     current_phi = current_phi + PHISTEP
  37.     FOR x = 0 TO (W + RADIUS) STEP DISTANCE
  38.         FOR y = 0 TO (H + RADIUS) STEP DISTANCE
  39.             'COLOR _RGB(120, 80, 80)
  40.             'CIRCLE (x, y), RADIUS
  41.             phiIndex = ((x + y) MOD (2 * W)) / RADIUS
  42.             phi = phiIndex * PHIDELTA + current_phi
  43.             xball = COS(phi) * RADIUS + x
  44.             yball = SIN(phi) * RADIUS + y
  45.             changePlasma
  46.             'LINE (x, y)-(xball, yball)
  47.             fcirc2 xball, yball, SMALL_R
  48.         NEXT
  49.     NEXT
  50.     _DISPLAY
  51.  
  52. SUB changePlasma ()
  53. cN = cN + 1
  54. COLOR _RGB(127 + 127 * SIN(pR * cN), 127 + 127 * SIN(pG * cN), 127 + 127 * SIN(pB * cN))
  55.  
  56. SUB resetPlasma ()
  57. pR = RND ^ 2: pG = RND ^ 2: pB = RND ^ 2
  58.  
  59. '========================================== sqrSeg Method for filled circle
  60. SUB fcirc2 (xx%, yy%, r%)
  61. 'const sqr12! = .5^.5  'in main const section
  62. r2% = r% * r%
  63. sqr12r% = sqr12! * r%
  64. LINE (xx% - sqr12r%, yy% - sqr12r%)-(xx% + sqr12r%, yy% + sqr12r%), , BF
  65. FOR x% = 0 TO sqr12r%
  66.     y% = SQR(r2% - x% * x%)
  67.     LINE (xx% - x%, yy% + sqr12r%)-(xx% - x%, yy% + y%)
  68.     LINE (xx% - x%, yy% - sqr12r%)-(xx% - x%, yy% - y%)
  69.     LINE (xx% + x%, yy% + sqr12r%)-(xx% + x%, yy% + y%)
  70.     LINE (xx% + x%, yy% - sqr12r%)-(xx% + x%, yy% - y%)
  71. FOR x% = sqr12r% TO r%
  72.     y% = SQR(r2% - x% * x%)
  73.     LINE (xx% - x%, yy% + y%)-(xx% - x%, yy% - y%)
  74.     LINE (xx% + x%, yy% + y%)-(xx% + x%, yy% - y%)
  75.  
  76. SUB fcirc (xx%, yy%, r%)
  77. r2% = r% * r%
  78. FOR x% = 0 TO r%
  79.     y% = INT(SQR(r2% - x% * x%))
  80.     LINE (xx% - x%, yy% + y%)-(xx% - x%, yy% - y%)
  81.     LINE (xx% + x%, yy% + y%)-(xx% + x%, yy% - y%)
  82.  
  83.  

Oh, I guess I was experimenting with circle drawing here too.

Pages: 1 ... 19 20 [21]