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 - SierraKen

Pages: [1] 2 3 ... 11
1
Programs / B+'s Matrix Rain With World Map Backdrop
« on: April 02, 2022, 03:17:31 pm »
Almost all of this code is from B+'s Matrix Rain 4. I tried to find the original post but one link didn't work anymore. Anyhow, for 2 days I've tried to add a world map as the backdrop to it and  finally succeeded using GET and PUT from the QB64 Wiki pages. I remembered that back in the 1990's I used to use XOR to make a background image with moving graphics over it. But instead of having to use XOR, DEST works pretty similar, with PUT and GET. Here is the code, photo, and the required world_map.jpg needed in the same folder as the code. I tried to section-off where I added my own code to this. Thank you B+!

Make sure and name this file, it won't work if you don't: Matrix Rain 4 mod by SierraKen.bas

Code: QB64: [Select]
  1. _Title "Matrix Rain 4 mod by SierraKen" 'B+ started 2019-03-16
  2. ' from Matrix Rain 2019-03-14
  3. ' or QB64 Purple Rain!
  4.  
  5. '>>> Save this file as: Matrix Rain 4 mod by SierraKen.bas, so the program can load the strings from it.  <<<
  6.  
  7. '2019-03-15 This will attempt to spin the drops as they fall
  8. '2019-03-16  Don't need no damn Character Set.DAT file!!!
  9. '2019-03-16 Ijust want to see the vertical code strings dangle and twist.
  10.  
  11. '2019-03-19 Matrix Rain 4
  12. ' + added randWeight to weight the random sizes chosen so many more on small side than large
  13. ' + draw letters on a transparent background so the background of the letter does not cover
  14. '   the drops behind it.
  15.  
  16. 'Mod by SierraKen - Added World Map as the backdrop. - April 2, 2022.
  17.  
  18. Const xmax = 1500
  19. Const ymax = 659
  20. Const nDrops = 500
  21. Type dropType
  22.     x As Single
  23.     sz As Single
  24.     curY As Integer
  25.     dxs As Single 'direction and change of spin some small fraction of 1, +-1/3, +-1/4, +-1/5...
  26.  
  27. 'SierraKen's World Map code with the array, GET, and DEST ---------------------------------------------
  28. Dim map As Long
  29.  
  30. map& = _LoadImage("world_map.jpg", 32)
  31. Screen map&
  32. wide& = _Width(map&): deep& = _Height(map&)
  33.  
  34. Dim Array(wide& * deep&) As Long
  35.  
  36. _Source map& 'REQUIRED to GET the proper image area!
  37. Get (0, 0)-(wide& - 1, deep& - 1), Array(0)
  38.  
  39.  
  40. '-------------------------------------------------------------------------------------------------------
  41.  
  42. 'Screen _NewImage(xmax, ymax, 32)
  43. _ScreenMove 80, 0 'for snap shot
  44. '_FULLSCREEN 'as screen saver
  45.  
  46. ReDim Shared fileStrings$(1000) 'container for these program lines that will be dangling
  47.  
  48. 'Changed this name. ----------------------------------------
  49. Open "Matrix Rain 4 mod by SierraKen.bas" For Input As #1
  50. '----------------------------------------------------------------
  51.     Line Input #1, fs$
  52.     If Len(LTrim$(fs$)) <> 0 Then 'less empty spaces
  53.         fileStrings$(i) = LTrim$(fs$)
  54.         i = i + 1
  55.     End If
  56. ReDim _Preserve fileStrings$(i - 1)
  57. ' check loading
  58. 'FOR i = 0 TO UBOUND(fileStrings$)
  59. '    PRINT i, fileStrings$(i)
  60. 'NEXT
  61. 'END
  62.  
  63. 'setup drops
  64. Dim Shared drop(nDrops) As dropType
  65. Dim Shared s$(nDrops)
  66.  
  67. For i = 0 To nDrops
  68.     newDrop i, 1
  69.  
  70. While _KeyDown(27) = 0
  71.     Cls
  72.     'SierraKen's PUT statement ----------------------------
  73.     Put (0, 0), Array(0), PSet , _RGB(0, 0, 0)
  74.     '------------------------------------------------------
  75.  
  76.     For i = 0 To nDrops
  77.         drawDrop (i)
  78.         drop(i).curY = drop(i).curY + 1
  79.         If drop(i).curY > Len(s$(i)) Then newDrop i, 0
  80.     Next
  81.     _Display
  82.     _Limit 25
  83.  
  84. Sub newDrop (i, start)
  85.     drop(i).x = Rnd * xmax 'set location
  86.     drop(i).sz = randWeight(.3, 5, 3) 'set size  weighted on small sizes
  87.     'length of text string can fit on screen
  88.     charLength = ymax \ (drop(i).sz * 16) + 1 'from size determine how many chars fit on screen
  89.     randLine = Int(Rnd * UBound(fileStrings$)) 'pick a random program line
  90.     s$(i) = Mid$(fileStrings$(randLine), 1, charLength) 'here is text string to dangle
  91.     While Len(s$(i)) < charLength
  92.         If randLine + 1 > UBound(fileStrings$) Then randLine = 0 Else randLine = randLine + 1
  93.         s$(i) = Mid$(s$(i) + " : " + fileStrings$(randLine), 1, charLength)
  94.     Wend
  95.     If start <> 0 Then drop(i).curY = Int(Rnd * (charLength)) + 1 Else drop(i).curY = 1 'flat and readable at curY
  96.     drop(i).dxs = 1 / (Int(Rnd * 7) + 3) 'change of spin rate +-1/3, +-1/4, ... +-1/9
  97.     If Rnd < .5 Then drop(i).dxs = -drop(i).dxs
  98.  
  99. Sub drawDrop (i)
  100.     For j = 1 To drop(i).curY
  101.         d = drop(i).curY - j
  102.         If d = 0 Then
  103.             c~& = _RGBA32(255, 100, 255, 225)
  104.         ElseIf d = 1 Then
  105.             c~& = _RGBA32(255, 50, 255, 205)
  106.         ElseIf d = 2 Then
  107.             c~& = _RGBA32(255, 25, 255, 180)
  108.         ElseIf d >= 3 Then
  109.             c~& = _RGBA32(255, 0, 255, 190 - d * 5)
  110.         End If
  111.         rot = 1: dir = -1
  112.         For k = 0 To d
  113.             rot = rot + drop(i).dxs * dir
  114.             If rot > 1 Then dir = -1 * dir: rot = 1 + drop(i).dxs * dir
  115.             If rot < -1 Then dir = dir * -1: rot = -1 + drop(i).dxs * dir
  116.         Next
  117.         drwChar Mid$(s$(i), j, 1), c~&, drop(i).x + 4 * drop(i).sz, drop(i).sz * 16 * (j - 1) + 8 * drop(i).sz, rot * drop(i).sz, drop(i).sz, 0
  118.     Next
  119.  
  120. Sub drwChar (char$, c As _Unsigned Long, midX, midY, xScale, yScale, Rotation) 'what ever the present color is set at
  121.     I& = _NewImage(8, 16, 32)
  122.     _Dest I&
  123.     Color c, _RGBA32(0, 0, 0, 0)
  124.     _PrintString (0, 0), char$
  125.     _Dest 0
  126.     RotoZoom2 midX, midY, I&, xScale, yScale, Rotation
  127.     _FreeImage I&
  128.  
  129. Sub RotoZoom2 (X As Long, Y As Long, Image As Long, xScale As Single, yScale As Single, Rotation As Single)
  130.     Dim px(3) As Single: Dim py(3) As Single
  131.     W& = _Width(Image&): H& = _Height(Image&)
  132.     px(0) = -W& / 2: py(0) = -H& / 2: px(1) = -W& / 2: py(1) = H& / 2
  133.     px(2) = W& / 2: py(2) = H& / 2: px(3) = W& / 2: py(3) = -H& / 2
  134.     sinr! = Sin(-Rotation): cosr! = Cos(-Rotation)
  135.     For i& = 0 To 3
  136.         x2& = (px(i&) * cosr! + sinr! * py(i&)) * xScale + X: y2& = (py(i&) * cosr! - px(i&) * sinr!) * yScale + Y
  137.         px(i&) = x2&: py(i&) = y2&
  138.     Next
  139.     _MapTriangle (0, 0)-(0, H& - 1)-(W& - 1, H& - 1), Image& To(px(0), py(0))-(px(1), py(1))-(px(2), py(2))
  140.     _MapTriangle (0, 0)-(W& - 1, 0)-(W& - 1, H& - 1), Image& To(px(0), py(0))-(px(3), py(3))-(px(2), py(2))
  141.  
  142. Function randWeight (manyValue, fewValue, power)
  143.     randWeight = manyValue + Rnd ^ power * (fewValue - manyValue)
  144.  

2
Programs / Neon Clock
« on: March 23, 2022, 01:43:31 am »
A couple years ago someone told us how to get neon colors using a _GL Sub. I'm guessing it's only for Windows computers but I could be wrong. Anyway, I decided to dig it up tonight and make a Neon Clock. Using CLS and _DISPLAY doesn't work with it (it flashes too much), so instead of CLS on my usual clocks, I drew the neon circles for the clock and used a LINE command to delete the clock hands. Doing this I also added the trail-effect that B+ showed me when I first started. Tell me what you think. It also chimes the hour every hour. Here is a photo of it also below. By the way, how do you view larger photos on here that others are using, I only know the Attachments, thanks.

