January 29, 2018 at 11:46 pm #13339
m2conio is a Console I/O module for Monkey2.
It adds a ‘Console’ structure for some console specific functions and features.
As well as an ‘Ansi’ structure for Ansi related functions.
* Download or Git Clone to your Monkey2 ‘Modules’ folder
* Recompile module
* Compile tests inside the ‘tests’ folder
* Run tests via your ‘products’ folder and not via Ted2Go
Unsupported by Ted2Go are:
* Any Ansi related functions, Ansi.Supported works but returns false
Make sure you run your apps from your ‘products’ folder and not via Ted2Go.
Console.Input() will exit on Enter/New Line, but that line will be printed!
It’s not part of the return string, but it will be visible.
I’d love a cross-platform solution for this.
You can use Console.Write( "my text" ) to print text without a new line at the end.
There’s Console.Input() for user input and Console.WaitKey() to halt the application until the user hits a key.
You can use Console.KeyHit() to get a keystroke in-real time without pausing the application.
And of course, the classic Console.Bell() which will play the system warning sound.
There’s also color support via Ansi codes.
If colors aren’t supported by your current console window; don’t worry, they’ll just be stripped out.
It works fairly well on all platforms though, the only exception is older Windows versions (< Win10)
But they’re still safe to use and support can be detected via Ansi.Supported if you want.
You can force Ansi support with -fa but you might end up seeing garbage if it’s not supported.
You can use -da to force disable Ansi support and strip away all the colors.January 31, 2018 at 8:35 pm #13401
Big Linux commit pushed.
Works a lot better now!
Underline has returned as well.
All special features via Ansi codes have been moved into the Ansi structure.
All Console struct functions are safe to use, and the Ansi struct functions should only be used if Ansi.Supported returns true.
You must be logged in to reply to this topic.