Author Topic: Spell It Aloud (Help Requested)  (Read 9244 times)

0 Members and 1 Guest are viewing this topic.

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Spell It Aloud (Help Requested)
« Reply #15 on: July 31, 2019, 05:33:35 pm »
So, again, both sources synchronized to one:

Code: QB64: [Select]
  1. CONST AliceBlue = &HFFF0F8FF~& ' _RGB32(240,248,255)
  2. CONST Almond = &HFFEFDECD~& '_RGB32(239,222,205)
  3. CONST AntiqueBrass = &HFFCD9575~& '_RGB32(205,149,117)
  4. CONST AntiqueWhite = &HFFFAEBD7~& ' _RGB32(250,235,215)
  5. CONST Apricot = &HFFFDD9B5~& '_RGB32(253,217,181)
  6. CONST Aqua = &HFF00FFFF~& ' _RGB32(0,255,255)
  7. CONST Aquamarine = &HFF7FFFD4~& ' _RGB32(127,255,212)
  8. CONST Asparagus = &HFF87A96B~& '_RGB32(135,169,107)
  9. CONST AtomicTangerine = &HFFFFA474~& '_RGB32(255,164,116)
  10. CONST Azure = &HFFF0FFFF~& ' _RGB32(240,255,255)
  11. CONST BananaMania = &HFFFAE7B5~& '_RGB32(250,231,181)
  12. CONST Beaver = &HFF9F8170~& '_RGB32(159,129,112)
  13. CONST Beige = &HFFF5F5DC~& ' _RGB32(245,245,220)
  14. CONST Bisque = &HFFFFE4C4~& ' _RGB32(255,228,196)
  15. CONST Bittersweet = &HFFFD7C6E~& '_RGB32(253,124,110)
  16. CONST Black = &HFF000000~& ' _RGB32(0,0,0)
  17. CONST BlanchedAlmond = &HFFFFEBCD~& ' _RGB32(255,235,205)
  18. CONST BlizzardBlue = &HFFACE5EE~& '_RGB32(172,229,238)
  19. CONST Blue = &HFF0000FF~& ' _RGB32(0,0,255)
  20. CONST BlueBell = &HFFA2A2D0~& '_RGB32(162,162,208)
  21. CONST BlueGray = &HFF6699CC~& '_RGB32(102,153,204)
  22. CONST BlueGreen = &HFF0D98BA~& '_RGB32(13,152,186)
  23. CONST BlueViolet = &HFF8A2BE2~& ' _RGB32(138,43,226)
  24. CONST Blush = &HFFDE5D83~& '_RGB32(222,93,131)
  25. CONST BrickRed = &HFFCB4154~& '_RGB32(203,65,84)
  26. CONST Brown = &HFFA52A2A~& ' _RGB32(165,42,42)
  27. CONST BurlyWood = &HFFDEB887~& ' _RGB32(222,184,135)
  28. CONST BurntOrange = &HFFFF7F49~& '_RGB32(255,127,73)
  29. CONST BurntSienna = &HFFEA7E5D~& '_RGB32(234,126,93)
  30. CONST CadetBlue = &HFF5F9EA0~& ' _RGB32(95,158,160)
  31. CONST Canary = &HFFFFFF99~& '_RGB32(255,255,153)
  32. CONST CaribbeanGreen = &HFF1CD3A2~& '_RGB32(28,211,162)
  33. CONST CarnationPink = &HFFFFAACC~& '_RGB32(255,170,204)
  34. CONST Cerise = &HFFDD4492~& '_RGB32(221,68,146)
  35. CONST Cerulean = &HFF1DACD6~& '_RGB32(29,172,214)
  36. CONST ChartReuse = &HFF7FFF00~& ' _RGB32(127,255,0)
  37. CONST Chestnut = &HFFBC5D58~& '_RGB32(188,93,88)
  38. CONST Chocolate = &HFFD2691E~& ' _RGB32(210,105,30)
  39. CONST Copper = &HFFDD9475~& '_RGB32(221,148,117)
  40. CONST Coral = &HFFFF7F50~& ' _RGB32(255,127,80)
  41. CONST Cornflower = &HFF9ACEEB~& '_RGB32(154,206,235)
  42. CONST CornflowerBlue = &HFF6495ED~& ' _RGB32(100,149,237)
  43. CONST Cornsilk = &HFFFFF8DC~& ' _RGB32(255,248,220)
  44. CONST CottonCandy = &HFFFFBCD9~& '_RGB32(255,188,217)
  45. CONST CrayolaAquamarine = &HFF78DBE2~& '_RGB32(120,219,226)
  46. CONST CrayolaBlue = &HFF1F75FE~& '_RGB32(31,117,254)
  47. CONST CrayolaBlueViolet = &HFF7366BD~& '_RGB32(115,102,189)
  48. CONST CrayolaBrown = &HFFB4674D~& '_RGB32(180,103,77)
  49. CONST CrayolaCadetBlue = &HFFB0B7C6~& '_RGB32(176,183,198)
  50. CONST CrayolaForestGreen = &HFF6DAE81~& '_RGB32(109,174,129)
  51. CONST CrayolaGold = &HFFE7C697~& '_RGB32(231,198,151)
  52. CONST CrayolaGoldenrod = &HFFFCD975~& '_RGB32(252,217,117)
  53. CONST CrayolaGray = &HFF95918C~& '_RGB32(149,145,140)
  54. CONST CrayolaGreen = &HFF1CAC78~& '_RGB32(28,172,120)
  55. CONST CrayolaGreenYellow = &HFFF0E891~& '_RGB32(240,232,145)
  56. CONST CrayolaIndigo = &HFF5D76CB~& '_RGB32(93,118,203)
  57. CONST CrayolaLavender = &HFFFCB4D5~& '_RGB32(252,180,213)
  58. CONST CrayolaMagenta = &HFFF664AF~& '_RGB32(246,100,175)
  59. CONST CrayolaMaroon = &HFFC8385A~& '_RGB32(200,56,90)
  60. CONST CrayolaMidnightBlue = &HFF1A4876~& '_RGB32(26,72,118)
  61. CONST CrayolaOrange = &HFFFF7538~& '_RGB32(255,117,56)
  62. CONST CrayolaOrangeRed = &HFFFF2B2B~& '_RGB32(255,43,43)
  63. CONST CrayolaOrchid = &HFFE6A8D7~& '_RGB32(230,168,215)
  64. CONST CrayolaPlum = &HFF8E4585~& '_RGB32(142,69,133)
  65. CONST CrayolaRed = &HFFEE204D~& '_RGB32(238,32,77)
  66. CONST CrayolaSalmon = &HFFFF9BAA~& '_RGB32(255,155,170)
  67. CONST CrayolaSeaGreen = &HFF9FE2BF~& '_RGB32(159,226,191)
  68. CONST CrayolaSilver = &HFFCDC5C2~& '_RGB32(205,197,194)
  69. CONST CrayolaSkyBlue = &HFF80DAEB~& '_RGB32(128,218,235)
  70. CONST CrayolaSpringGreen = &HFFECEABE~& '_RGB32(236,234,190)
  71. CONST CrayolaTann = &HFFFAA76C~& '_RGB32(250,167,108)
  72. CONST CrayolaThistle = &HFFEBC7DF~& '_RGB32(235,199,223)
  73. CONST CrayolaViolet = &HFF926EAE~& '_RGB32(146,110,174)
  74. CONST CrayolaYellow = &HFFFCE883~& '_RGB32(252,232,131)
  75. CONST CrayolaYellowGreen = &HFFC5E384~& '_RGB32(197,227,132)
  76. CONST Crimson = &HFFDC143C~& ' _RGB32(220,20,60)
  77. CONST Cyan = &HFF00FFFF~& ' _RGB32(0,255,255)
  78. CONST Dandelion = &HFFFDDB6D~& '_RGB32(253,219,109)
  79. CONST DarkBlue = &HFF00008B~& ' _RGB32(0,0,139)
  80. CONST DarkCyan = &HFF008B8B~& ' _RGB32(0,139,139)
  81. CONST DarkGoldenRod = &HFFB8860B~& ' _RGB32(184,134,11)
  82. CONST DarkGray = &HFFA9A9A9~& ' _RGB32(169,169,169)
  83. CONST DarkGreen = &HFF006400~& ' _RGB32(0,100,0)
  84. CONST DarkKhaki = &HFFBDB76B~& ' _RGB32(189,183,107)
  85. CONST DarkMagenta = &HFF8B008B~& ' _RGB32(139,0,139)
  86. CONST DarkOliveGreen = &HFF556B2F~& ' _RGB32(85,107,47)
  87. CONST DarkOrange = &HFFFF8C00~& ' _RGB32(255,140,0)
  88. CONST DarkOrchid = &HFF9932CC~& ' _RGB32(153,50,204)
  89. CONST DarkRed = &HFF8B0000~& ' _RGB32(139,0,0)
  90. CONST DarkSalmon = &HFFE9967A~& ' _RGB32(233,150,122)
  91. CONST DarkSeaGreen = &HFF8FBC8F~& ' _RGB32(143,188,143)
  92. CONST DarkSlateBlue = &HFF483D8B~& ' _RGB32(72,61,139)
  93. CONST DarkSlateGray = &HFF2F4F4F~& ' _RGB32(47,79,79)
  94. CONST DarkTurquoise = &HFF00CED1~& ' _RGB32(0,206,209)
  95. CONST DarkViolet = &HFF9400D3~& ' _RGB32(148,0,211)
  96. CONST DeepPink = &HFFFF1493~& ' _RGB32(255,20,147)
  97. CONST DeepSkyBlue = &HFF00BFFF~& ' _RGB32(0,191,255)
  98. CONST Denim = &HFF2B6CC4~& '_RGB32(43,108,196)
  99. CONST DesertSand = &HFFEFCDB8~& '_RGB32(239,205,184)
  100. CONST DimGray = &HFF696969~& ' _RGB32(105,105,105)
  101. CONST DodgerBlue = &HFF1E90FF~& ' _RGB32(30,144,255)
  102. CONST Eggplant = &HFF6E5160~& '_RGB32(110,81,96)
  103. CONST ElectricLime = &HFFCEFF1D~& '_RGB32(206,255,29)
  104. CONST Fern = &HFF71BC78~& '_RGB32(113,188,120)
  105. CONST FireBrick = &HFFB22222~& ' _RGB32(178,34,34)
  106. CONST Floralwhite = &HFFFFFAF0~& ' _RGB32(255,250,240)
  107. CONST ForestGreen = &HFF228B22~& ' _RGB32(34,139,34)
  108. CONST Fuchsia = &HFFC364C5~& '_RGB32(195,100,197)
  109. CONST FuzzyWuzzy = &HFFCC6666~& '_RGB32(204,102,102)
  110. CONST Gainsboro = &HFFDCDCDC~& ' _RGB32(220,220,220)
  111. CONST GhostWhite = &HFFF8F8FF~& ' _RGB32(248,248,255)
  112. CONST Gold = &HFFFFD700~& ' _RGB32(255,215,0)
  113. CONST GoldenRod = &HFFDAA520~& ' _RGB32(218,165,32)
  114. CONST GrannySmithApple = &HFFA8E4A0~& '_RGB32(168,228,160)
  115. CONST Gray = &HFF808080~& ' _RGB32(128,128,128)
  116. CONST Green = &HFF008000~& ' _RGB32(0,128,0)
  117. CONST GreenBlue = &HFF1164B4~& '_RGB32(17,100,180)
  118. CONST GreenYellow = &HFFADFF2F~& ' _RGB32(173,255,47)
  119. CONST HoneyDew = &HFFF0FFF0~& ' _RGB32(240,255,240)
  120. CONST HotMagenta = &HFFFF1DCE~& '_RGB32(255,29,206)
  121. CONST HotPink = &HFFFF69B4~& ' _RGB32(255,105,180)
  122. CONST Inchworm = &HFFB2EC5D~& '_RGB32(178,236,93)
  123. CONST IndianRed = &HFFCD5C5C~& ' _RGB32(205,92,92)
  124. CONST Indigo = &HFF4B0082~& ' _RGB32(75,0,130)
  125. CONST Ivory = &HFFFFFFF0~& ' _RGB32(255,255,240)
  126. CONST JazzberryJam = &HFFCA3767~& '_RGB32(202,55,103)
  127. CONST JungleGreen = &HFF3BB08F~& '_RGB32(59,176,143)
  128. CONST Khaki = &HFFF0E68C~& ' _RGB32(240,230,140)
  129. CONST LaserLemon = &HFFFEFE22~& '_RGB32(254,254,34)
  130. CONST Lavender = &HFFE6E6FA~& ' _RGB32(230,230,250)
  131. CONST LavenderBlush = &HFFFFF0F5~& ' _RGB32(255,240,245)
  132. CONST LawnGreen = &HFF7CFC00~& ' _RGB32(124,252,0)
  133. CONST LemonChiffon = &HFFFFFACD~& ' _RGB32(255,250,205)
  134. CONST LemonYellow = &HFFFFF44F~& '_RGB32(255,244,79)
  135. CONST LightBlue = &HFFADD8E6~& ' _RGB32(173,216,230)
  136. CONST LightCoral = &HFFF08080~& ' _RGB32(240,128,128)
  137. CONST LightCyan = &HFFE0FFFF~& ' _RGB32(224,255,255)
  138. CONST LightGoldenRodYellow = &HFFFAFAD2~& ' _RGB32(250,250,210)
  139. CONST LightGray = &HFFD3D3D3~& ' _RGB32(211,211,211)
  140. CONST LightGreen = &HFF90EE90~& ' _RGB32(144,238,144)
  141. CONST LightPink = &HFFFFB6C1~& ' _RGB32(255,182,193)
  142. CONST LightSalmon = &HFFFFA07A~& ' _RGB32(255,160,122)
  143. CONST LightSeaGreen = &HFF20B2AA~& ' _RGB32(32,178,170)
  144. CONST LightSkyBlue = &HFF87CEFA~& ' _RGB32(135,206,250)
  145. CONST LightSlateGray = &HFF778899~& ' _RGB32(119,136,153)
  146. CONST LightSteelBlue = &HFFB0C4DE~& ' _RGB32(176,196,222)
  147. CONST LightYellow = &HFFFFFFE0~& ' _RGB32(255,255,224)
  148. CONST Lime = &HFF00FF00~& ' _RGB32(0,255,0)
  149. CONST LimeGreen = &HFF32CD32~& ' _RGB32(50,205,50)
  150. CONST Linen = &HFFFAF0E6~& ' _RGB32(250,240,230)
  151. CONST MacaroniAndCheese = &HFFFFBD88~& '_RGB32(255,189,136)
  152. CONST Magenta = &HFFFF00FF~& ' _RGB32(255,0,255)
  153. CONST MagicMint = &HFFAAF0D1~& '_RGB32(170,240,209)
  154. CONST Mahogany = &HFFCD4A4C~& '_RGB32(205,74,76)
  155. CONST Maize = &HFFEDD19C~& '_RGB32(237,209,156)
  156. CONST Manatee = &HFF979AAA~& '_RGB32(151,154,170)
  157. CONST MangoTango = &HFFFF8243~& '_RGB32(255,130,67)
  158. CONST Maroon = &HFF800000~& ' _RGB32(128,0,0)
  159. CONST Mauvelous = &HFFEF98AA~& '_RGB32(239,152,170)
  160. CONST MediumAquamarine = &HFF66CDAA~& ' _RGB32(102,205,170)
  161. CONST MediumBlue = &HFF0000CD~& ' _RGB32(0,0,205)
  162. CONST MediumOrchid = &HFFBA55D3~& ' _RGB32(186,85,211)
  163. CONST MediumPurple = &HFF9370DB~& ' _RGB32(147,112,219)
  164. CONST MediumSeaGreen = &HFF3CB371~& ' _RGB32(60,179,113)
  165. CONST MediumSlateBlue = &HFF7B68EE~& ' _RGB32(123,104,238)
  166. CONST MediumSpringGreen = &HFF00FA9A~& ' _RGB32(0,250,154)
  167. CONST MediumTurquoise = &HFF48D1CC~& ' _RGB32(72,209,204)
  168. CONST MediumVioletRed = &HFFC71585~& ' _RGB32(199,21,133)
  169. CONST Melon = &HFFFDBCB4~& '_RGB32(253,188,180)
  170. CONST MidnightBlue = &HFF191970~& ' _RGB32(25,25,112)
  171. CONST MintCream = &HFFF5FFFA~& ' _RGB32(245,255,250)
  172. CONST MistyRose = &HFFFFE4E1~& ' _RGB32(255,228,225)
  173. CONST Moccasin = &HFFFFE4B5~& ' _RGB32(255,228,181)
  174. CONST MountainMeadow = &HFF30BA8F~& '_RGB32(48,186,143)
  175. CONST Mulberry = &HFFC54B8C~& '_RGB32(197,75,140)
  176. CONST NavajoWhite = &HFFFFDEAD~& ' _RGB32(255,222,173)
  177. CONST Navy = &HFF000080~& ' _RGB32(0,0,128)
  178. CONST NavyBlue = &HFF1974D2~& '_RGB32(25,116,210)
  179. CONST NeonCarrot = &HFFFFA343~& '_RGB32(255,163,67)
  180. CONST OldLace = &HFFFDF5E6~& ' _RGB32(253,245,230)
  181. CONST Olive = &HFF808000~& ' _RGB32(128,128,0)
  182. CONST OliveDrab = &HFF6B8E23~& ' _RGB32(107,142,35)
  183. CONST OliveGreen = &HFFBAB86C~& '_RGB32(186,184,108)
  184. CONST Orange = &HFFFFA500~& ' _RGB32(255,165,0)
  185. CONST OrangeRed = &HFFFF4500~& ' _RGB32(255,69,0)
  186. CONST OrangeYellow = &HFFF8D568~& '_RGB32(248,213,104)
  187. CONST Orchid = &HFFDA70D6~& ' _RGB32(218,112,214)
  188. CONST OuterSpace = &HFF414A4C~& '_RGB32(65,74,76)
  189. CONST OutrageousOrange = &HFFFF6E4A~& '_RGB32(255,110,74)
  190. CONST PacificBlue = &HFF1CA9C9~& '_RGB32(28,169,201)
  191. CONST PaleGoldenRod = &HFFEEE8AA~& ' _RGB32(238,232,170)
  192. CONST PaleGreen = &HFF98FB98~& ' _RGB32(152,251,152)
  193. CONST PaleTurquoise = &HFFAFEEEE~& ' _RGB32(175,238,238)
  194. CONST PaleVioletRed = &HFFDB7093~& ' _RGB32(219,112,147)
  195. CONST PapayaWhip = &HFFFFEFD5~& ' _RGB32(255,239,213)
  196. CONST Peach = &HFFFFCFAB~& '_RGB32(255,207,171)
  197. CONST PeachPuff = &HFFFFDAB9~& ' _RGB32(255,218,185)
  198. CONST Periwinkle = &HFFC5D0E6~& '_RGB32(197,208,230)
  199. CONST Peru = &HFFCD853F~& ' _RGB32(205,133,63)
  200. CONST PiggyPink = &HFFFDDDE6~& '_RGB32(253,221,230)
  201. CONST PineGreen = &HFF158078~& '_RGB32(21,128,120)
  202. CONST Pink = &HFFFFC0CB~& ' _RGB32(255,192,203)
  203. CONST PinkFlamingo = &HFFFC74FD~& '_RGB32(252,116,253)
  204. CONST PinkSherbet = &HFFF78FA7~& '_RGB32(247,143,167)
  205. CONST Plum = &HFFDDA0DD~& ' _RGB32(221,160,221)
  206. CONST PowderBlue = &HFFB0E0E6~& ' _RGB32(176,224,230)
  207. CONST Purple = &HFF800080~& ' _RGB32(128,0,128)
  208. CONST PurpleHeart = &HFF7442C8~& '_RGB32(116,66,200)
  209. CONST PurpleMountainsMajesty = &HFF9D81BA~& '_RGB32(157,129,186)
  210. CONST PurplePizzazz = &HFFFE4EDA~& '_RGB32(254,78,218)
  211. CONST RadicalRed = &HFFFF496C~& '_RGB32(255,73,108)
  212. CONST RawSienna = &HFFD68A59~& '_RGB32(214,138,89)
  213. CONST RawUmber = &HFF714B23~& '_RGB32(113,75,35)
  214. CONST RazzleDazzleRose = &HFFFF48D0~& '_RGB32(255,72,208)
  215. CONST Razzmatazz = &HFFE3256B~& '_RGB32(227,37,107)
  216. CONST Red = &HFFFF0000~& ' _RGB32(255,0,0)
  217. CONST RedOrange = &HFFFF5349~& '_RGB32(255,83,73)
  218. CONST RedViolet = &HFFC0448F~& '_RGB32(192,68,143)
  219. CONST RobinsEggBlue = &HFF1FCECB~& '_RGB32(31,206,203)
  220. CONST RosyBrown = &HFFBC8F8F~& ' _RGB32(188,143,143)
  221. CONST RoyalBlue = &HFF4169E1~& ' _RGB32(65,105,225)
  222. CONST RoyalPurple = &HFF7851A9~& '_RGB32(120,81,169)
  223. CONST SaddleBrown = &HFF8B4513~& ' _RGB32(139,69,19)
  224. CONST Salmon = &HFFFA8072~& ' _RGB32(250,128,114)
  225. CONST SandyBrown = &HFFF4A460~& ' _RGB32(244,164,96)
  226. CONST Scarlet = &HFFFC2847~& '_RGB32(252,40,71)
  227. CONST ScreaminGreen = &HFF76FF7A~& '_RGB32(118,255,122)
  228. CONST SeaGreen = &HFF2E8B57~& ' _RGB32(46,139,87)
  229. CONST SeaShell = &HFFFFF5EE~& ' _RGB32(255,245,238)
  230. CONST Sepia = &HFFA5694F~& '_RGB32(165,105,79)
  231. CONST Shadow = &HFF8A795D~& '_RGB32(138,121,93)
  232. CONST Shamrock = &HFF45CEA2~& '_RGB32(69,206,162)
  233. CONST ShockingPink = &HFFFB7EFD~& '_RGB32(251,126,253)
  234. CONST Sienna = &HFFA0522D~& ' _RGB32(160,82,45)
  235. CONST Silver = &HFFC0C0C0~& ' _RGB32(192,192,192)
  236. CONST SkyBlue = &HFF87CEEB~& ' _RGB32(135,206,235)
  237. CONST SlateBlue = &HFF6A5ACD~& ' _RGB32(106,90,205)
  238. CONST SlateGray = &HFF708090~& ' _RGB32(112,128,144)
  239. CONST Snow = &HFFFFFAFA~& ' _RGB32(255,250,250)
  240. CONST SpringGreen = &HFF00FF7F~& ' _RGB32(0,255,127)
  241. CONST SteelBlue = &HFF4682B4~& ' _RGB32(70,130,180)
  242. CONST Sunglow = &HFFFFCF48~& '_RGB32(255,207,72)
  243. CONST SunsetOrange = &HFFFD5E53~& '_RGB32(253,94,83)
  244. CONST Tann = &HFFD2B48C~& ' _RGB32(210,180,140)
  245. CONST Teal = &HFF008080~& ' _RGB32(0,128,128)
  246. CONST TealBlue = &HFF18A7B5~& '_RGB32(24,167,181)
  247. CONST Thistle = &HFFD8BFD8~& ' _RGB32(216,191,216)
  248. CONST TickleMePink = &HFFFC89AC~& '_RGB32(252,137,172)
  249. CONST Timberwolf = &HFFDBD7D2~& '_RGB32(219,215,210)
  250. CONST Tomato = &HFFFF6347~& ' _RGB32(255,99,71)
  251. CONST TropicalRainForest = &HFF17806D~& '_RGB32(23,128,109)
  252. CONST Tumbleweed = &HFFDEAA88~& '_RGB32(222,170,136)
  253. CONST Turquoise = &HFF40E0D0~& ' _RGB32(64,224,208)
  254. CONST TurquoiseBlue = &HFF77DDE7~& '_RGB32(119,221,231)
  255. CONST UnmellowYellow = &HFFFFFF66~& '_RGB32(255,255,102)
  256. CONST Violet = &HFFEE82EE~& ' _RGB32(238,130,238)
  257. CONST VioletBlue = &HFF324AB2~& '_RGB32(50,74,178)
  258. CONST VioletRed = &HFFF75394~& '_RGB32(247,83,148)
  259. CONST VividTangerine = &HFFFFA089~& '_RGB32(255,160,137)
  260. CONST VividViolet = &HFF8F509D~& '_RGB32(143,80,157)
  261. CONST Wheat = &HFFF5DEB3~& ' _RGB32(245,222,179)
  262. CONST White = &HFFFFFFFF~& ' _RGB32(255,255,255)
  263. CONST Whitesmoke = &HFFF5F5F5~& ' _RGB32(245,245,245)
  264. CONST WildBlueYonder = &HFFA2ADD0~& '_RGB32(162,173,208)
  265. CONST WildStrawberry = &HFFFF43A4~& '_RGB32(255,67,164)
  266. CONST WildWatermelon = &HFFFC6C85~& '_RGB32(252,108,133)
  267. CONST Wisteria = &HFFCDA4DE~& '_RGB32(205,164,222)
  268. CONST Yellow = &HFFFFFF00~& ' _RGB32(255,255,0)
  269. CONST YellowGreen = &HFF9ACD32~& ' _RGB32(154,205,50)
  270. CONST YellowOrange = &HFFFFAE42~& '_RGB32(255,174,66)
  271.  
  272.  
  273. TYPE TagType
  274.     Year AS INTEGER
  275.     Week AS INTEGER
  276.     Theme AS STRING
  277.  
  278.  
  279. SCREEN _NEWIMAGE(800, 600, 32)
  280. _TITLE "Spell It Aloud"
  281.  
  282. ImageDir$ = ".\Images\"
  283. SoundDir$ = ".\Alphabet Sounds\"
  284. CONST TagDir$ = ".\Image Tags\"
  285. DIM SHARED PhotoTag AS TagType
  286. DIM SHARED LimitTag AS TagType
  287.  
  288. DIM SHARED AlphaSound(65 TO 90), f AS LONG, f1 AS LONG
  289. REDIM SHARED PhotoList(100000) AS STRING
  290. REDIM SHARED IMG10(9) AS LONG 'array fo 10 different images. Contains diferent indexes numbers for PhotoList()
  291.  
  292.  
  293. 'load our fonts
  294. f = _LOADFONT("courbd.ttf", 84, "MONOSPACE")
  295. f1 = _LOADFONT("courbd.ttf", 48, "MONOSPACE")
  296.  
  297.  
  298. 'Load the alphabet sound library
  299. FOR i = 65 TO 90
  300.     temp$ = SoundDir$ + CHR$(i) + ".ogg"
  301.     AlphaSound(i) = _SNDOPEN(temp$, "VOL,SYNC,LEN,PAUSE")
  302.  
  303.  
  304. _DELAY 1 'Give everything a moment to initialize and get started for us.
  305. ChangeSearchTags
  306. Insert_10_Different_Images 'insert 10 different indexes numbers from PhotoList, to array IMG10() [LONG] [0..9]
  307.  
  308.  
  309.     '    DO UNTIL photochosen <> oldpic
  310.     '        RANDOMIZE TIMER
  311.     '       photochosen = INT(RND * PhotoCount) + 1
  312.     '  LOOP
  313.     '  oldpic = photochosen
  314.  
  315.     photochosen = IMG10(index)
  316.     index = index + 1
  317.     IF index > 9 THEN index = INT(1 + RND * 8): Query = 1
  318.  
  319.     fullpath$ = PhotoList(photochosen)
  320.     word$ = UCASE$(PhotoList(photochosen))
  321.     word$ = MID$(word$, _INSTRREV(word$, "\") + 1)
  322.     word$ = LEFT$(word$, INSTR(word$, ".") - 1)
  323.     IF tempimage < -1 THEN _FREEIMAGE tempimage
  324.     tempimage = _LOADIMAGE(PhotoList(photochosen), 32)
  325.  
  326.  
  327.     'Put the image to the screen                                UPGRADE
  328.  
  329.  
  330.     FOR Loop_it = 1 TO 1 'as you say. 3x one word + image, this 10x with different images an then query.
  331.  
  332.         CLS
  333.         _FONT f1
  334.         CenterText 0, 0, 800, 50, "Spell It Aloud"
  335.         _FONT f
  336.  
  337.  
  338.  
  339.  
  340.         'program photo area is 700 x 450 pixels. So:
  341.         GetNewWH 500, 450, tempimage, nW, nH
  342.  
  343.  
  344.         Ws = 300 - (nW / 2)
  345.         We = 300 + (nW / 2)
  346.         Hs = 300 - (nH / 2) - 25
  347.         He = 300 + (nH / 2) - 25
  348.  
  349.         _PUTIMAGE (Ws, Hs)-(We, He), tempimage
  350.  
  351.         DisplayTags 575, 150, "Search Tags", LimitTag
  352.         DisplayTags 575, 300, "Photo Tags", PhotoTag
  353.  
  354.  
  355.  
  356.         'Put the letters to the screen one by one
  357.         pw = _PRINTWIDTH(word$)
  358.         StartX = (600 - pw) \ 2
  359.  
  360.  
  361.         IF Query = 0 THEN 'as you need: 10x 3 words and then query to image name
  362.             FOR i = 1 TO LEN(word$)
  363.                 a = ASC(word$, i) AND NOT 32
  364.                 _PRINTSTRING (StartX + (i - 1) * fw, 510), MID$(word$, i, 1)
  365.                 IF ASC(word$, i) = 32 THEN _DELAY .5: _CONTINUE
  366.                 IF a < 65 OR a > 90 THEN _CONTINUE
  367.                 _SNDPLAY AlphaSound(ASC(word$, i))
  368.                 DO WHILE _SNDPLAYING(AlphaSound(ASC(word$, i))): LOOP ' UPGRADE
  369.             NEXT
  370.         ELSE
  371.  
  372.             oldFont = _FONT
  373.             _FONT 16
  374.             'is time to query.....none _INPUTSTRING statement.... :)   i am so lasy!!!!!
  375.             _PRINTSTRING (10, 510), "Insert image name: "
  376.  
  377.             DO UNTIL inpt$ = CHR$(13)
  378.                 inpt$ = INKEY$
  379.                 IF INT(TIMER) MOD 2 = 0 THEN cursor$ = "_" ELSE cursor$ = ""
  380.                 IF LEN(inpt$) THEN
  381.                     word2$ = word2$ + UCASE$(inpt$)
  382.                     IF inpt$ = CHR$(9) THEN word2$ = LEFT$(word2$, LEN(word2$) - 1) 'backspace
  383.                 END IF
  384.                 _PRINTSTRING (10 + (20 * 8), 510), word2$ + cursor$
  385.             LOOP
  386.  
  387.             ok$ = "Correct!"
  388.             okl = _PRINTWIDTH(ok$)
  389.             word2$ = MID$(word2$, 1, LEN(word2$) - 1) 'erase CHR$(13) - ENTER from this word
  390.             IF UCASE$(_TRIM$(word2$)) = UCASE$(_TRIM$(word$)) THEN
  391.                 _FONT oldFont
  392.                 StartX = _WIDTH / 2 - okl / 2
  393.                 _PRINTSTRING (StartX, 510), ok$
  394.                 SLEEP 2
  395.  
  396.             END IF
  397.             Query = 0
  398.             Insert_10_Different_Images
  399.             _FONT oldFont
  400.             index = 0
  401.             _CONTINUE
  402.         END IF '  if query condition
  403.  
  404.  
  405.         WordPlay word$
  406.  
  407.  
  408.         DO
  409.             WHILE _MOUSEINPUT: WEND
  410.             MX = _MOUSEX
  411.             MY = _MOUSEY
  412.             MB = _MOUSEBUTTON(1)
  413.             IF MX > Ws AND MX < We AND MY > Hs AND MY < He THEN
  414.                 IF _FILEEXISTS(_CWD$ + "\animal sounds\" + word$ + ".mp3") THEN
  415.                     _MOUSESHOW "link"
  416.                     IF MB THEN AnimalSound word$
  417.                 END IF
  418.  
  419.             ELSE
  420.                 _MOUSESHOW "default"
  421.             END IF
  422.  
  423.             'keyboard access
  424.             k = _KEYHIT
  425.  
  426.             _KEYCLEAR
  427.             _LIMIT 10
  428.             SELECT CASE k
  429.                 CASE 32 'space
  430.                     '                _DELAY 1
  431.                     SLEEP 1 '                                      Better for testing it
  432.                     EXIT DO
  433.                 CASE 27 'escape
  434.                     SYSTEM 'quit
  435.             END SELECT
  436.         LOOP
  437.     NEXT Loop_it
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446. SUB AnimalSound (Word$)
  447.     ASound$ = _CWD$ + "\animal sounds\" + Word$ + ".mp3"
  448.     aAsound = _SNDOPEN(ASound$)
  449.     _SNDPLAY aAsound
  450.     DO WHILE _SNDPLAYING(aAsound)
  451.         IF LEN(INKEY$) THEN _SNDSTOP (aAsound): EXIT DO
  452.     LOOP
  453.     _SNDCLOSE aAsound
  454.     _MOUSESHOW "default"
  455.  
  456.  
  457.  
  458.  
  459. SUB GetNewWH (destWidth, destHeight, handle AS LONG, NewWidth, NewHeight) 'Sub return in variables NewWidth and NewHeight new image Width and image Height with the same ratio for optimal picture to set area width and height with [destWidth, destHeight]
  460.     W = _WIDTH(handle)
  461.     H = _HEIGHT(handle)
  462.     Pw = W / destWidth
  463.     Ph = H / destHeight
  464.     IF W > H THEN P = Pw ELSE P = Ph
  465.     NewWidth = W / P
  466.     NewHeight = H / P
  467.  
  468.  
  469. SUB Insert_10_Different_Images 'place 10 different indexes from array PhotoList
  470.     Max = UBOUND(photolist) 'PhotoList [1..?]
  471.     REDIM IMG10(9) AS LONG
  472.     pass = 0
  473.     DIM i_nr AS INTEGER
  474.     DO UNTIL pass = 10
  475.         st:
  476.         RANDOMIZE TIMER
  477.         i_nr = 1 + RND * Max
  478.  
  479.         FOR t = 0 TO 9
  480.             IF IMG10(t) = i_nr THEN GOTO st
  481.         NEXT t
  482.  
  483.         FOR t = 0 TO 9
  484.             IF IMG10(t) = 0 THEN IMG10(t) = i_nr: pass = pass + 1: EXIT FOR
  485.         NEXT t
  486.     LOOP
  487.  
  488.  
  489.  
  490. SUB WordPlay (W AS STRING) 'will be replaced to my own mp3..... i never learn english, BUT I TRY IT.
  491.     'path$ = _CWD$ + "\Words\" + W$ + ".mp3"
  492.     'Word = _SNDOPEN(path$)
  493.     '_SNDPLAY Word
  494.     'DO WHILE _SNDPLAYING(Word): LOOP
  495.  
  496.  
  497.  
  498.     FOR l = 1 TO LEN(W)
  499.         char = ASC(W, l)
  500.         IF char = 32 THEN _DELAY .5: _CONTINUE
  501.         _SNDPLAY AlphaSound(char)
  502.         _DELAY .35
  503.     NEXT l
  504.  
  505.  
  506. SUB ChangeSearchTags
  507.     'Get a listing of the files
  508.     PhotoList$ = ImageDir$ + "*.bmp " + ImageDir$ + "*.jpg " + ImageDir$ + "*.png " + ImageDir$ + "*.gif "
  509.     SHELL _HIDE "DIR " + PhotoList$ + "/b /s /a-d >PhotoList.txt"
  510.  
  511.     REDIM _PRESERVE PhotoList(100000)
  512.  
  513.     'Load those names into a file.
  514.     OPEN "Photolist.txt" FOR BINARY AS #1
  515.     PhotoCount = 0
  516.     DO UNTIL EOF(1)
  517.         LINE INPUT #1, fullpath$
  518.         word$ = MID$(fullpath$, _INSTRREV(fullpath$, "\") + 1)
  519.         word$ = LEFT$(word$, INSTR(word$, ".") - 1)
  520.  
  521.         '        IF LimitTag.Year = 0 AND LimitTag.Week = 0 AND _TRIM$(LimitTag.Sound) = "" AND _TRIM$(LimitTag.Theme) = "" THEN
  522.  
  523.         file$ = TagDir$ + word$ + ".txt"
  524.         IF _FILEEXISTS(file$) THEN
  525.             OPEN file$ FOR INPUT AS #2
  526.             INPUT #2, PhotoTag.Year
  527.             INPUT #2, PhotoTag.Week
  528.             INPUT #2, PhotoTag.Sound
  529.             INPUT #2, PhotoTag.Theme
  530.         ELSE
  531.             OPEN file$ FOR OUTPUT AS #2
  532.             PRINT #2, 0
  533.             PRINT #2, 0
  534.             PRINT #2, ""
  535.             PRINT #2, ""
  536.         END IF
  537.         CLOSE #2
  538.         good = -1
  539.         IF LimitTag.Year <> 0 AND LimitTag.Year <> PhotoTag.Year THEN good = 0
  540.         IF LimitTag.Week <> 0 AND LimitTag.Week <> PhotoTag.Week THEN good = 0
  541.  
  542.         IF LimitTag.Sound <> "" AND LimitTag.Sound <> PhotoTag.Sound THEN good = 0
  543.         IF LimitTag.Theme <> "" AND LimitTag.Theme <> PhotoTag.Theme THEN good = 0
  544.         IF good THEN
  545.             PhotoCount = PhotoCount + 1
  546.             PhotoList(PhotoCount) = fullpath$
  547.         END IF
  548.     LOOP
  549.  
  550.     REDIM _PRESERVE PhotoList(PhotoCount)
  551.     CLOSE
  552.  
  553. FUNCTION ChangeValue$ (x, y, word$, limit)
  554.     s = SaveState
  555.     _FONT 16
  556.     temp$ = CHR$(179)
  557.     _KEYCLEAR
  558.     DO
  559.         Box x, y, 100, 20, 1, Black, Gold
  560.         CenterText x, y, x + 100, y + 20, temp$
  561.         k = _KEYHIT
  562.         SELECT CASE k
  563.             CASE 8
  564.                 word$ = LEFT$(word$, LEN(word$) - 1)
  565.             CASE 13
  566.                 EXIT DO
  567.             CASE 48 TO 57 'We'll always accept numeric input
  568.                 word$ = word$ + CHR$(k)
  569.             CASE 65 TO 90, 97 TO 122 'A-Z (a-z) only when we're dealing with a string
  570.                 IF NOT limit THEN word$ = word$ + CHR$(k)
  571.         END SELECT
  572.         temp$ = word$ + CHR$(179)
  573.         _LIMIT 10
  574.     LOOP
  575.     ChangeValue$ = word$
  576.     RestoreState s
  577.  
  578. SUB DisplayTags (x, y, Title AS STRING, DisplayTag AS TagType)
  579.     s = SaveState
  580.     _FONT 16
  581.     w = 200: h = 106
  582.     Box x, y, w, h, 2, BlueGray, Gold
  583.     COLOR Gold, 0
  584.     CenterText x, y + 2, x + 200, y + 20, Title
  585.     LINE (x + 1, y + 19)-STEP(w - 2, 0), Gold
  586.     COLOR White, 0
  587.     xs = x + 24: ys = y + 24 'x/y start after the box offset
  588.     _PRINTSTRING (xs, ys), "Year :"
  589.     _PRINTSTRING (xs, ys + 20), "Week :"
  590.     _PRINTSTRING (xs, ys + 40), "Sound:"
  591.     _PRINTSTRING (xs, ys + 60), "Theme:"
  592.     bxs = xs + 50: bys = ys - 2 'x/y start for the display boxes
  593.     FOR i = 0 TO 3
  594.         Box bxs, bys + i * 20, 100, 20, 1, Black, Gold
  595.     NEXT
  596.     CenterValue bxs, bys, bxs + 100, bys + 20, DisplayTag.Year
  597.     CenterValue bxs, bys + 20, bxs + 100, bys + 40, DisplayTag.Week
  598.     CenterText bxs, bys + 40, bxs + 100, bys + 60, DisplayTag.Sound
  599.     CenterText bxs, bys + 60, bxs + 100, bys + 80, DisplayTag.Theme
  600.     RestoreState s
  601.  
  602. SUB Box (x, y, wide, high, thick, Kolor AS _UNSIGNED LONG, Trim AS _UNSIGNED LONG)
  603.     LINE (x, y)-STEP(wide, high), Kolor, BF
  604.     FOR i = 0 TO thick - 1
  605.         LINE (x + i, y + i)-STEP(wide - 2 * i, high - 2 * i), Trim, B
  606.     NEXT
  607.  
  608.  
  609. SUB CenterText (x1, y1, x2, y2, text$)
  610.     text$ = _TRIM$(text$)
  611.     xmax = x2 - x1: ymax = y2 - y1
  612.     textlength = _PRINTWIDTH(text$)
  613.     xpos = (xmax - textlength) / 2
  614.     ypos = (ymax - _FONTHEIGHT) / 2
  615.     _PRINTSTRING (x1 + xpos, y1 + ypos), text$
  616.  
  617. SUB CenterValue (x1, y1, x2, y2, value AS LONG)
  618.     text$ = _TRIM$(STR$(value))
  619.     CenterText x1, y1, x2, y2, text$
  620.  
  621. FUNCTION SaveState
  622.     TYPE SaveStateType
  623.         InUse AS INTEGER
  624.         DC AS INTEGER
  625.         BG AS INTEGER
  626.         F AS INTEGER
  627.         D AS INTEGER
  628.         S AS INTEGER
  629.         Disp AS INTEGER
  630.         CurX AS INTEGER
  631.         CurY AS INTEGER
  632.     END TYPE
  633.     DIM SS AS SaveStateType, Temp AS SaveStateType
  634.     SHARED NSS AS LONG 'Number of Saved States
  635.     SHARED SaveMem AS _MEM
  636.     IF NOT _MEMEXISTS(SaveMem) THEN
  637.         SaveMem = _MEMNEW(LEN(SS) * 255) 'Save up to 255 save states; More than 255 and we toss an error
  638.         $CHECKING:OFF
  639.         _MEMFILL SaveMem, SaveMem.OFFSET, SaveMem.SIZE, 0 AS _UNSIGNED _BYTE
  640.         $CHECKING:ON
  641.     END IF
  642.  
  643.     'Data to Save
  644.     SS.InUse = -1
  645.     SS.F = _FONT
  646.     SS.DC = _DEFAULTCOLOR
  647.     SS.BG = _BACKGROUNDCOLOR
  648.     SS.D = _DEST
  649.     SS.S = _SOURCE
  650.     SS.Disp = _AUTODISPLAY
  651.     SS.CurX = POS(0)
  652.     SS.CurY = CSRLIN
  653.     FOR i = 1 TO NSS
  654.         o = (i - 1) * LEN(SS)
  655.         _MEMGET SaveMem, SaveMem.OFFSET + o, Temp
  656.         IF Temp.InUse = 0 THEN
  657.             _MEMPUT SaveMem, SaveMem.OFFSET + o, SS
  658.             SaveState = i
  659.             EXIT FUNCTION
  660.         END IF
  661.     NEXT
  662.    _MEMPUT SaveMem, SaveMem.OFFSET + NSS * LEN(SS), SS
  663.     NSS = NSS + 1
  664.     SaveState = NSS
  665.  
  666. SUB RestoreState (WhichOne AS LONG)
  667.     DIM SS AS SaveStateType
  668.     SHARED NSS AS LONG 'Number of Saved States
  669.     SHARED SaveMem AS _MEM
  670.     _MEMGET SaveMem, SaveMem.OFFSET + (WhichOne - 1) * LEN(SS), SS
  671.     IF SS.InUse THEN
  672.         SS.InUse = 0 'Let the routine know that we're no longer in use for this handle
  673.         $CHECKING:OFF
  674.         _MEMPUT SaveMem, SaveMem.OFFSET + (WhichOne - 1) * LEN(SS), SS
  675.         $CHECKING:ON
  676.         _FONT SS.F
  677.         COLOR SS.DC, SS.BG
  678.         _DEST SS.D
  679.         _SOURCE SS.S
  680.         IF SS.Disp THEN _AUTODISPLAY ELSE _DISPLAY
  681.         LOCATE SS.CurY, SS.CurX
  682.     END IF
  683.  

prev.png

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Spell It Aloud (Help Requested)
« Reply #16 on: July 31, 2019, 08:48:30 pm »
And now it all starts to pull together nicely.

The little search areas now search and no longer tell you to die if they don't make a match.
You can click and update search or photo tags with a simple click of the mouse.
If the word "cat" comes up, you'll now get to hear my voice talking to you!  Aren't you lucky!!



So what's next?

A replay button would be nice, so the user could hear the word again if they want.
A next button so we don't have to use the spacebar, unless we just want to.
A mouse click to exit the input routines when changing the search/photo tags.  It's amazing how naturally that feels to me, and how much I notice not being able to do it.
An option to REVIEW, where we can replay the current choices X number of times to review them.
An option to QUIZ, where we then take the quiz on the current options and see if we can actually spell them.

And after that??

I dunno!  At that point, I think just grabbing photos, sounds, and organizing them so we'd have a large assortment for learning would be all that we'd have left to gather!
* Spell It Aloud.7z (Filesize: 1.06 MB, Downloads: 162)
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Spell It Aloud (Help Requested)
« Reply #17 on: July 31, 2019, 09:29:22 pm »
WT????

Steve's code with comment in CONST line does not work but this does!
Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(800, 600, 32)
  2. CONST White = &HFFFFFFFF
  3.  
  4. COLOR White
  5.  
  6. PSET (0, 0), White
  7.  
  8. IF POINT(0, 0) = White THEN
  9.     PRINT "it matches"
  10.     PRINT "You broke your program!" '  Try UNSIGNED LONG instead!
  11.  
  12.  

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Spell It Aloud (Help Requested)
« Reply #18 on: August 01, 2019, 01:48:45 am »
Just very fast input:


The same correct output as BPlus:

Code: QB64: [Select]
  1. CONST whiteA = &HFFFFFFFF
  2. CONST whiteB = &HFFFFFFFF~&
  3.  
  4. SCREEN _NEWIMAGE(1024, 768, 32)
  5. PSET (1, 1), whiteA
  6. IF POINT(1, 1) = whiteA THEN PRINT "Color WhiteA match"
  7. IF POINT(1, 1) = whiteB THEN PRINT "Color WhiteB match"
  8.  
  9. PRINT whiteA, whiteB, POINT(1, 1)
  10.  
  11.  


+ found CRITICAL IDE bug. For killing IDE write  this line:

CONST whiteA = &HFFFFFFFF\

it is a typo - killer for IDE.

see us later


Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Spell It Aloud (Help Requested)
« Reply #19 on: August 01, 2019, 02:49:09 pm »
I still do on it, but today not so fast...


 
spell preview.png

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Spell It Aloud (Help Requested)
« Reply #20 on: August 01, 2019, 03:26:29 pm »
Upgraded your ChangeValue$ for mouse - click - quit possibility. Problem is, that this click muss be on place limited by conditions on row 436..to 470.

Code: QB64: [Select]
  1. FUNCTION ChangeValue$ (x, y, word$, limit)
  2.     s = SaveState
  3.     _FONT 16
  4.     temp$ = CHR$(179)
  5.     _KEYCLEAR
  6.     DO UNTIL _MOUSEBUTTON(1) = 0 'wait until is mouse buffer empty
  7.         WHILE _MOUSEINPUT: WEND
  8.     LOOP
  9.     DO
  10.         WHILE _MOUSEINPUT: WEND '  again read mouse events
  11.         IF _MOUSEBUTTON(1) THEN EXIT DO 'and if is click, do the same as enter
  12.  
  13.         Box x, y, 100, 20, 1, Black, Gold
  14.         CenterText x, y, x + 100, y + 20, temp$
  15.         k = _KEYHIT
  16.         SELECT CASE k
  17.             CASE 8
  18.                 word$ = LEFT$(word$, LEN(word$) - 1)
  19.             CASE 13
  20.                 EXIT DO
  21.             CASE 48 TO 57 'We'll always accept numeric input
  22.                 word$ = word$ + CHR$(k)
  23.             CASE 65 TO 90, 97 TO 122 'A-Z (a-z) only when we're dealing with a string
  24.                 IF NOT limit THEN word$ = word$ + CHR$(k)
  25.         END SELECT
  26.         temp$ = word$ + CHR$(179)
  27.         _LIMIT 10
  28.     LOOP
  29.     ChangeValue$ = word$
  30.     RestoreState s
  31.  
  32.  


off topic - Steve, yesterday you had the funny report Die! in program  and today we solved killed IDEs after CONST. Maybe ghosts work ...  :)
« Last Edit: August 01, 2019, 03:31:51 pm by Petr »

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Spell It Aloud (Help Requested)
« Reply #21 on: August 01, 2019, 03:53:32 pm »
I still do on it, but today not so fast...

I've gotten side-tracked as well, and haven't been working on it as I'd intended.  Today I've been digging around and playing in QB64's internals itself, corrrecting the IDE killing glitch and adding in a $COLOR32 metacommand (for my personal pleasure,  even if it's not for anybody else's).  You can see my post on it here: https://www.qb64.org/forum/index.php?topic=1556.0

I'll try and look at your changes and work on this again tomorrow, if time allows.  My wife thinks she should be released from the hospital later tonight, or early in the morning, and my free time is going to disappear while helping her get settled home once more.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Spell It Aloud (Help Requested)
« Reply #22 on: August 01, 2019, 04:10:19 pm »
Okay, I will add a bit now and when it comes, I will add it here.

Of course, health and family are always in the first place. I wish you full health for you both.

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Spell It Aloud (Help Requested)
« Reply #23 on: August 01, 2019, 05:23:13 pm »
So here is next develop version with icons (buttons). Tomorrow i try solving buttons reaction time (sometimes is loooong). Add new folder "Config" contains background image and icon image. Functional buttons:
next image, replay word, set volume, quit. Buttons for quiz and for test are not programmed.


* Spell it Aloud 2.zip (Filesize: 1.44 MB, Downloads: 161)

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Spell It Aloud (Help Requested)
« Reply #24 on: August 01, 2019, 05:28:52 pm »
So here is next develop version with icons (buttons). Tomorrow i try solving buttons reaction time (sometimes is loooong). Add new folder "Config" contains background image and icon image. Functional buttons:
next image, replay word, set volume, quit. Buttons for quiz and for test are not programmed.

I’m thinking the best way to handle all the input would be to swap over to an ON TIMER event.  Then we can have an escape variable to stop the SDNPLAY loops and keep the program responsive at all times.  I’ll see about doing the swap over later tonight.  ;D
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Spell It Aloud (Help Requested)
« Reply #25 on: August 01, 2019, 05:44:14 pm »
:) Well, it will be absolutely brutal. The ON timer easily jumps in the middle of the loop in the program, because all he cares about is the set time. When you look at the program at line 480, I re-declared the keyhit variable as desirable numeric output. Now I tried it directly and it's a little faster. I think the problem will be in the sounds, apparently there are long silent spots, so there is no empty buffer and therefore the delay. That's just an estimate.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Spell It Aloud (Help Requested)
« Reply #26 on: August 02, 2019, 06:38:15 pm »
The ON TIMER changes seem to be working as intended now.

At this point, we can now STOP the speech in the middle of a word ("cat" is a very good test word for stopping, as it's the only one which actually says the word itself and then repeats the spelling for you a second time), and we can now PLAY a word as many times as we want.

At this point, the next order of business is to actually build the REVIEW buttons (we already create the list of acceptable images which fit our search parameters), so we can set the number of times we want to review our words/images in a setting...

I picture this to be as simple as a setting with a value from 1 to 5 (a quick set of click buttons should quickly set the value), after which we generate a study list of Number of Pictures * Times to Review.

So let's say we have a list of 3 words which meet our match criteria:  "HAT, CAT, BAT"
And then we want to study them 2 times...

We just shuffle that list twice and put it into a new list:  "CAT, BAT, HAT, BAT, HAT, CAT"

This new list will be our "study list", and the LAST and NEXT buttons will give us manual control to move forward and backward in the list as we wish...



After the review list (and movement buttons) are added, all that's left is to create the TEST button so a child can then test themselves and see how well they do with the words when the images show up for them.

And after that... It's more or less a done product.  :D
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Spell It Aloud (Help Requested)
« Reply #27 on: August 03, 2019, 05:12:59 am »
This easy and very stupid code show, what i mean, if i say, that ON TIMER get out in middle in the loop:

Code: QB64: [Select]
  1. ON TIMER(1) GOSUB timerdone
  2.     FOR f = 1 TO 500000
  3.     NEXT f
  4.  
  5. timerdone: PRINT "For next loop value is:"; f
  6.  

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Spell It Aloud (Help Requested)
« Reply #28 on: August 03, 2019, 05:19:18 am »
Code: QB64: [Select]
  1. $COLOR32
  2.  
  3. TYPE TagType
  4.     Year AS INTEGER
  5.     Week AS INTEGER
  6.     Theme AS STRING
  7.  
  8. SCREEN _NEWIMAGE(800, 600, 32)
  9. _TITLE "Spell It Aloud"
  10.  
  11. CONST ImageDir$ = ".\Images\"
  12. CONST SoundDir$ = ".\Alphabet Sounds\"
  13. CONST TagDir$ = ".\Image Tags\"
  14. CONST WordSoundDir$ = ".\Word Sounds\"
  15.  
  16. DIM SHARED PhotoTag AS TagType
  17. DIM SHARED LimitTag AS TagType
  18.  
  19. DIM SHARED AlphaSound(65 TO 90)
  20. REDIM SHARED PhotoList(100000) AS STRING
  21. DIM SHARED PhotoCount AS LONG
  22. DIM SHARED IsHowYouSpell AS LONG
  23. DIM SHARED ControlVariable1 AS LONG
  24. DIM SHARED ShowNext AS LONG
  25.  
  26.  
  27. 'load our fonts
  28. f = _LOADFONT("courbd.ttf", 84, "MONOSPACE")
  29. f1 = _LOADFONT("courbd.ttf", 48, "MONOSPACE")
  30.  
  31.  
  32. 'Load the alphabet sound library
  33. FOR i = 65 TO 90
  34.     temp$ = SoundDir$ + CHR$(i) + ".ogg"
  35.     AlphaSound(i) = _SNDOPEN(temp$, "VOL,SYNC,LEN,PAUSE")
  36. temp$ = WordSoundDir$ + "is how you spell.ogg"
  37. IsHowYouSpell = _SNDOPEN(temp$, "VOL,SYNC,LEN,PAUSE")
  38.  
  39.  
  40. _DELAY 1 'Give everything a moment to initialize and get started for us.
  41. ChangeSearchTags
  42.  
  43. Timer1 = _FREETIMER
  44.  
  45. ON TIMER(Timer1, .05) UserInput
  46. TIMER(Timer1) ON
  47.  
  48.     IF ShowNext THEN
  49.         IF ShowNext = -1 THEN
  50.             PhotoCount = UBOUND(PhotoList)
  51.             SELECT CASE PhotoCount
  52.                 CASE 0: PhotoChosen = 0: oldpic = 0 'no matches
  53.                 CASE 1: PhotoChosen = 1: oldpic = 1 'Only one possible match
  54.                 CASE ELSE 'multiple photos match the search criteria
  55.                     DO UNTIL PhotoChosen <> oldpic
  56.                         PhotoChosen = INT(RND * PhotoCount) + 1
  57.                     LOOP
  58.                     oldpic = PhotoChosen
  59.             END SELECT
  60.         END IF
  61.  
  62.         playagain:
  63.         IF PhotoChosen THEN
  64.             fullpath$ = PhotoList(PhotoChosen)
  65.             word$ = MID$(fullpath$, _INSTRREV(fullpath$, "\") + 1)
  66.             word$ = LEFT$(word$, INSTR(word$, ".") - 1)
  67.  
  68.             IF tempimage <> 0 THEN _FREEIMAGE tempimage 'free the old image
  69.             tempimage = _LOADIMAGE(PhotoList(PhotoChosen), 32) 'get the new image
  70.  
  71.             CLS
  72.             _FONT f1: CenterText 0, 0, 800, 50, "Spell It Aloud": _FONT f
  73.  
  74.             'program photo area is 500 x 450 pixels. So:
  75.             GetNewWH 500, 450, tempimage, nW, nH
  76.             _PUTIMAGE (300 - (nW / 2), 300 - (nH / 2) - 25)-STEP(nW, nH), tempimage
  77.  
  78.             LoadPhotoTags word$
  79.             DisplayTags 575, 150, "Search Tags (" + _TRIM$(STR$(PhotoCount)) + ")", LimitTag
  80.             DisplayTags 575, 300, "Photo Tags", PhotoTag
  81.             PlayLetters word$
  82.         ELSE
  83.             DrawNoMatches
  84.         END IF
  85.         IF oldpic = PhotoChosen THEN ShowNext = 0
  86.         IF ShowNext = -2 THEN ShowNext = 0: GOTO playagain
  87.     END IF
  88.     _LIMIT 10
  89.  
  90. SUB UserInput
  91.     STATIC oldmouse
  92.     MB = 0
  93.         IF _MOUSEBUTTON(1) THEN MB = -1: EXIT WHILE
  94.     WEND
  95.     Mx = _MOUSEX: My = _MOUSEY
  96.     IF oldmouse = 0 AND MB THEN 'it's a click
  97.         IF Mx >= 650 AND Mx <= 750 THEN 'the mouse is in the correct X area for input
  98.             SELECT CASE My
  99.                 CASE 171 TO 190
  100.                     temp$ = ChangeValue(650, 171, STR$(LimitTag.Year), -1)
  101.                     LimitTag.Year = VAL(temp$)
  102.                     ChangeSearchTags
  103.                 CASE 191 TO 210
  104.                     temp$ = ChangeValue(650, 191, STR$(LimitTag.Week), -1)
  105.                     LimitTag.Week = VAL(temp$)
  106.                     ChangeSearchTags
  107.                 CASE 211 TO 230
  108.                     temp$ = ChangeValue(650, 211, LimitTag.Sound, 0)
  109.                     LimitTag.Sound = temp$
  110.                     ChangeSearchTags
  111.                 CASE 231 TO 250
  112.                     temp$ = ChangeValue(650, 231, LimitTag.Theme, 0)
  113.                     LimitTag.Theme = temp$
  114.                     ChangeSearchTags
  115.                 CASE 324 TO 340
  116.                     PhotoTag.Year = VAL(ChangeValue(650, 324, STR$(PhotoTag.Year), -1))
  117.                     ChangePhotoTags word$
  118.                 CASE 341 TO 360
  119.                     PhotoTag.Week = VAL(ChangeValue(650, 341, STR$(PhotoTag.Week), -1))
  120.                     ChangePhotoTags word$
  121.                 CASE 361 TO 380
  122.                     PhotoTag.Sound = ChangeValue(650, 361, PhotoTag.Sound, 0)
  123.                     ChangePhotoTags word$
  124.                 CASE 381 TO 400
  125.                     PhotoTag.Theme = ChangeValue(650, 381, PhotoTag.Theme, 0)
  126.                     ChangePhotoTags word$
  127.             END SELECT
  128.         END IF
  129.         IF _MOUSEY > 450 AND _MOUSEY < 470 THEN 'it's the right Y pos for the top control buttons
  130.             SELECT CASE _MOUSEX
  131.                 CASE 575 TO 640 'Last
  132.                 CASE 641 TO 705 'Play
  133.                     ShowNext = -2
  134.                 CASE 706 TO 770 'Next
  135.                     ShowNext = -1
  136.             END SELECT
  137.         ELSEIF _MOUSEY > 471 AND _MOUSEY < 491 THEN 'it's the right Y pos for the top control buttons
  138.             SELECT CASE _MOUSEX
  139.                 CASE 575 TO 640 'Vol
  140.                 CASE 641 TO 705 'Stop
  141.                     ControlVariable1 = -1 'Stop Command for playing the word
  142.                 CASE 706 TO 770 'Quit
  143.                     SYSTEM
  144.             END SELECT
  145.         END IF
  146.     END IF
  147.  
  148.  
  149.     IF MB THEN oldmouse = -1 ELSE oldmouse = 0
  150.     ControlVariable = 0
  151.  
  152.  
  153.     k = _KEYHIT
  154.     SELECT CASE k
  155.         CASE 32 'space for next picture
  156.             ShowNext = -1
  157.         CASE 27 'escape
  158.             SYSTEM 'quit
  159.     END SELECT
  160.     DrawCommandBoxes
  161.  
  162. SUB DrawCommandBoxes
  163.     s = SaveState
  164.     _FONT 16
  165.     COLOR Black, 0
  166.     BoxTitle 575, 450, 640, 470, 2, BlueGray, Gold, "LAST"
  167.     BoxTitle 641, 450, 705, 470, 2, BlueGray, Gold, "PLAY"
  168.     BoxTitle 706, 450, 770, 470, 2, BlueGray, Gold, "NEXT"
  169.     BoxTitle 575, 471, 640, 490, 2, BlueGray, Gold, "VOL"
  170.     COLOR Maroon
  171.     BoxTitle 641, 471, 705, 490, 2, BlueGray, Gold, "STOP"
  172.     COLOR Yellow
  173.     BoxTitle 706, 471, 770, 490, 2, BlueGray, Gold, "QUIT"
  174.  
  175.     RestoreState s
  176.  
  177. SUB BoxTitle (x1, y1, x2, y2, thick, fg AS _UNSIGNED LONG, bg AS _UNSIGNED LONG, title$)
  178.     Box x1, y1, x2 - x1 + 1, y2 - y1 + 1, thick, fg, bg
  179.     CenterText x1, y1 + thick, x2, y2 + thick, title$
  180.  
  181. SUB DrawNoMatches
  182.     S = SaveState
  183.     CLS
  184.     _FONT f1
  185.     Box 50, 50, 500, 500, 5, Silver, Gold
  186.     CenterText 0, 0, 800, 50, "Spell It Aloud"
  187.     FOR i = 1 TO 10 STEP .5
  188.         CIRCLE (300, 300), 200 - i, BrickRed
  189.         LINE (300 + SIN(_D2R(-45)) * 198 + i, 300 + COS(_D2R(-45)) * 198 + i)-(300 + SIN(_D2R(135)) * 198 + i, 300 + COS(_D2R(135)) * 198 + i), BrickRed
  190.     NEXT
  191.     COLOR Yellow, 0
  192.     CenterText 50, 50, 550, 550, "No Matches"
  193.     PhotoTag.Year = 0
  194.     PhotoTag.Week = 0
  195.     PhotoTag.Sound = ""
  196.     PhotoTag.Theme = ""
  197.     RestoreState S
  198.     DisplayTags 575, 150, "Search Tags (" + _TRIM$(STR$(PhotoCount)) + ")", LimitTag
  199.     DisplayTags 575, 300, "Photo Tags", PhotoTag
  200.     ShowNext = -1
  201.  
  202.  
  203.  
  204. SUB PlayLetters (word$)
  205.     'Put the letters to the screen one by one
  206.     ControlVariable1 = 0
  207.     pw = _PRINTWIDTH(word$): StartX = (600 - pw) \ 2 'center position
  208.  
  209.     FOR i = 1 TO LEN(word$)
  210.         a = ASC(word$, i) AND NOT 32 'play lowercase letters as uppercase sounds
  211.         _PRINTSTRING (StartX + (i - 1) * _FONTWIDTH, 510), CHR$(a)
  212.         IF a < 65 OR a > 90 THEN _CONTINUE 'ignore non-letters in the file name
  213.         _SNDPLAY AlphaSound(a)
  214.         WHILE _SNDPLAYING(AlphaSound(a)) 'wait for sound to finish before playing again
  215.             _LIMIT 10 'play nice with CPU during wait
  216.             IF ControlVariable1 THEN _SNDSTOP (AlphaSound(a))
  217.         WEND
  218.     NEXT
  219.     IF ContolVariable1 = 0 THEN
  220.         temp$ = WordSoundDir$ + word$ + ".ogg"
  221.         IF _FILEEXISTS(temp$) THEN
  222.             _SNDVOL IsHowYouSpell, .5
  223.             _SNDPLAY IsHowYouSpell
  224.             WHILE _SNDPLAYING(IsHowYouSpell) 'wait for sound to finish before playing again
  225.                 _LIMIT 10 'play nice with CPU during wait
  226.                 IF ControlVariable1 THEN _SNDSTOP (IsHowYouSpell)
  227.             WEND
  228.  
  229.             temp = _SNDOPEN(temp$, "VOL,SYNC,LEN,PAUSE")
  230.             _SNDPLAY temp
  231.             WHILE _SNDPLAYING(temp) 'wait for sound to finish before playing again
  232.                 _LIMIT 10 'play nice with CPU during wait
  233.                 IF ControlVariable1 THEN _SNDSTOP (temp)
  234.             WEND
  235.             _SNDCLOSE temp
  236.             _DELAY 1
  237.  
  238.             FOR i = 1 TO LEN(word$)
  239.                 a = ASC(word$, i) AND NOT 32 'play lowercase letters as uppercase sounds
  240.                 _PRINTSTRING (StartX + (i - 1) * _FONTWIDTH, 510), CHR$(a)
  241.                 IF a < 65 OR a > 90 THEN _CONTINUE 'ignore non-letters in the file name
  242.                 _SNDPLAY AlphaSound(a)
  243.                 WHILE _SNDPLAYING(AlphaSound(a)) 'wait for sound to finish before playing again
  244.                     _LIMIT 10 'play nice with CPU during wait
  245.                     IF ControlVariable1 THEN _SNDSTOP (AlphaSound(a))
  246.                 WEND
  247.             NEXT
  248.         END IF
  249.     END IF
  250.  
  251.  
  252. SUB ChangePhotoTags (word$)
  253.     'Get a listing of the files
  254.     file$ = TagDir$ + word$ + ".txt"
  255.     OPEN file$ FOR OUTPUT AS #1
  256.     PRINT #1, PhotoTag.Year
  257.     PRINT #1, PhotoTag.Week
  258.     PRINT #1, PhotoTag.Sound
  259.     PRINT #1, PhotoTag.Theme
  260.     CLOSE
  261.  
  262. SUB LoadPhotoTags (word$)
  263.     file$ = TagDir$ + word$ + ".txt"
  264.     IF _FILEEXISTS(file$) THEN
  265.         OPEN file$ FOR INPUT AS #1
  266.         INPUT #1, PhotoTag.Year
  267.         INPUT #1, PhotoTag.Week
  268.         INPUT #1, PhotoTag.Sound
  269.         INPUT #1, PhotoTag.Theme
  270.         CLOSE
  271.     ELSE
  272.         PhotoTag.Year = 0
  273.         PhotoTag.Week = 0
  274.         PhotoTag.Sound = ""
  275.         PhotoTag.Theme = ""
  276.         IF word$ <> "" THEN ChangePhotoTags word$
  277.     END IF
  278.  
  279.  
  280. SUB ChangeSearchTags
  281.     TIMER(Timer1) OFF
  282.     'Get a listing of the files
  283.     PhotoList$ = ImageDir$ + "*.bmp " + ImageDir$ + "*.jpg " + ImageDir$ + "*.png " + ImageDir$ + "*.gif "
  284.     SHELL _HIDE "DIR " + PhotoList$ + "/b /s /a-d >PhotoList.txt"
  285.  
  286.     REDIM _PRESERVE PhotoList(100000)
  287.     'Load those names into a file.
  288.     OPEN "Photolist.txt" FOR BINARY AS #1
  289.     PhotoCount = 0
  290.     DO UNTIL EOF(1)
  291.         LINE INPUT #1, fullpath$
  292.         word$ = MID$(fullpath$, _INSTRREV(fullpath$, "\") + 1)
  293.         word$ = LEFT$(word$, INSTR(word$, ".") - 1)
  294.  
  295.         file$ = TagDir$ + word$ + ".txt"
  296.         IF _FILEEXISTS(file$) THEN
  297.             OPEN file$ FOR INPUT AS #2
  298.             INPUT #2, PhotoTag.Year
  299.             INPUT #2, PhotoTag.Week
  300.             INPUT #2, PhotoTag.Sound
  301.             INPUT #2, PhotoTag.Theme
  302.         ELSE
  303.             OPEN file$ FOR OUTPUT AS #2
  304.             PRINT #2, 0
  305.             PRINT #2, 0
  306.             PRINT #2, ""
  307.             PRINT #2, ""
  308.         END IF
  309.         CLOSE #2
  310.         good = -1
  311.         IF LimitTag.Year <> 0 AND LimitTag.Year <> PhotoTag.Year THEN good = 0
  312.         IF LimitTag.Week <> 0 AND LimitTag.Week <> PhotoTag.Week THEN good = 0
  313.  
  314.         IF LimitTag.Sound <> "" AND LimitTag.Sound <> PhotoTag.Sound THEN good = 0
  315.         IF LimitTag.Theme <> "" AND LimitTag.Theme <> PhotoTag.Theme THEN good = 0
  316.         IF good THEN
  317.             PhotoCount = PhotoCount + 1
  318.             PhotoList(PhotoCount) = fullpath$
  319.         END IF
  320.     LOOP
  321.     REDIM _PRESERVE PhotoList(PhotoCount)
  322.     CLOSE
  323.     ShowNext = -1
  324.  
  325.  
  326. FUNCTION ChangeValue$ (x, y, word$, limit)
  327.     TIMER(Timer1) OFF
  328.     S = SaveState
  329.     _FONT 16
  330.     temp$ = CHR$(179)
  331.     _KEYCLEAR
  332.     DO
  333.         Box x, y, 100, 20, 1, Black, Gold
  334.         CenterText x, y, x + 100, y + 20, temp$
  335.         k = _KEYHIT
  336.         SELECT CASE k
  337.             CASE 8
  338.                 word$ = LEFT$(word$, LEN(word$) - 1)
  339.             CASE 13
  340.                 EXIT DO
  341.             CASE 48 TO 57 'We'll always accept numeric input
  342.                 word$ = word$ + CHR$(k)
  343.             CASE 65 TO 90, 97 TO 122 'A-Z (a-z) only when we're dealing with a string
  344.                 IF NOT limit THEN word$ = word$ + CHR$(k)
  345.         END SELECT
  346.         temp$ = word$ + CHR$(179)
  347.         _LIMIT 10
  348.     LOOP
  349.     ChangeValue$ = word$
  350.     RestoreState S
  351.     DisplayTags 575, 150, "Search Tags (" + _TRIM$(STR$(PhotoCount)) + ")", LimitTag
  352.     DisplayTags 575, 300, "Photo Tags", PhotoTag
  353.  
  354.     TIMER(Timer1) ON
  355.  
  356. SUB DisplayTags (x, y, Title AS STRING, DisplayTag AS TagType)
  357.     S = SaveState
  358.     _FONT 16
  359.     w = 200: h = 106
  360.     Box x, y, w, h, 2, BlueGray, Gold
  361.     COLOR Gold, 0
  362.     CenterText x, y + 2, x + 200, y + 20, Title
  363.     LINE (x + 1, y + 19)-STEP(w - 2, 0), Gold
  364.     COLOR White, 0
  365.     xs = x + 24: ys = y + 24 'x/y start after the box offset
  366.     _PRINTSTRING (xs, ys), "Year :"
  367.     _PRINTSTRING (xs, ys + 20), "Week :"
  368.     _PRINTSTRING (xs, ys + 40), "Sound:"
  369.     _PRINTSTRING (xs, ys + 60), "Theme:"
  370.     bxs = xs + 50: bys = ys - 2 'x/y start for the display boxes
  371.     FOR i = 0 TO 3
  372.         Box bxs, bys + i * 20, 100, 20, 1, Black, Gold
  373.     NEXT
  374.     CenterValue bxs, bys, bxs + 100, bys + 20, DisplayTag.Year
  375.     CenterValue bxs, bys + 20, bxs + 100, bys + 40, DisplayTag.Week
  376.     CenterText bxs, bys + 40, bxs + 100, bys + 60, DisplayTag.Sound
  377.     CenterText bxs, bys + 60, bxs + 100, bys + 80, DisplayTag.Theme
  378.     RestoreState S
  379.  
  380. SUB Box (x, y, wide, high, thick, Kolor AS _UNSIGNED LONG, Trim AS _UNSIGNED LONG)
  381.     LINE (x, y)-STEP(wide, high), Kolor, BF
  382.     FOR i = 0 TO thick - 1
  383.         LINE (x + i, y + i)-STEP(wide - 2 * i, high - 2 * i), Trim, B
  384.     NEXT
  385.  
  386.  
  387. SUB CenterText (x1, y1, x2, y2, text$)
  388.     text$ = _TRIM$(text$)
  389.     xmax = x2 - x1: ymax = y2 - y1
  390.     textlength = _PRINTWIDTH(text$)
  391.     xpos = (xmax - textlength) / 2
  392.     ypos = (ymax - _FONTHEIGHT) / 2
  393.     _PRINTSTRING (x1 + xpos, y1 + ypos), text$
  394.  
  395. SUB CenterValue (x1, y1, x2, y2, value AS LONG)
  396.     text$ = _TRIM$(STR$(value))
  397.     CenterText x1, y1, x2, y2, text$
  398.  
  399. FUNCTION SaveState
  400.     TYPE SaveStateType
  401.         InUse AS INTEGER
  402.         DC AS INTEGER
  403.         BG AS INTEGER
  404.         F AS INTEGER
  405.         D AS INTEGER
  406.         S AS INTEGER
  407.         Disp AS INTEGER
  408.         CurX AS INTEGER
  409.         CurY AS INTEGER
  410.     END TYPE
  411.     DIM SS AS SaveStateType, Temp AS SaveStateType
  412.     SHARED NSS AS LONG 'Number of Saved States
  413.     SHARED SaveMem AS _MEM
  414.     IF NOT _MEMEXISTS(SaveMem) THEN
  415.         SaveMem = _MEMNEW(LEN(SS) * 255) 'Save up to 255 save states; More than 255 and we toss an error
  416.         $CHECKING:OFF
  417.         _MEMFILL SaveMem, SaveMem.OFFSET, SaveMem.SIZE, 0 AS _UNSIGNED _BYTE
  418.         $CHECKING:ON
  419.     END IF
  420.  
  421.     'Data to Save
  422.     SS.InUse = -1
  423.     SS.F = _FONT
  424.     SS.DC = _DEFAULTCOLOR
  425.     SS.BG = _BACKGROUNDCOLOR
  426.     SS.D = _DEST
  427.     SS.S = _SOURCE
  428.     SS.Disp = _AUTODISPLAY
  429.     SS.CurX = POS(0)
  430.     SS.CurY = CSRLIN
  431.     FOR i = 1 TO NSS
  432.         o = (i - 1) * LEN(SS)
  433.         _MEMGET SaveMem, SaveMem.OFFSET + o, Temp
  434.         IF Temp.InUse = 0 THEN
  435.             _MEMPUT SaveMem, SaveMem.OFFSET + o, SS
  436.             SaveState = i
  437.             EXIT FUNCTION
  438.         END IF
  439.     NEXT
  440.     _MEMPUT SaveMem, SaveMem.OFFSET + NSS * LEN(SS), SS
  441.     NSS = NSS + 1
  442.     SaveState = NSS
  443.  
  444. SUB RestoreState (WhichOne AS LONG)
  445.     DIM SS AS SaveStateType
  446.     SHARED NSS AS LONG 'Number of Saved States
  447.     SHARED SaveMem AS _MEM
  448.     _MEMGET SaveMem, SaveMem.OFFSET + (WhichOne - 1) * LEN(SS), SS
  449.     IF SS.InUse THEN
  450.         SS.InUse = 0 'Let the routine know that we're no longer in use for this handle
  451.         $CHECKING:OFF
  452.         _MEMPUT SaveMem, SaveMem.OFFSET + (WhichOne - 1) * LEN(SS), SS
  453.         $CHECKING:ON
  454.         _FONT SS.F
  455.         COLOR SS.DC, SS.BG
  456.         _DEST SS.D
  457.         _SOURCE SS.S
  458.         IF SS.Disp THEN _AUTODISPLAY ELSE _DISPLAY
  459.         LOCATE SS.CurY, SS.CurX
  460.     END IF
  461.  
  462. SUB GetNewWH (destWidth, destHeight, handle AS LONG, NewWidth, NewHeight) 'Sub return in variables NewWidth and NewHeight new image Width and image Height with the same ratio for optimal picture to set area width and height with [destWidth, destHeight]
  463.     W = _WIDTH(handle)
  464.     H = _HEIGHT(handle)
  465.     Pw = W / destWidth
  466.     Ph = H / destHeight
  467.     IF W > H THEN P = Pw ELSE P = Ph
  468.     NewWidth = W / P
  469.     NewHeight = H / P
  470.  

Sorry!  I apparently forgot to post the code block earlier.  /blush
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Spell It Aloud (Help Requested)
« Reply #29 on: August 03, 2019, 05:26:00 am »
By chance, Steve, thank you, now I know I'm not alone who forgets! :)