Code: QB64: [Select]
  1. _Title "Neon Clock by SierraKen"
  2. Screen _NewImage(600, 600, 32)
  3.  
  4. Type vec2
  5.     x As Single
  6.     y As Single
  7.  
  8. ReDim Shared vert(4024) As vec2, max_v_index
  9. Dim Shared rFactor!, gFactor!, bFactor!
  10. rFactor! = 0.5: gFactor! = 1: bFactor! = 0.5
  11.  
  12. For t = 0 To 360 Step .5
  13.     x2 = (Sin(t) * 260) + 400
  14.     y2 = (Cos(t) * 190) + 300
  15.     max_v_index = max_v_index + 1
  16.     vert(max_v_index).x = x2
  17.     vert(max_v_index).y = y2
  18.  
  19. For t = 1 To 359
  20.     For tt = t - 2 To t + 2 Step .5
  21.         x2 = Int((Sin(tt) * 230) + 400)
  22.         y2 = Int((Cos(tt) * 170) + 300)
  23.         max_v_index = max_v_index + 1
  24.         vert(max_v_index).x = x2
  25.         vert(max_v_index).y = y2
  26.     Next tt
  27.  
  28.     _Limit 30
  29.  
  30.     hours = Timer \ 3600
  31.     minutes = Timer \ 60 - hours * 60
  32.     seconds = (Timer - hours * 3600 - minutes * 60)
  33.     ho$ = Left$(Time$, 2): hou = Val(ho$)
  34.     min$ = Mid$(Time$, 4, 2): minu = Val(min$)
  35.     seco$ = Right$(Time$, 2): secon = Val(seco$)
  36.  
  37.     'Minutes
  38.     m = 180 - minutes * 6
  39.     xx = Int(Sin(m / 180 * 3.141592) * 120) + 300
  40.     yy = Int(Cos(m / 180 * 3.141592) * 120) + 304
  41.     For b = -5 To 5 Step .1
  42.         Line (300 + b, 304)-(xx, yy), _RGB32(0, 255, 255)
  43.         Line (300, 304 + b)-(xx, yy), _RGB32(0, 255, 255)
  44.     Next b
  45.     'Hours
  46.     h = 360 - hours * 30 + 180
  47.     xxx = Int(Sin(h / 180 * 3.141592) * 100) + 300
  48.     yyy = Int(Cos(h / 180 * 3.141592) * 100) + 304
  49.     For b = -5 To 5 Step .1
  50.         Line (300 + b, 304)-(xxx, yyy), _RGB32(0, 255, 0)
  51.         Line (300, 304 + b)-(xxx, yyy), _RGB32(0, 255, 0)
  52.     Next b
  53.     'Seconds
  54.     s = (60 - seconds) * 6 + 180
  55.     xxxx = Int(Sin(s / 180 * 3.141592) * 125) + 300
  56.     yyyy = Int(Cos(s / 180 * 3.141592) * 125) + 304
  57.     For b = -5 To 5 Step .1
  58.         Line (300 + b, 304)-(xxxx, yyyy), _RGB32(255, 0, 0)
  59.         Line (300, 304 + b)-(xxxx, yyyy), _RGB32(255, 0, 0)
  60.     Next b
  61.     _Display
  62.     Line (175, 175)-(425, 440), _RGB32(0, 0, 0, 5), BF
  63.  
  64.     'Chimes
  65.     If minu = 0 And secon = 0 Then
  66.         hour2 = hou
  67.         If hour2 > 12 Then hour2 = hour2 - 12
  68.         If hour2 = 0 Then hour2 = 12
  69.         For chimes = 1 To hour2
  70.             ttt = 0
  71.             Do
  72.                 'queue some sound
  73.                 Do While _SndRawLen < 0.1 'you may wish to adjust this
  74.                     sample = Sin(ttt * 340 * Atn(1) * 8) '340Hz sine wave (ttt * 440 * 2p)
  75.                     sample = sample * Exp(-ttt * 3) 'fade out eliminates clicks after sound
  76.                     _SndRaw sample
  77.                     ttt = ttt + 1 / _SndRate 'sound card sample frequency determines time
  78.                 Loop
  79.                 'do other stuff, but it may interrupt sound
  80.             Loop While ttt < 2 'play for 2 seconds
  81.             Do While _SndRawLen > 0 'Finish any left over queued sound!
  82.             Loop
  83.         Next chimes
  84.     End If
  85.     two:
  86.  
  87.  
  88. Sub _GL ()
  89.     Static glInit
  90.     If glInit = 0 Then
  91.         glInit = 1
  92.  
  93.     End If
  94.     'set the gl screen so that it can work normal screen coordinates
  95.     _glTranslatef -1, 1, 0
  96.     _glScalef 1 / 400, -1 / 300, 1
  97.  
  98.     _glEnable _GL_BLEND
  99.  
  100.     _glBlendFunc _GL_SRC_ALPHA, _GL_ONE
  101.     _glEnableClientState _GL_VERTEX_ARRAY
  102.     _glVertexPointer 2, _GL_FLOAT, 0, _Offset(vert())
  103.     For j = 1 To 15
  104.         _glColor4f rFactor!, gFactor!, bFactor!, 0.015
  105.         _glPointSize j
  106.         _glDrawArrays _GL_POINTS, 10, max_v_index
  107.     Next
  108.     _glFlush
  109.  

3
Programs / Rotating Flower
« on: March 21, 2022, 08:00:51 pm »
Many of you have probably seen this before and have made it before. But without looking at any of your code, except for the Wiki pages, I decided to try it myself. This flower has 3 layers and the pedals keep going around and around because there is no way to stop it and look right that I can figure out. It's because the last pedal is placed on top of both the left and the right (the first) pedal and won't go underneath the first pedal. There might be a way around this using advanced math or maybe even using the POINT command, but since I'm using the ROTOZOOM Sub that I found in the Wiki pages, this is as good as I can get. Check it out. :) Oh by the way, something tells me that there was a RotoZoom command, without having to use the Sub, but I couldn't find it in the Wiki. I'll place a photo of this flower below.

Code: QB64: [Select]
  1. _Title "Ken's Rotating Flower"
  2. Dim image As Long
  3. Screen _NewImage(800, 600, 32)
  4.  
  5. For tt = 0 To _Pi Step .2
  6.     For t = 1 To 20 Step .1
  7.         Circle (400 + t, 150 + tt), 100, _RGB32(255, 0, 0), _Pi, ((3 * _Pi) / 2)
  8.         Circle (298 + t, 250 + tt), 100, _RGB32(255, 0, 0), (2 * _Pi), (_Pi / 2)
  9.     Next t
  10. Next tt
  11. Paint (350, 200), _RGB32(255, 255, 128), _RGB32(255, 0, 0)
  12.  
  13. image& = _CopyImage(0)
  14. 'sky
  15. Paint (1, 1), _RGB32(128, 255, 255)
  16. zoom = 1.5
  17. zoom2 = .5
  18. zoom3 = .2
  19.     _Limit 20
  20.     RotoZoom 400, 300, image&, zoom, angle
  21.     RotoZoom 400, 300, image&, zoom2, angle
  22.     RotoZoom 400, 300, image&, zoom3, angle
  23.     _Display
  24.     angle = angle + 20
  25.     If angle >= 360 Then Paint (400, 300), _RGB32(255, 255, 128), _RGB32(255, 0, 0): angle = 0
  26.     _Delay .1
  27.  
  28.  
  29. Sub RotoZoom (X As Long, Y As Long, image&, Scale As Single, Rotation As Single)
  30.     Dim px(3) As Single: Dim py(3) As Single
  31.     W& = _Width(image&): H& = _Height(image&)
  32.     px(0) = -W& / 2: py(0) = -H& / 2: px(1) = -W& / 2: py(1) = H& / 2
  33.     px(2) = W& / 2: py(2) = H& / 2: px(3) = W& / 2: py(3) = -H& / 2
  34.     sinr! = Sin(-Rotation / 57.2957795131): cosr! = Cos(-Rotation / 57.2957795131)
  35.     For i& = 0 To 3
  36.         x2& = (px(i&) * cosr! + sinr! * py(i&)) * Scale + X: y2& = (py(i&) * cosr! - px(i&) * sinr!) * Scale + Y
  37.         px(i&) = x2&: py(i&) = y2&
  38.     Next
  39.     _MapTriangle (0, 0)-(0, H& - 1)-(W& - 1, H& - 1), image& To(px(0), py(0))-(px(1), py(1))-(px(2), py(2))
  40.     _MapTriangle (0, 0)-(W& - 1, 0)-(W& - 1, H& - 1), image& To(px(0), py(0))-(px(3), py(3))-(px(2), py(2))
  41.  

4
Programs / Flower
« on: March 20, 2022, 08:06:58 pm »
I made my first rose today for the First Day of Spring. I posted the picture of it below.

