- sbasici.exe - My original port of SmallBASIC that I abandoned several years ago but recently brought back to life using FLTK 1.4.

That's great Chris, thanks - numpad keys work as expected. I don't have to keep remembering to use the numbers above the main keys now. Thanks also for the clarification of the files. I'm sticking with the SDL g64 version for now for those fast graphics on my Windows 7.Another oddity I noticed is that the arrow keys give ASCII 27, same as the Escape key. Is that how it should be?

' Get key codes.bas SmallBASIC 0.12.9 (B+=MGA) 2017-12-18WHILE 1 'find code for keypress k$ = INKEY IF LEN(k$) THEN SELECT CASE LEN(k$) CASE 1: PRINT "1 char keypress = "; ASC(k$) IF ASC(k$) = 27 THEN EXIT loop CASE 2: PRINT "2 char keypress = "; ASC(RIGHT$(k$, 1)) END SELECT END IFWEND

asc(left(k$,1)),

but a big request of mine would be if inkey could be speeded up. Its slow speed makes it unusable in any kind of real-time control situation like a game.

Quote from: lettersquash on March 23, 2020, 21:41:28 but a big request of mine would be if inkey could be speeded up. Its slow speed makes it unusable in any kind of real-time control situation like a game.Hi..I don't understand. I want to know more about this "inkey". How slow is the "inkey"? Any example? Thanks.

'Updated Plasmatic with Full Color Mixing.bas translated to SmallBASIC b+ 2020-01-24' from QB64 "Color Mixing 4 Plasmatic" ' b+ 2020-01-23' continued study of what makes Plasmatic tick,' here the color palette is updated for full range of color mixing options,' PLUS I think color band creation for palette has been a little demystified,' PLUS more fully commented code.' common shared unchanging variables and static arraysconst xxmax = 500 'need smaller screen for interpreted Basicconst yymax = 400const xoff = (xmax - xxmax) \ 2const yoff = (ymax - yymax) \ 2dim c(360), p(6), f(6)'start programrandomize timerlabel restart 'select rgb1 and rgb2 based on mode of color mixingIF mode = 0 THEN 'new plasma option ANY color for border and ANY color for middle r1 = RND * 255: g1 = RND * 255: b1 = RND * 255: r2 = RND * 255: g2 = RND * 255: b2 = RND * 255ELSE ' traditional high contrast plasma black borders, white centers r1 = 0: g1 = 0: b1 = 0: r2 = 255: g2 = 255: b2 = 255 'regular PlasmaEND IF'create 6 x 60 bands of color palette based on coloring mode (rgb1 set and rgb2 set)FOR i = 0 TO 360 IF i MOD 60 = 0 THEN r = RND * 255: g = RND * 255: b = RND * 255 'start new color band m = i MOD 60 'color bands have width of 60, 4 stages if m < 15 then ' 1st stage increase rgb1 towards rgb color in 15 steps c(i) = midInk(r1, g1, b1, r, g, b, m / 15) elif m < 30 ' 2nd stage increase rgb color towards rgb2 set in 15 steps c(i) = midInk(r, g, b, r2, g2, b2, (m - 15) / 15) elif m < 45 ' 3rd stage decrease rgb2 color back to rgb color in 15 steps c(i) = midInk(r2, g2, b2, r, g, b, (m - 30) / 15) elif m < 60 ' 4th and finally decrease rgb back to starting rgb1 set in 15 steps c(i) = midInk(r, g, b, r1, g1, b1, (m - 45) / 15) END ifNEXT' behind the scenes variables for motion, weighting and shaping color mixingFOR n = 0 TO 5 p(n).x = RND * xxmax: p(n).y = RND * yymax: p(n).dx = RND * 2 - 1: p(n).dy = RND * 2 - 1 'create points f(n) = .1 * RND ' create the inverse size and weight factor, large f = small globs but carry weightNEXT'screen labeling 3 lines for title above, 2 lines instruction belowclsat xoff, yoff - 60if mode = 0 then CP yoff - 60, "New Color Options for Plasma:"else CP yoff - 60, "Traditional High Contrast Plasma: Black Borders and White Centers"end ifCP yoff - 40, "Borders: RGB(" + str(r1 \ 1) + ", " + str(g1 \ 1) + ", " + str(b1 \ 1) + ")"CP yoff - 20, "Centers: RGB(" + str(r2 \ 1) + ", " + str(g2 \ 1) + ", " + str(b2 \ 1) + ")"CP yoff + yymax + 10, "Press t to toggle between Traditional and New Color Options Plasma"CP yoff + yymax + 30, "Press spacebar to get a new color set."'plasma in motion WHILE 1 'get user input choices ' Here! Check out Plasmatic with and without INKEY k = INKEY '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< IF k = " " THEN GOTO restart 'if k = "q" or asc(k) = 27 then end 'IF k = "t" THEN mode = 1 - mode: GOTO restart 'move points FOR i = 0 TO 5 p(i).x = p(i).x + p(i).dx IF p(i).x > xxmax OR p(i).x < 0 THEN p(i).dx = -p(i).dx p(i).y = p(i).y + p(i).dy IF p(i).y > yymax OR p(i).y < 0 THEN p(i).dy = -p(i).dy NEXT 'calculate each screen x, y color based on distance to 6 points FOR y = 0 TO yymax - 1 STEP 3 FOR x = 0 TO xxmax - 1 STEP 3 d = 0 FOR n = 0 TO 5 dx = x - p(n).x: dy = y - p(n).y k = SQR(dx * dx + dy * dy) d = d + (SIN(k * f(n)) + 1) / 2 NEXT n: d = d * 60 rect x + xoff, y + yoff STEP 3, 3, c(d) filled NEXT NEXT 'showpage 'guess this not needed might work better withoutWEND'report the color number between rgb1 and rgb2 at fraction fr from rgb1func midInk(r1, g1, b1, r2, g2, b2, fr) midInk = rgb(r1+(r2-r1)*fr, g1+(g2-g1)*fr, b1+(b2-b1)*fr)end'Center Print at topYpixel down from topsub CP(topYpixel, stringg) at (xmax - txtw(stringg))/2, topYpixel :print stringgend sub

REM SmallBASICREM created: 24/03/2020x=xmax\2:y=ymax\2? "INKEY speed test. Use a,z and <> keys to move '@' - see how fast it is?"? "To compare (random motion) without the inkey statement, hit q."? "There's still a select case, in the loop, but a random slice of 'az,.' instead of inkey."? "Or make it a constant of your choice to see it just go in one direction."repeat k=inkey at x,y,:? " " select case k case "a":y-- case "z":y++ case ",":x-- case ".":x++ end select at x,y:? "@" showpageuntil k="q"repeat at x,y:? " " k=mid("az,.",(rnd*4)+1,1)' k="," select case k case "a":y-- case "z":y++ case ",":x-- case ".":x++ end select at x,y:? "@" showpageuntil 0end

Hi, Another report: forget adding this feature to the sbasici.exe. https://www.syntaxbomb.com/index.php/topic,6677.msg33355.html#msg33355

here's a better example for being a bit simpler.

Quote from: round157 on March 23, 2020, 22:09:35Hi, Another report: forget adding this feature to the sbasici.exe. https://www.syntaxbomb.com/index.php/topic,6677.msg33355.html#msg33355I've created an issue for this: https://github.com/smallbasic/SmallBASIC/issues/93

Hey I wonder if that is what slows down the editor version from FKLT, inkey has to be on all the time. eh?BTW using the editor may be really slow testing runs but much more pleasant for editing with tabbed files and Help access right there, but Aurel's should have that maybe more but no help access.