Author Topic: Enhancement Request: Inkey$ like functionality for Linux/Mac in $Console mode  (Read 3867 times)

0 Members and 1 Guest are viewing this topic.

Offline mdijkens

  • Newbie
  • Posts: 34
    • View Profile
I am really happy with all the functionality in QB64 and the professional grade applications we can build with it!
But one thing I'm really missing is an Inkey$ like function for Linux/Mac in $Console mode.
Things like catching arrow-keys or specific alphanumeric keys would be really helpful.
So far I have tried a lot of things to get something working via screenscraping and external tools but no luck until now.
I assume it is hard and totally different from Windows in the nature of terminal sessions but I really hope that something is possible, even in a limited way....
If any one knows workarounds, I'll be excited too
~ 2 million lines of BASIC

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
I think I recall Steve or someone setting that up, maybe under a different name. Try wiki help places that discuss console or try a search here. Guess about a year ago? I remember requesting mouse polling for console, while, I am pretty sure it was Steve, was doing a bunch of improvements to console.

Update: Eh couldn't find anything about inputs, if you don't Console Only you might have to set _Source to Console? Don't know for sure but _DEST and _SOURCE were discussed under Wiki on Console.

Update2: links from search that might be relevant
inp might be it!  https://qb64forum.alephc.xyz/index.php?topic=1535.msg107483#msg107483
WIP console enhancements https://qb64forum.alephc.xyz/index.php?topic=1540.msg107531#msg107531
another about keypress (CINP): https://qb64forum.alephc.xyz/index.php?topic=4181.msg135462#msg135462

That's most relevant check of first of 3 pages in Search for "console" and SMcNeill member.
If you need more try search yourself.


« Last Edit: April 06, 2022, 12:20:59 pm by bplus »

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
I don't have a Linux machine, and I have almost no real experience in Linux.  I did some updates to the Console stuff a few years back, but it was all Windows-only based.  I don't know if anyone ever took the time to expand those routines to work for Linux/Mac or not, but here's basically how you can test it:

 
$CONSOLE:ONLY
_DEST _CONSOLE: _SOURCE _CONSOLE

PRINT "Press any key, and I'll give you the scan code for it.  <ESC> quits the demo."
PRINT
PRINT
DO
    x = _CONSOLEINPUT
    IF x = 1 THEN 'read only keyboard input ( = 1)
        c = _CINP
        PRINT c;
    END IF
LOOP UNTIL c = 1
END
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline mdijkens

  • Newbie
  • Posts: 34
    • View Profile
Thanks,

I don't have any linux experience either; just testing in a VM.
But I need to support it often to support colleagues or customers
I've already tried your approach and a lot (crazy) others...

Would be really cool if there's someone with a linux background who could look into this...
~ 2 million lines of BASIC