Code: QB64: [Select]
  1. Screen _NewImage(800, 600, 32)
  2. _Title "Happy First Day Of Spring!"
  3.  
  4. Paint (1, 1), _RGB32(128, 255, 255)
  5. For sz = .1 To 600 Step .1
  6.     Circle (400, 900), sz, _RGB32(127, 255, 127)
  7. Next sz
  8.  
  9. Line (398, 300)-(402, 250), _RGB32(127, 255, 0), BF
  10.  
  11. For sz2 = -5 To 5 Step .5
  12.     Circle (400 - sz2, 150 + sz2), sz2 + 100, _RGB32(255, 0, 0), _Pi, (3 * _Pi) / 2
  13.     Circle (300 + sz2, 250 - sz2), sz2 + 100, _RGB32(255, 0, 0), (2 * _Pi), _Pi / 2
  14. Next sz2
  15.  
  16. For sz3 = -5 To 5 Step .5
  17.     Circle (400 + sz3, 150 + sz3), sz3 + 100, _RGB32(255, 0, 0), (3 * _Pi) / 2, 2 * _Pi
  18.     Circle (500 - sz3, 250 - sz3), sz3 + 100, _RGB32(255, 0, 0), (_Pi / 2), _Pi
  19. Next sz3
  20.  
  21. Line (399, 200)-(401, 150), _RGB32(127, 255, 127), BF
  22. For sz4 = .1 To 5 Step .1
  23.     Circle (400, 145), sz4, _RGB32(255, 255, 127)
  24. Next sz4
  25.  
  26. Paint (375, 225), _RGB32(255, 0, 1), _RGB32(255, 0, 0)
  27. Paint (425, 225), _RGB32(255, 0, 1), _RGB32(255, 0, 0)
  28.  
  29.  

5
Programs / Terrain Grid
« on: March 16, 2022, 09:29:06 pm »
Using Petr's Sound Visualization code, I converted it to this small simulation of flying over a green terrain grid and a blue sky. I might look into this more sometime to see if there is ways to turn, etc. But here is the general code for it. I started this new thread so it wouldn't take over Petr's and in case anyone wants to make mods of it. 
Petr's Music Visualization code is here: https://qb64forum.alephc.xyz/index.php?topic=4719.0

Code: QB64: [Select]
  1. 'Almost all of this code comes from Petr's Music Visualizer.
  2. Screen _NewImage(800, 600, 32)
  3.     ShiftIt = 89
  4.     $NoPrefix
  5.     Dest Texture
  6.     Cls
  7.     Paint (1, 1), _RGB32(127, 255, 127)
  8.     For diY = 0 To 100
  9.         Line (diY + 20, diY + 20)-(235 - diY, 235 - diY), RGB32(0, diY, 0), B
  10.     Next
  11.     Dest 0
  12.     Dim M3D(90, 90) As Single
  13.     Dim M2D(90, 90) As Single
  14.     DW = 800
  15.     DH = 600
  16.     HT = CopyImage(Texture, 33)
  17.     If Texture <> 0 Then FreeImage Texture
  18.     Screen NewImage(DW, DH, 32)
  19.     Do Until ShiftIt < 0
  20.         For rows = 0 To 90
  21.             Swap M3D(rows, ShiftIt), M3D(rows, ShiftIt + 1)
  22.             Swap M2D(rows, ShiftIt), M2D(rows, ShiftIt + 1)
  23.         Next
  24.         ShiftIt = ShiftIt - 1
  25.     Loop
  26.     Depth = 0
  27.     Do Until Depth = 90000
  28.         M3D(ra, 0) = Rnd * 2.5
  29.         M2D(ra, 0) = Rnd * 2.5
  30.         Depth = Depth + 1000
  31.         ra = ra + 1
  32.     Loop
  33.  
  34.     ra = 0
  35.  
  36.     For Z = 0 To 89
  37.         For X = 0 To 89
  38.             HX = -45 + X
  39.             HX2 = HX + 1
  40.             HZ = -89 + Z
  41.             HZ2 = HZ + 1
  42.             HY1 = -3 + M3D(X, Z): HY2 = -3 + M3D(X + 1, Z): HY3 = -3 + M3D(X, Z + 1): HY4 = -3 + M3D(X + 1, Z + 1)
  43.             HY11 = 3 - M2D(X, Z): HY12 = 3 - M2D(X + 1, Z): HY13 = 3 - M2D(X, Z + 1): HY14 = 3 - M2D(X + 1, Z + 1)
  44.             'Ground
  45.             MapTriangle (0, 0)-(255, 0)-(0, 255), HT To(HX, HY1, HZ)-(HX2, HY2, HZ)-(HX, HY3, HZ2), 0, Smooth
  46.             MapTriangle (255, 0)-(0, 255)-(255, 255), HT To(HX2, HY2, HZ)-(HX, HY3, HZ2)-(HX2, HY4, HZ2), 0, Smooth
  47.             'Ceiling
  48.             'MapTriangle (0, 0)-(255, 0)-(0, 255), HT To(HX, HY11, HZ)-(HX2, HY12, HZ)-(HX, HY13, HZ2), 0, Smooth
  49.             'MapTriangle (255, 0)-(0, 255)-(255, 255), HT To(HX2, HY12, HZ)-(HX, HY13, HZ2)-(HX2, HY14, HZ2), 0, Smooth
  50.     Next X, Z
  51.     'Sky
  52.     Paint (1, 1), _RGB32(128, 255, 255)
  53.     Display
  54.     Limit 20
  55.  
  56.  

6
Programs / Happy _PI Day!
« on: March 14, 2022, 12:18:44 pm »
Happy 3.14 _PI Day!

Here are some orbits I made today.

Code: QB64: [Select]
  1. Screen _NewImage(800, 600, 32)
  2. tilt = 60
  3.     _Limit 300
  4.     Circle (400, 200), 30, _RGB32(127, 255, 255)
  5.  
  6.     seconds = seconds + .1
  7.     If seconds > 59 Then seconds = 0
  8.     s = (60 - seconds) * 6 + 180
  9.     x = Int(Sin(s / 180 * _Pi) * 125) + 400
  10.     y = Int(Cos(s / 180 * _Pi) * 125 / tilt) + 200
  11.     Circle (x, y), 5, _RGB32(255, 0, 0)
  12.     seconds2 = seconds2 + .1
  13.     If seconds2 > 59 Then seconds2 = 0
  14.     s2 = (60 - seconds2) * 6 + 180
  15.     x2 = Int(Sin(s2 / 180 * _Pi) * 125) + 400
  16.     y2 = Int(Cos(s2 / 180 * _Pi) * 125 + tilt) + 200
  17.     Circle (x2, y2), 5, _RGB32(255, 0, 0)
  18.     seconds3 = seconds3 - .1
  19.     If seconds3 > 59 Then seconds3 = 0
  20.     s3 = (60 - seconds3) * 6 + 180
  21.     x3 = Int(Sin(s3 / 180 * _Pi) * 125) + 400
  22.     y3 = Int(Cos(s3 / 180 * _Pi) * 125 - tilt) + 200
  23.     Circle (x3, y3), 5, _RGB32(255, 0, 0)
  24.  
  25.     _Delay .002
  26.     _Display
  27.     Cls
  28.  

7
Programs / Peace Sign
« on: March 09, 2022, 08:13:17 pm »
This is a peace sign I just threw together. The colors of the sign change and then go back and start over.

Code: QB64: [Select]
  1. _Title "Peace - press Esc to quit app."
  2. Screen _NewImage(800, 600, 32)
  3. r = 50: g = 1: b = 1
  4. _Limit 100
  5.     If r < 256 Then r = r + .005
  6.     If r > 255 Then r2 = 1
  7.     If b < 256 And r2 = 1 Then b = b + .005
  8.     If b > 255 Then b2 = 1
  9.     If g < 256 And r2 = 1 And b2 = 1 Then g = g + .005
  10.     If g > 255 Then r2 = 0: b2 = 0: r = 1: b = 1: g = 1
  11.  
  12.     x = x + .01
  13.     y = y + .01
  14.     Line (0, y)-(x, 0), _RGB32(r, g, b)
  15.     If y > 2000 Then GoTo design:
  16. design:
  17.  
  18. For cir = .1 To 100 Step .1
  19.     Circle (400, 300), cir, _RGB32(127 - cir, 255 / cir, 255 / cir)
  20. Next cir
  21.     bl = bl + 1
  22.     If bl > 254 Then bl = 1
  23.     gr = gr + 1
  24.     If gr > 254 Then gr = 1
  25.     re = red + 1
  26.     If re > 254 Then re = 1
  27.     For thick = .1 To 10 Step .1
  28.         Circle (400, 300), 90 + thick, _RGB32(re, gr, bl)
  29.     Next thick
  30.  
  31.     seconds = 29.99
  32.     s = (60 - seconds) * 6 + 180
  33.     x2 = Int(Sin(s / 180 * 3.141592) * 100) + 400
  34.     y2 = Int(Cos(s / 180 * 3.141592) * 100) + 300
  35.     Line (400, 300)-(x2, y2), _RGB32(re, gr, bl)
  36.     seconds = 60
  37.     s = (60 - seconds) * 6 + 180
  38.     x2 = Int(Sin(s / 180 * 3.141592) * 100) + 400
  39.     y2 = Int(Cos(s / 180 * 3.141592) * 100) + 300
  40.     Line (400, 300)-(x2, y2), _RGB32(re, gr, bl)
  41.     seconds = 20
  42.     s = (60 - seconds) * 6 + 180
  43.     x2 = Int(Sin(s / 180 * 3.141592) * 100) + 400
  44.     y2 = Int(Cos(s / 180 * 3.141592) * 100) + 300
  45.     Line (400, 300)-(x2, y2), _RGB32(re, gr, bl)
  46.     seconds = 40
  47.     s = (60 - seconds) * 6 + 180
  48.     x2 = Int(Sin(s / 180 * 3.141592) * 100) + 400
  49.     y2 = Int(Cos(s / 180 * 3.141592) * 100) + 300
  50.     Line (400, 300)-(x2, y2), _RGB32(re, gr, bl)
  51.  
  52.     _Delay .02
  53.     If bl = 254 Then _Delay 1
  54.  


