m2conio – Console I/O module

About Monkey 2 Forums Monkey 2 Projects m2conio – Console I/O module

This topic contains 1 reply, has 1 voice, and was last updated by  Hezkore 2 weeks, 4 days ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #13339

    Hezkore
    Participant

    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.

    GitHub: https://github.com/Hezkore/m2conio

     
    Instructions
    * 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

     
    Notice
    Unsupported by Ted2Go are:
    * Console.Input()
    * Console.WaitKey()
    * 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.

     
    Possible usage
    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.

    #13401

    Hezkore
    Participant

    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.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.