8
Programs / Rosie Bot
« on: February 24, 2022, 01:58:52 pm »
Hi all. I decided to play around with the Microsoft Windows text-to-speech stuff some more by making a simple chat bot that I named Rosie. There's a few questions that Rosie answers and I also decided to add a .txt file for the user to be able to make their own bot by adding as many questions and answers as they wish. To do that, simply type: add, or addon, or add question and it will go to that mode. It's not perfect of course and I haven't tested it fully, like if someone adds a question that it already has (either in the botaddon file or internally in the bot) but I'm guessing it would just answer with both answers, possibly speaking both at the same time. If that happens, or any other botaddon.txt problem, just open up the .txt file with Notepad and carefully erase the --- line above it, the question, and the answer. I will put all of this in the comments section of the code at the start so programmers know. But have fun with it, that's why I made it. :) Also tell me what you think. Thanks.

The 2 files are zipped in Rosie Bot.zip and placed in the attachments of this post. Put these 2 files in the same folder.

Edit: Attachment deleted, please see the replies below to get the newest one.

9
Programs / The Date For Non-Orthodox Easter Calculation
« on: February 22, 2022, 12:18:18 am »
Here is a small program that calculates the date of Easter for any given year.
I use the same code that's on my calendar maker. Since it uses the Gregorian Calendar,  it starts at 1753 A.D. This is for the Non-Orthodox Easter date.

Code: QB64: [Select]
  1. 'What Is The Date For Easter (Non-Orthodox)
  2. 'By SierraKen
  3. 'Equation Code found online.
  4.  
  5. _Title "What Is The Date For Easter"
  6. start:
  7. start2:
  8. Input "          Year (Higher Than 1753 A.D.): ", PQA
  9. If PQA < 1753 Then Print: Print "          Your year is too long ago for the Gregorian Calendar, try again.": GoTo start2:
  10. If PQA <> Int(PQA) Then Print "          Cannot use decimals, try again.": GoTo start2:
  11. GoSub PAQUES:
  12. If pqm = 3 Then month$ = "March"
  13. If pqm = 4 Then month$ = "April"
  14.  
  15. day$ = Str$(PQJ)
  16. year$ = Str$(PQA)
  17. Print "          Easter Date: " + month$ + " " + day$ + ", " + year$
  18. Input "          More (Y/N):", yn$
  19. If Left$(yn$, 1) = "y" Or Left$(yn$, 1) = "Y" Then GoTo start:
  20.  
  21. 'Find the right date for Easter.
  22. PAQUES:
  23. pqm = Int(PQA / 100): PQ1 = PQA - pqm * 100: PQJ = Int(((PQA / 19 - Int(PQA / 19)) + .001) * 19)
  24. PQ2 = Int(pqm / 4): PQ3 = Int(((pqm / 4) - PQ2 + .001) * 4): PQ4 = Int((8 + pqm) / 25)
  25. PQ5 = Int((1 + pqm - PQ4 + .001) / 3): PQ4 = (15 + 19 * PQJ + pqm - PQ2 - PQ5 + .001) / 30: PQ4 = PQ4 - Int(PQ4)
  26. PQ4 = Int(PQ4 * 30): PQ5 = Int(PQ1 / 4): PQ6 = ((PQ1 / 4) - PQ5) * 4
  27. PQ7 = (32 + 2 * PQ3 + 2 * PQ5 - PQ4 - PQ6 + .001) / 7: PQ7 = (PQ7 - Int(PQ7)) * 7: PQ6 = (PQJ + 11 * PQ4 + 22 * PQ7) / 451
  28. PQ6 = Int(PQ6): PQ2 = (114 + PQ4 + PQ7 - 7 * PQ6) / 31: pqm = Int(PQ2): PQJ = Int((PQ2 - pqm + .001) * 31 + 1)
  29.  

 

10
Programs / Ken's U.S. Flag version 4 - With moving clouds
« on: February 09, 2022, 12:47:16 am »
Tonight I was going over a list of my old apps I made and remembered that I made a U.S. flag. So I found one I made that is waving and has random hills in the background and decided to add the new moving clouds in the sky that Vince has been using. Just by chance the flag is moving the same direction as the clouds. :) Press the Space Bar to get different random hills. Feel free to mod mod mod. :D Thanks Vince and someone named rattrapmax6!

(Code deleted because of a memory leak, please get the one below instead.)

11
Programs / 4 Letter Word Invaders Game
« on: February 05, 2022, 08:47:14 pm »
Test your typing skills by typing a random 4 letter word that falls as you type. There are 500 4-letter words that it chooses from. Get 40 right before losing all your lives wins. It's possible the same word is used more than once. Others may have made this game in the past, I'm pretty sure I saw it back in the 90's somewhere. But I thought I would give it a try myself. Each word you type right makes the next one go faster. No need to press the Enter key, it uses INKEY$. I've played a couple times and can only get to 39. Good luck!

Code: QB64: [Select]
  1. '4 Letter Word Invaders Game
  2. 'By SierraKen on Feb. 5, 2022
  3. '
  4. 'Test your typing skills by typing each word that falls. No need press the Enter key.
  5. 'The more you get right, the faster it goes. 40 points wins. Good Luck!
  6.  
  7. Dim a$(600)
  8. For t = 1 To 500
  9.     Read a$(t)
  10. Screen _NewImage(800, 600, 32)
  11. Color _RGB32(255, 255, 255)
  12. start:
  13. score = 0
  14. speed = .5
  15. lives = 5
  16. score$ = Str$(score)
  17. lives$ = Str$(lives)
  18. s$ = "Score: " + score$ + " Lives: " + lives$
  19.  
  20.     x = Rnd * 750
  21.     y = 5
  22.     tt = Int(Rnd * 500) + 1
  23.     word$ = a$(tt)
  24.     c = 1
  25.     Do
  26.         y = y + 10
  27.         If y > 500 Then
  28.             Sound 250, 1
  29.             Sound 150, 1
  30.             lives = lives - 1
  31.             score$ = Str$(score)
  32.             lives$ = Str$(lives)
  33.             s$ = "Score: " + score$ + " Lives: " + lives$
  34.             _Title s$
  35.             If lives = 0 Then
  36.                 Print "    Y o u  L o s e !"
  37.                 Print: Print
  38.                 Input "Again (Y/N)"; ag$
  39.                 If Left$(ag$, 1) = "y" Or Left$(ag$, 1) = "Y" Then GoTo start:
  40.                 End
  41.             End If
  42.             GoTo more:
  43.         End If
  44.         _PrintString (x, y), word$
  45.         Locate 25, 1
  46.         Print "->";
  47.         w$ = InKey$
  48.         If w$ = Chr$(27) Then End
  49.         Locate 25, 3 + c: Print w$
  50.         If w$ <> "" Then
  51.             If w$ = Mid$(word$, c, 1) Then
  52.                 c = c + 1
  53.                 If c > 4 Then
  54.                     Sound 850, .5
  55.                     speed = speed - .0125
  56.                     score = score + 1
  57.                     score$ = Str$(score)
  58.                     lives$ = Str$(lives)
  59.                     s$ = "Score: " + score$ + " Lives: " + lives$
  60.                     _Title s$
  61.                     If score = 40 Then
  62.                         Print "    Y O U   W I N ! ! ! ! ! ! !"
  63.                         Print: Print
  64.                         Input "Again (Y/N)"; ag$
  65.                         If Left$(ag$, 1) = "y" Or Left$(ag$, 1) = "Y" Then GoTo start:
  66.                         End
  67.                     End If
  68.                     _Display
  69.                     Cls
  70.                     GoTo more:
  71.                 End If
  72.             Else
  73.                 c = 1
  74.             End If
  75.         End If
  76.         _Delay speed
  77.         _Display
  78.         Cls
  79.     Loop
  80.     more:
  81.  
  82. Data able,acid,aged,also,area,army,away,baby,back,ball
  83. Data band,bank,base,bath,bear,beat,been,beer,bell,belt
  84. Data best,bill,bird,blow,blue,boat,body,bomb,bond,bone
  85. Data book,boom,born,boss,both,bowl,bulk,burn,bush,busy
  86. Data call,calm,came,camp,card,care,case,cash,cast,cell
  87. Data chat,chip,city,club,coal,coat,code,cold,come,cook
  88. Data cool,cope,copy,core,cost,crew,crop,dark,data,date
  89. Data dawn,days,dead,deal,dean,dear,debt,deep,deny,desk
  90. Data dial,dock,diet,disc,disk,does,done,door,dose,down
  91. Data draw,drew,drop,drug,dual,duke,dust,duty,each,earn
  92. Data ease,east,easy,edge,else,even,ever,evil,exit,face
  93. Data fact,fail,fair,fall,farm,fast,fate,fear,feed,feel
  94. Data feet,fell,felt,file,fill,film,find,fine,fire,firm
  95. Data fish,five,flat,flow,food,foot,ford,form,fort,four
  96. Data free,from,fuel,full,fund,gain,game,gate,gave,gear
  97. Data gene,gift,girl,give,glad,goal,goes,gold,Golf,gone
  98. Data good,gray,grew,grey,grow,gulf,hair,half,hall,hand
  99. Data hang,hard,harm,hate,have,head,hear,heat,held,hell
  100. Data help,here,hero,high,hill,hire,hold,hole,holy,home
  101. Data hope,host,hour,huge,hung,hunt,hurt,idea,inch,into
  102. Data iron,item,jack,jane,jean,john,join,jump,jury,just
  103. Data keen,keep,kent,kept,kick,kill,kind,king,knee,knew
  104. Data know,lack,lady,laid,lake,land,lane,last,late,lead
  105. Data left,less,life,lift,like,line,link,list,live,load
  106. Data loan,lock,logo,long,look,lord,lose,loss,lost,love
  107. Data luck,made,mail,main,make,male,many,mark,mass,matt
  108. Data meal,mean,meat,meet,menu,mere,mike,mile,milk,mill
  109. Data mind,mine,miss,mode,mood,moon,more,most,move,much
  110. Data must,name,navy,near,neck,need,news,next,nice,nick
  111. Data nine,none,nose,note,okay,once,only,onto,open,oral
  112. Data over,pace,pack,page,paid,pain,pair,palm,park,part
  113. Data pass,past,path,peak,pick,pink,pipe,plan,play,plot
  114. Data plug,plus,poll,pool,poor,port,post,pull,pure,push
  115. Data race,rail,rain,rank,rare,rate,read,real,rear,rely
  116. Data rent,rest,rice,rich,ride,ring,rise,risk,road,rock
  117. Data role,roll,roof,room,root,rose,rule,rush,ruth,safe
  118. Data said,sake,sale,salt,same,sand,save,seat,seed,seek
  119. Data seem,seen,self,sell,send,sent,sept,ship,shop,shot
  120. Data show,shut,sick,side,sign,site,size,skin,slip,slow
  121. Data snow,soft,soil,sold,sole,some,song,soon,sort,soul
  122. Data spot,star,stay,step,stop,such,suit,sure,take,tale
  123. Data talk,tall,tank,tape,task,team,tech,tell,tend,term
  124. Data test,text,than,that,them,then,they,thin,this,thus
  125. Data till,time,tiny,told,toll,tone,tony,took,tool,tour
  126. Data town,tree,trip,true,tune,turn,twin,type,unit,upon
  127. Data used,user,vary,vast,very,vice,view,vote,wage,wait
  128. Data wake,walk,wall,want,ward,warm,wash,wave,ways,weak
  129. Data wear,week,well,went,were,west,what,when,whom,wide
  130. Data wife,wild,will,wind,wine,wing,wire,wise,wish,with
  131. Data wood,word,wore,work,yard,yeah,year,your,zero,zone
  132.  

12
Programs / Tool to convert word list to DATA lines
« on: February 05, 2022, 04:02:27 pm »
I've been thinking about making some kind of word game, so I found a list online of 549 4-letter words, which I might use. But I needed a tool to convert 549 lines of a text file to DATA lines with 10 words on each line. So I decided to make this tool. It doesn't put quotation marks around the words which an awesome thing about QB64 is that you don't need them. :) I'll post the app code first, then the original list of words, then an output text file I made with it (you can make any kind of text-type file with it including .bas). I hope some of you can use this, I know I will. :)
I'm sure you can also use this with a list of numbers, but I haven't tried that yet.

*Edit: An updated version is after this post.

Here is the list to DATA lines tool:
Code: QB64: [Select]
  1. 'This is a tool to convert a list of words or numbers to DATA lines.
  2. Input "Filename To Read From: "; filename$
  3. Input "Filename To Output To: "; filename2$
  4. Open filename$ For Input As #1
  5. Open filename2$ For Output As #2
  6.     For words = 1 To 10
  7.         Input #1, a$
  8.         If words = 1 Then
  9.             b$ = "DATA " + a$ + ", "
  10.             Print #2, b$;
  11.         Else
  12.             If words < 10 Then
  13.                 c$ = a$ + ", "
  14.                 Print #2, c$;
  15.                 If EOF(1) Then GoTo done:
  16.             Else
  17.                 c$ = a$
  18.                 Print #2, c$
  19.                 If EOF(1) Then GoTo done:
  20.             End If
  21.         End If
  22.     Next words
  23. done:
  24.  

Here is the original list of words I used:
Code: QB64: [Select]
  1. Area
  2. Army
  3. Baby
  4. Back
  5. Ball
  6. Band
  7. Bank
  8. Bill
  9. Body
  10. Book
  11. Card
  12. Care
  13. Cash
  14. City
  15. Club
  16. Cost
  17. Date
  18. Deal
  19. Door
  20. Duty
  21. East
  22. Edge
  23. Face
  24. Fact
  25. Farm
  26. Fear
  27. Fig
  28. File
  29. Film
  30. Fire
  31. Firm
  32. Fish
  33. Food
  34. Foot
  35. Form
  36. Fund
  37. Game
  38. Girl
  39. Goal
  40. Gold
  41. Hair
  42. Half
  43. Hall
  44. Hand
  45. Head
  46. Help
  47. Hill
  48. Home
  49. Hope
  50. Hour
  51. Idea
  52. Jack
  53. John
  54. Kind
  55. King
  56. Lack
  57. Lady
  58. Land
  59. Life
  60. Look
  61. Lord
  62. Loss
  63. Love
  64. Mark
  65. Mary
  66. Mind
  67. Miss
  68. Move
  69. Need
  70. News
  71. Note
  72. Page
  73. Pain
  74. Pair
  75. Park
  76. Part
  77. Past
  78. Path
  79. Paul
  80. Plan
  81. Post
  82. Race
  83. Rain
  84. Rate
  85. Rest
  86. Rise
  87. Risk
  88. Road
  89. Rock
  90. Role
  91. Room
  92. Rule
  93. Sale
  94. Seat
  95. Shop
  96. Show
  97. Side
  98. Sign
  99. Site
  100. Size
  101. Skin
  102. Sort
  103. Star
  104. Task
  105. Team
  106. Term
  107. Test
  108. Text
  109. Time
  110. Tour
  111. Town
  112. Tree
  113. Turn
  114. Unit
  115. User
  116. Wall
  117. Week
  118. West
  119. Wife
  120. Will
  121. Wind
  122. Wine
  123. Wood
  124. Word
  125. Work
  126. Year
  127. Dese
  128. Enuf
  129. Feel
  130. Hern
  131. Hers
  132. Many
  133. Mine
  134. Mine
  135. Much
  136. Nada
  137. Nish
  138. None
  139. Nowt
  140. Ours
  141. Same
  142. Self
  143. Some
  144. Such
  145. That
  146. Thee
  147. Them
  148. They
  149. This
  150. Thon
  151. Thor
  152. Thou
  153. Thou
  154. Tone
  155. What
  156. When
  157. Whom
  158. Yere
  159. Your
  160. Bear
  161. Beat
  162. Blow
  163. Burn
  164. Care
  165. Cast
  166. Come
  167. Cook
  168. Cope
  169. Cost
  170. Dare
  171. Deal
  172. Deny
  173. Drop
  174. Earn
  175. Face
  176. Fail
  177. Fall
  178. Fear
  179. Feel
  180. Fill
  181. Find
  182. Form
  183. Gain
  184. Give
  185. Grow
  186. Hang
  187. Hate
  188. Have
  189. Head
  190. Hear
  191. Help
  192. Hide
  193. Hold
  194. Hope
  195. Hurt
  196. Join
  197. Jump
  198. Keep
  199. Know
  200. Land
  201. Last
  202. Lead
  203. Lend
  204. Lift
  205. Like
  206. Link
  207. Live
  208. Look
  209. Lose
  210. Love
  211. Make
  212. Mark
  213. Meet
  214. Mind
  215. Miss
  216. Move
  217. Must
  218. Need
  219. Note
  220. Pass
  221. Pick
  222. Plan
  223. Pray
  224. Pull
  225. Push
  226. Rely
  227. Rest
  228. Ride
  229. Ring
  230. Rise
  231. Risk
  232. Roll
  233. Rule
  234. Save
  235. Seem
  236. Sell
  237. Send
  238. Shed
  239. Show
  240. Shut
  241. Sign
  242. Sing
  243. Slip
  244. Sort
  245. Stay
  246. Suit
  247. Take
  248. Talk
  249. Tell
  250. Tend
  251. Test
  252. Turn
  253. Vary
  254. Vote
  255. Wake
  256. Walk
  257. Want
  258. Warn
  259. Wash
  260. Wear
  261. Will
  262. Wish
  263. Work
  264. Able
  265. Back
  266. Bare
  267. Bass
  268. Blue
  269. Bold
  270. Busy
  271. Calm
  272. Cold
  273. Cool
  274. Damp
  275. Dark
  276. Dead
  277. Deaf
  278. Dear
  279. Deep
  280. Dual
  281. Dull
  282. Dumb
  283. Easy
  284. Evil
  285. Fair
  286. Fast
  287. Fine
  288. Firm
  289. Flat
  290. Fond
  291. Foul
  292. Full
  293. Glad
  294. Good
  295. Grey
  296. Grim
  297. Half
  298. Hard
  299. Head
  300. High
  301. Holy
  302. Huge
  303. Just
  304. Keen
  305. Kind
  306. Last
  307. Late
  308. Lazy
  309. Like
  310. Live
  311. Lone
  312. Loud
  313. Main
  314. Male
  315. Mass
  316. Mean
  317. Mere
  318. Mild
  319. Nazi
  320. Near
  321. Neat
  322. Nice
  323. Okay
  324. Oral
  325. Pale
  326. Past
  327. Pink
  328. Poor
  329. Pure
  330. Rare
  331. Real
  332. Rear
  333. Rich
  334. Rude
  335. Safe
  336. Same
  337. Sick
  338. Slim
  339. Slow
  340. Soft
  341. Sole
  342. Sore
  343. Sure
  344. Tall
  345. Thin
  346. Tidy
  347. Tiny
  348. Tory
  349. True
  350. Ugly
  351. Vain
  352. Vast
  353. Very
  354. Vice
  355. Warm
  356. Wary
  357. Weak
  358. Wide
  359. Wild
  360. Wise
  361. Zero
  362. Both
  363. Ergo
  364. Lest
  365. Like
  366. Once
  367. Plus
  368. Save
  369. Sith
  370. Than
  371. That
  372. Thou
  373. Till
  374. Unto
  375. When
  376. Some
  377. Ably
  378. Afar
  379. Anew
  380. Away
  381. Back
  382. Damn
  383. Dead
  384. Deep
  385. Down
  386. Duly
  387. Easy
  388. Even
  389. Ever
  390. Fair
  391. Fast
  392. Flat
  393. Full
  394. Good
  395. Half
  396. Hard
  397. Here
  398. High
  399. Home
  400. Idly
  401. Just
  402. Late
  403. Like
  404. Live
  405. Loud
  406. Much
  407. Near
  408. Nice
  409. Okay
  410. Once
  411. Over
  412. Part
  413. Past
  414. Real
  415. Slow
  416. Solo
  417. Soon
  418. Sure
  419. That
  420. This
  421. Thus
  422. Very
  423. When
  424. Wide
  425. Ajax
  426. Amid
  427. Anti
  428. Apud
  429. Atop
  430. Bout
  431. Chez
  432. Come
  433. Dahn
  434. Doon
  435. Down
  436. From
  437. Gain
  438. Half
  439. Into
  440. Like
  441. Mang
  442. Mong
  443. Near
  444. Nigh
  445. Offa
  446. Onto
  447. Outa
  448. Over
  449. Past
  450. Post
  451. Save
  452. Than
  453. Thro
  454. Thru
  455. Till
  456. Unto
  457. Upon
  458. Vice
  459. Whiz
  460. With
  461. Ahem
  462. Ahoy
  463. Alas
  464. Amen
  465. Bang
  466. Blah
  467. Ciao
  468. Crud
  469. Damn
  470. Darn
  471. Egad
  472. Eina
  473. Fact
  474. Flip
  475. Fore
  476. Gosh
  477. Heck
  478. Hell
  479. Here
  480. Hist
  481. Hiya
  482. Hmmm
  483. Hmph
  484. Honk
  485. Hunh
  486. Jeez
  487. Jinx
  488. Like
  489. Lord
  490. Meow
  491. Mwah
  492. Nome
  493. Nyet
  494. Okay
  495. Oops
  496. Ouch
  497. Phew
  498. Phut
  499. Poof
  500. Pooh
  501. Pugh
  502. Shoo
  503. Snap
  504. Sure
  505. Tara
  506. This
  507. Urgh
  508. Wall
  509. Waly
  510. Wham
  511. Whoa
  512. Word
  513. Yuck
  514.  

Here is the output of DATA lines I made with it. I noticed that the last word has a comma but I don't believe that will hurt anything.
Code: QB64: [Select]
  1. DATA Area, Army, Baby, Back, Ball, Band, Bank, Base, Bill, Body
  2. DATA Book, Call, Card, Care, Case, Cash, City, Club, Cost, Date
  3. DATA Deal, Door, Duty, East, Edge, Face, Fact, Farm, Fear, Fig
  4. DATA File, Film, Fire, Firm, Fish, Food, Foot, Form, Fund, Game
  5. DATA Girl, Goal, Gold, Hair, Half, Hall, Hand, Head, Help, Hill
  6. DATA Home, Hope, Hour, Idea, Jack, John, Kind, King, Lack, Lady
  7. DATA Land, Life, Line, List, Look, Lord, Loss, Love, Mark, Mary
  8. DATA Mind, Miss, Move, Name, Need, News, Note, Page, Pain, Pair
  9. DATA Park, Part, Past, Path, Paul, Plan, Play, Post, Race, Rain
  10. DATA Rate, Rest, Rise, Risk, Road, Rock, Role, Room, Rule, Sale
  11. DATA Seat, Shop, Show, Side, Sign, Site, Size, Skin, Sort, Star
  12. DATA Step, Task, Team, Term, Test, Text, Time, Tour, Town, Tree
  13. DATA Turn, Type, Unit, User, View, Wall, Week, West, Wife, Will
  14. DATA Wind, Wine, Wood, Word, Work, Year, Dese, Enuf, Feel, Hern
  15. DATA Hers, Many, Mine, Mine, Much, Nada, Nish, None, Nowt, Ours
  16. DATA Same, Self, Some, Such, That, Thee, Them, They, This, Thon
  17. DATA Thor, Thou, Thou, Tone, What, When, Whom, Yere, Your, Bear
  18. DATA Beat, Blow, Burn, Call, Care, Cast, Come, Cook, Cope, Cost
  19. DATA Dare, Deal, Deny, Draw, Drop, Earn, Face, Fail, Fall, Fear
  20. DATA Feel, Fill, Find, Form, Gain, Give, Grow, Hang, Hate, Have
  21. DATA Head, Hear, Help, Hide, Hold, Hope, Hurt, Join, Jump, Keep
  22. DATA Kill, Know, Land, Last, Lead, Lend, Lift, Like, Link, Live
  23. DATA Look, Lose, Love, Make, Mark, Meet, Mind, Miss, Move, Must
  24. DATA Name, Need, Note, Open, Pass, Pick, Plan, Play, Pray, Pull
  25. DATA Push, Read, Rely, Rest, Ride, Ring, Rise, Risk, Roll, Rule
  26. DATA Save, Seek, Seem, Sell, Send, Shed, Show, Shut, Sign, Sing
  27. DATA Slip, Sort, Stay, Step, Stop, Suit, Take, Talk, Tell, Tend
  28. DATA Test, Turn, Vary, View, Vote, Wait, Wake, Walk, Want, Warn
  29. DATA Wash, Wear, Will, Wish, Work, Able, Back, Bare, Bass, Blue
  30. DATA Bold, Busy, Calm, Cold, Cool, Damp, Dark, Dead, Deaf, Dear
  31. DATA Deep, Dual, Dull, Dumb, Easy, Evil, Fair, Fast, Fine, Firm
  32. DATA Flat, Fond, Foul, Free, Full, Glad, Good, Grey, Grim, Half
  33. DATA Hard, Head, High, Holy, Huge, Just, Keen, Kind, Last, Late
  34. DATA Lazy, Like, Live, Lone, Long, Loud, Main, Male, Mass, Mean
  35. DATA Mere, Mild, Nazi, Near, Neat, Next, Nice, Okay, Only, Open
  36. DATA Oral, Pale, Past, Pink, Poor, Pure, Rare, Real, Rear, Rich
  37. DATA Rude, Safe, Same, Sick, Slim, Slow, Soft, Sole, Sore, Sure
  38. DATA Tall, Then, Thin, Tidy, Tiny, Tory, True, Ugly, Vain, Vast
  39. DATA Very, Vice, Warm, Wary, Weak, Wide, Wild, Wise, Zero, Both
  40. DATA Else, Ergo, Lest, Like, Once, Only, Plus, Save, Sith, Than
  41. DATA That, Then, Thou, Till, Unto, When, Some, Ably, Afar, Anew
  42. DATA Away, Back, Damn, Dead, Deep, Down, Duly, Easy, Else, Even
  43. DATA Ever, Fair, Fast, Flat, Full, Good, Half, Hard, Here, High
  44. DATA Home, Idly, Just, Late, Like, Live, Long, Loud, Much, Near
  45. DATA Nice, Okay, Once, Only, Over, Part, Past, Real, Slow, Solo
  46. DATA Soon, Sure, That, Then, This, Thus, Very, When, Wide, Ajax
  47. DATA Amid, Anti, Apud, Atop, Bout, Chez, Come, Dahn, Doon, Down
  48. DATA From, Gain, Half, Into, Like, Mang, Mong, Near, Nigh, Offa
  49. DATA Onto, Outa, Over, Past, Post, Save, Than, Thro, Thru, Till
  50. DATA Unto, Upon, Vice, Whiz, With, Ahem, Ahoy, Alas, Amen, Bang
  51. DATA Blah, Ciao, Crud, Damn, Darn, Egad, Eina, Fact, Flip, Fore
  52. DATA Gosh, Heck, Hell, Here, Hist, Hiya, Hmmm, Hmph, Honk, Hunh
  53. DATA Jeez, Jinx, Like, Lord, Meow, Mwah, Nome, Nyet, Okay, Oops
  54. DATA Ouch, Phew, Phut, Poof, Pooh, Pugh, Shoo, Snap, Stop, Sure
  55. DATA Tara, This, Urgh, Wall, Waly, Wham, Whoa, Word, Yuck,
  56.  

13
Programs / LCD Clock With Speech And Bouncing Ball
« on: January 27, 2022, 06:55:28 pm »
Using an old LCD clock I made a few years ago, I added a woman's voice to it when you click it, and a ball that bounces around. The speech reads the title of the month, not the number of the month, as well as the date and time.

Edit: You will need to add this LCD.TTF font file to your folder, or Windows Fonts folder. I think you can just add it to your QB64 folder where you save this app anyway. If not, put it in your Windows Fonts folder that has the rest of your fonts. 

Code: QB64: [Select]
  1. 'By SierraKen on January 27, 2022.
  2. _Title "Digital Time and Date - Click to Listen."
  3.  
  4. Screen _NewImage(400, 200, 32)
  5. rootpath$ = Environ$("SYSTEMROOT") 'normally "C:\WINDOWS"
  6. fontfile$ = rootpath$ + "\Fonts\Lcd.ttf" 'TTF file in Windows
  7. style$ = "bold" 'font style is not case sensitive
  8. f& = _LoadFont(fontfile$, 72, style$)
  9. _Font f& '
  10. ballx = 200: bally = 100
  11. redo:
  12. dx = (Rnd * 5) - 5
  13. dy = (Rnd * 5) - 5
  14. If dx = 0 And dy = 0 Then GoTo redo:
  15. If dx < .25 And dx > -.25 Then GoTo redo:
  16. If dy < .25 And dy > -.25 Then GoTo redo:
  17.  
  18.  
  19. Dim message As String
  20. Dim message2 As String
  21.     _Limit 30
  22.  
  23.     t$ = Time$
  24.     hour$ = Left$(t$, 2)
  25.     h = Val(hour$)
  26.     If h > 11 Then pmam$ = " PM"
  27.     If h < 12 Then pmam$ = " AM"
  28.     If h > 12 Then h = h - 12: hour$ = Str$(h)
  29.     minute$ = Mid$(t$, 4, 2)
  30.     second$ = Right$(t$, 2)
  31.     Color _RGB32(127, 255, 127), _RGB32(0, 0, 0)
  32.     _PrintString (10, 10), hour$ + ":" + minute$ + ":" + second$ + pmam$
  33.     _PrintString (10, 100), Date$
  34.     ball ballx, bally, dx, dy
  35.         mouseX = _MouseX
  36.         mouseY = _MouseY
  37.         mouseLeftButton = _MouseButton(1)
  38.     Loop
  39.     If mouseLeftButton = -1 Then
  40.         mouseLeftButton = 0
  41.         If Left$(Date$, 2) = "01" Then month$ = "January"
  42.         If Left$(Date$, 2) = "02" Then month$ = "February"
  43.         If Left$(Date$, 2) = "03" Then month$ = "March"
  44.         If Left$(Date$, 2) = "04" Then month$ = "April"
  45.         If Left$(Date$, 2) = "05" Then month$ = "May"
  46.         If Left$(Date$, 2) = "06" Then month$ = "June"
  47.         If Left$(Date$, 2) = "07" Then month$ = "July"
  48.         If Left$(Date$, 2) = "08" Then month$ = "August"
  49.         If Left$(Date$, 2) = "09" Then month$ = "September"
  50.         If Left$(Date$, 2) = "10" Then month$ = "October"
  51.         If Left$(Date$, 2) = "11" Then month$ = "November"
  52.         If Left$(Date$, 2) = "12" Then month$ = "December"
  53.         day$ = Mid$(Date$, 4, 2)
  54.         year$ = Right$(Date$, 4)
  55.         message = "The time is " + hour$ + minute$ + pmam$ + " and " + second$ + " seconds."
  56.         speak message
  57.         message = "The date today is " + month$ + " " + day$ + " " + year$
  58.         speak message
  59.     End If
  60.  
  61.  
  62.  
  63.     _Display
  64.     Cls
  65.  
  66.  
  67. Sub ball (ballx, bally, dx, dy)
  68.     _Limit 100
  69.  
  70.     ballx = ballx + dx
  71.     bally = bally + dy
  72.     more:
  73.     If ballx < 0 Then dx = 5: dy = (Rnd * 5) - 5
  74.     If ballx > 400 Then dx = -5: dy = (Rnd * 5) - 5
  75.     If bally < 0 Then dy = 5: dx = (Rnd * 5) - 5
  76.     If bally > 200 Then dy = -5: dx = (Rnd * 5) - 5
  77.     If dx = 0 And dy = 0 Then GoTo more:
  78.     If dx < .25 And dx > -.25 Then GoTo more:
  79.     If dy < .25 And dy > -.25 Then GoTo more:
  80.  
  81.     r = 15
  82.     c = _RGB(0, 0, 255)
  83.     cx = ballx
  84.     cy = bally
  85.     fillCircle cx, cy, r, c
  86.  
  87.     _Display
  88.     Line (0, 0)-(_Width, _Height), _RGB32(0, 0, 0, 20), BF
  89.  
  90.  
  91. 'from Steve Gold standard
  92. Sub fillCircle (CX As Integer, CY As Integer, R As Integer, C As _Unsigned Long)
  93.     Dim Radius As Integer, RadiusError As Integer
  94.     Dim X As Integer, Y As Integer
  95.     Radius = Abs(R): RadiusError = -Radius: X = Radius: Y = 0
  96.     If Radius = 0 Then PSet (CX, CY), C: Exit Sub
  97.     Line (CX - X, CY)-(CX + X, CY), C, BF
  98.     While X > Y
  99.         RadiusError = RadiusError + Y * 2 + 1
  100.         If RadiusError >= 0 Then
  101.             If X <> Y + 1 Then
  102.                 Line (CX - Y, CY - X)-(CX + Y, CY - X), C, BF
  103.                 Line (CX - Y, CY + X)-(CX + Y, CY + X), C, BF
  104.             End If
  105.             X = X - 1
  106.             RadiusError = RadiusError - X * 2
  107.         End If
  108.         Y = Y + 1
  109.         Line (CX - X, CY - Y)-(CX + X, CY - Y), C, BF
  110.         Line (CX - X, CY + Y)-(CX + X, CY + Y), C, BF
  111.     Wend
  112.  
  113. 'Windows only, I think
  114. Sub speak (message As String)
  115.     out$ = "Powershell -Command " + Chr$(34)
  116.     out$ = out$ + "Add-Type -AssemblyName System.Speech; "
  117.     out$ = out$ + "$Speech = New-Object System.Speech.Synthesis.SpeechSynthesizer; "
  118.     out$ = out$ + "$Speech.SelectVoice('Microsoft Zira Desktop'); "
  119.     out$ = out$ + "$Speech.Speak('" + message + "');" + Chr$(34)
  120.     Shell _Hide out$
  121.  

14
Programs / 60 Or Less Pasted Sentences At-Once Text To Speech Reader
« on: January 25, 2022, 08:06:32 pm »
Using B+'s and Steve's text-to-speech code, I added it with Steve's text pasting code and now we got a text-to-speech reader that reads almost any text that you can paste. There is a 60 sentence, or so, limit, because I didn't want people to accidentally copy a whole book and have it read all at once. There really isn't a way to stop the speech either because it uses Windows Power Shell, besides turning your computer off. This is probably a Windows-only app. I tested it with about 58 sentences from the Bible and it worked fine. I did run into a small problem that I fixed, which was that it stopped working altogether when it saw a quotation mark. So before it runs, I have it scan all of the text and delete anything before or after the text and number ASCII code numbers. Between the numbers and text there's a couple of punctuation marks and a few I added like the question mark, period, and comma, and a couple others. I haven't tried every possibility but it should work OK. Feel free to play around with it. Thank you to B+ and Steve (SMCNeil) for their very hard work. Hopefully people can make use of this app. Have fun!

Code: QB64: [Select]
  1. 'Thanks to B+ for the audio code and Steve (SMCNeil) for the paste code!
  2. _Title "Text Reader"
  3. Screen _NewImage(800, 600, 32)
  4. start:
  5. Print "CTRL-V to paste text and then press Enter to read through your speakers (Around a 60 sentence limit at a time.): "
  6. ExtendedInput information$
  7. Dim t(3000) As String
  8. For x = 1 To Len(information$)
  9.     If Asc(Mid$(information$, x, x)) < 40 Or Asc(Mid$(information$, x, x)) > 122 Then Mid$(information$, x, x) = " "
  10. t(i) = information$
  11. If Len(information$) > 10000 Then Print: Print "Too much text to read at once. Try again with less.": GoTo start:
  12. Print t(i)
  13. speak t(i)
  14. Print "Again (Y/N)";
  15.     ag$ = InKey$
  16.     If ag$ = "Y" Or ag$ = "y" Then Cls: GoTo start:
  17.     If ag$ = "N" Or ag$ = "n" Then End
  18.  
  19. Sub speak (message As String)
  20.     Shell _Hide "Powershell -Command " + Chr$(34) + "Add-Type -AssemblyName System.Speech; (New-Object System.Speech.Synthesis.SpeechSynthesizer).Speak('" + message + "');" + Chr$(34)
  21.  
  22. Sub ExtendedInput (out$)
  23.     PCopy 0, 1
  24.     A = _AutoDisplay: X = Pos(0): Y = CsrLin
  25.     CP = 0: OldCP = 0 'Cursor Position
  26.     _KeyClear
  27.     Do
  28.         PCopy 1, 0
  29.         If _KeyDown(100307) Or _KeyDown(100308) Then AltDown = -1 Else AltDown = 0
  30.         k = _KeyHit
  31.         If AltDown Then
  32.             Select Case k 'ignore all keypresses except ALT-number presses
  33.                 Case 48 TO 57: AltWasDown = -1: alt$ = alt$ + Chr$(k)
  34.             End Select
  35.         Else
  36.             Select Case k 'without alt, add any keypresses to our input
  37.                 Case 8
  38.                     oldin$ = in$
  39.                     If CP > 0 Then OldCP = CP: CP = CP - 1
  40.                     in$ = Left$(in$, CP) + Mid$(in$, CP + 2) 'backspace to erase input
  41.                 Case 9
  42.                     oldin$ = in$
  43.                     in$ = Left$(in$, CP) + Space$(4) + Mid$(in$, CP + 1) 'four spaces for any TAB entered
  44.                     OldCP = CP
  45.                     CP = CP + 4
  46.                 Case 32 TO 128
  47.                     If _KeyDown(100305) Or _KeyDown(100306) Then
  48.                         If k = 118 Or k = 86 Then
  49.                             oldin$ = in$
  50.                             in$ = Left$(in$, CP) + _Clipboard$ + Mid$(in$, CP + 1) 'ctrl-v paste
  51.                             'CTRL-V leaves cursor in position before the paste, without moving it after.
  52.                             'Feel free to modify that behavior here, if you want it to move to after the paste.
  53.                             'CP = CP + LEN(_CLIPBOARD$)
  54.                         End If
  55.                         If k = 122 Or k = 90 Then Swap in$, oldin$: Swap OldCP, CP 'ctrl-z undo
  56.                     Else
  57.                         oldin$ = in$
  58.                         in$ = Left$(in$, CP) + Chr$(k) + Mid$(in$, CP + 1) 'add input to our string
  59.                         OldCP = CP
  60.                         CP = CP + 1
  61.                     End If
  62.                 Case 18176 'Home
  63.                     CP = 0
  64.                 Case 20224 'End
  65.                     CP = Len(in$)
  66.                 Case 21248 'Delete
  67.                     oldin$ = in$
  68.                     in$ = Left$(in$, CP) + Mid$(in$, CP + 2)
  69.                 Case 19200 'Left
  70.                     CP = CP - 1
  71.                     If CP < 0 Then CP = 0
  72.                 Case 19712 'Right
  73.                     CP = CP + 1
  74.                     If CP > Len(in$) Then CP = Len(in$)
  75.             End Select
  76.         End If
  77.         alt$ = Right$(alt$, 3)
  78.         If AltWasDown = -1 And AltDown = 0 Then
  79.             v = Val(alt$)
  80.             If v >= 0 And v <= 255 Then in$ = in$ + Chr$(v)
  81.             alt$ = "": AltWasDown = 0
  82.         End If
  83.         blink = (blink + 1) Mod 30
  84.         Locate Y, X
  85.         Print Left$(in$, CP);
  86.         If blink \ 15 Then Print " "; Else Print "_";
  87.         Print Mid$(in$, CP + 1)
  88.  
  89.         _Display
  90.         _Limit 30
  91.     Loop Until k = 13
  92.  
  93.     PCopy 1, 0
  94.     Locate Y, X: Print in$
  95.     out$ = in$
  96.  
  97.  

15
Programs / Optical Illusion Clock
« on: January 22, 2022, 07:38:43 pm »
I used old code I had from my older analog clocks and added another hand to it which is 1/60 of a second and changed the colors. I also added an optical illusion design that also has a bit of moving color. The clock gongs the hour every hour too. The _Limit command is at 400 so the fast hand will have a smoother animation. Tell me what you think.

Code: QB64: [Select]
  1. _Title "Optical Illusion Clock"
  2. Screen _NewImage(350, 350, 32)
  3. i = _NewImage(350, 350, 32)
  4. ' ----------------------------------------
  5. ' Draw clock here and use  _DEST i and _DEST 0
  6. Circle (175, 175), 170, _RGB32(255, 255, 255)
  7.  
  8. For ls = 1 To 60
  9.     ss = (60 - ls) * 6 + 180
  10.     x = Int(Sin(ss / 180 * 3.141592) * 75) + 175
  11.     y = Int(Cos(ss / 180 * 3.141592) * 75) + 175
  12.     Line (x, y)-(x * 1.5, y * 1.5), _RGB32(255, 255, 255)
  13. Next ls
  14.  
  15. '-----------------------------------------
  16.  
  17.  
  18.     _Limit 400
  19.     hours = Timer \ 3600
  20.     minutes = Timer \ 60 - hours * 60
  21.     seconds = (Timer - hours * 3600 - minutes * 60)
  22.     qseconds = (seconds * 60)
  23.     ho$ = Left$(Time$, 2): hou = Val(ho$)
  24.     min$ = Mid$(Time$, 4, 2): minu = Val(min$)
  25.     seco$ = Right$(Time$, 2): secon = Val(seco$)
  26.     '1/60 of a second.
  27.     qs = (60 - qseconds) * 6 + 180
  28.     x = Int(Sin(qs / 180 * 3.141592) * 125) + 175
  29.     y = Int(Cos(qs / 180 * 3.141592) * 125) + 175
  30.     For b = -5 To 5 Step .5
  31.         Line (175 + b, 175)-(x, y), _RGB32(255, 255, 255)
  32.         Line (175, 175 + b)-(x, y), _RGB32(255, 255, 255)
  33.     Next b
  34.     x2 = Int(Sin(qs / 180 * 3.141592) * 170) + 175
  35.     y2 = Int(Cos(qs / 180 * 3.141592) * 170) + 175
  36.     For sz = .1 To 5 Step .1
  37.         Circle (x2, y2), sz, _RGB32(255, 255, 255)
  38.     Next sz
  39.     x2 = Int(Sin(qs / 180 * 3.141592) * 75) + 175
  40.     y2 = Int(Cos(qs / 180 * 3.141592) * 75) + 175
  41.     Line (x2, y2)-(x2 * 1.5, y2 * 1.5), _RGB32(127, 255, 127)
  42.     'Seconds
  43.     s = (60 - seconds) * 6 + 180
  44.     x = Int(Sin(s / 180 * 3.141592) * 125) + 175
  45.     y = Int(Cos(s / 180 * 3.141592) * 125) + 175
  46.     For b = -5 To 5 Step .5
  47.         Line (175 + b, 175)-(x, y), _RGB32(0, 255, 255)
  48.         Line (175, 175 + b)-(x, y), _RGB32(0, 255, 255)
  49.     Next b
  50.     x = Int(Sin(s / 180 * 3.141592) * 170) + 175
  51.     y = Int(Cos(s / 180 * 3.141592) * 170) + 175
  52.     For sz = .1 To 5 Step .1
  53.         Circle (x, y), sz, _RGB32(0, 255, 255)
  54.     Next sz
  55.     'Minutes
  56.     m = 180 - minutes * 6
  57.     xx = Int(Sin(m / 180 * 3.141592) * 120) + 175
  58.     yy = Int(Cos(m / 180 * 3.141592) * 120) + 175
  59.     For b = -5 To 5 Step .5
  60.         Line (175 + b, 175)-(xx, yy), _RGB32(127, 255, 127)
  61.         Line (175, 175 + b)-(xx, yy), _RGB32(127, 255, 127)
  62.     Next b
  63.     xx = Int(Sin(m / 180 * 3.141592) * 170) + 175
  64.     yy = Int(Cos(m / 180 * 3.141592) * 170) + 175
  65.     For sz = .1 To 5 Step .1
  66.         Circle (xx, yy), sz, _RGB32(127, 255, 127)
  67.     Next sz
  68.     'Hours
  69.     h = 360 - hours * 30 + 180
  70.     xxx = Int(Sin(h / 180 * 3.141592) * 50) + 175
  71.     yyy = Int(Cos(h / 180 * 3.141592) * 50) + 175
  72.     For b = -5 To 5 Step .5
  73.         Line (175 + b, 175)-(xxx, yyy), _RGB32(255, 122, 0)
  74.         Line (175, 175 + b)-(xxx, yyy), _RGB32(255, 122, 0)
  75.     Next b
  76.     xxx = Int(Sin(h / 180 * 3.141592) * 170) + 175
  77.     yyy = Int(Cos(h / 180 * 3.141592) * 170) + 175
  78.     For sz = .1 To 5 Step .1
  79.         Circle (xxx, yyy), sz, _RGB32(255, 122, 0)
  80.     Next sz
  81.  
  82.     For sz = .1 To 5
  83.         Circle (175, 175), sz, _RGB32(255, 255, 127)
  84.     Next sz
  85.  
  86.     'Chimes
  87.     If minu = 0 And secon = 0 Then
  88.         hour2 = hou
  89.         If hour2 > 12 Then hour2 = hour2 - 12
  90.         If hour2 = 0 Then hour2 = 12
  91.         For chimes = 1 To hour2
  92.             ttt = 0
  93.             Do
  94.                 'queue some sound
  95.                 Do While _SndRawLen < 0.1 'you may wish to adjust this
  96.                     sample = Sin(ttt * 340 * Atn(1) * 8) '340Hz sine wave (ttt * 440 * 2p)
  97.                     sample = sample * Exp(-ttt * 3) 'fade out eliminates clicks after sound
  98.                     _SndRaw sample
  99.                     ttt = ttt + 1 / _SndRate 'sound card sample frequency determines time
  100.                 Loop
  101.                 'do other stuff, but it may interrupt sound
  102.             Loop While ttt < 2 'play for 2 seconds
  103.             Do While _SndRawLen > 0 'Finish any left over queued sound!
  104.             Loop
  105.         Next chimes
  106.     End If
  107.     two:
  108.     _Display
  109.     Cls
  110.     _PutImage (0, 0)-(350, 350), i
  111.  

Pages: [1] 2 3 ... 11