A Forum all about DOS Batch
It is currently 27 Mar 2017 20:27

All times are UTC-06:00

Post new topic  Reply to topic  [ 1 post ] 
Author Message
PostPosted: 15 Feb 2017 05:56 

Joined: 17 Dec 2016 12:49
Posts: 5
To avoid speed issues when using most of the console graphics command, I made darkbox.

What is this ?
This is a Batch IO Server which can work on Windows (cmd.exe) and *Nixes like GNU/Linux (with Dos9 Project).

What is a Batch IO Server ?
A Batch IO Server is a concept of external command directly derivated from Darkbatcher (the creator of batbox) in its command SuperBox, the main difference between these 2 commands is the way to send a command, while darkbox uses stdin/stdout, Superbox uses named pipes.
So, the aim is to build a thing, and do not detroy it to rebuild it again :mrgreen:, just keep the thing built how long we need it to get a better speed compared to others.

Where to download it ?
You can download darkbox in two version, they are almost the same (just executable flags in the Unix version :roll:).
Windows download :
Unix download :

What features are supported in darkbox (only the IO server) ?
Throught the output server :
- Basic output operations (ASCII, Display text, new-line, cursor movement, local color, clear)
- Darkbox-internal operations (internal-wait/display-delay, quit (to stop properly darkbox))
- Advanced output operations (cursor origin, color reset, hide/show cursor)
Throught the executable it-self :
- Get if data is available in stdin (-kbh)
- Wait (external/batch delay) (-w t)
And throught the input server : Keyboard and mouse key handling simultaneously and possibly in non-blocking way (with -kbh).

Here are screenshots of some examples on both Windows and GNU/Linux (Archlinux)
nuancier.bat :
it.bat :
geometry.bat :

Here is the official english documentation, this explain how you should work with darkbox :
Code: Select all
 __        __        __   __
|  \  /\  |__) |__/ |__) /  \ \_/
|__/ /~~\ |  \ |  \ |__) \__/ / \

Darkbox fully portable fast I/O server, powerfull graphic command
Fully compatible with Dos9 Project.

    1) (process, code or "launcher" part) | darkbox
    2) darkbox -i | (process, code or "launcher" part)
    3) darkbox -w t
    4) darkbox -kbh (reduced: -k)

1) Start darkbox as output server.
2) Start darkbox as input server.
3) Wait t ms.
4) Return 1 if data is available in stdin,
   should be used for non-blocking input.

   NOTE: "bh" is not required but recommended for
         "a better code", so it's just cosmetic.

Output commands passing:
    Commands pass to stdin, so any command like type, more, echo,
    <nul set/p "=text" or whatever you can imagine send command to darkbox.

    So, you can store commands to files to reuses them easly, like sprites or
    something else.

    Also, darkbox accept both new syntax ('-') and batbox/tinybg syntax ('/') to
    begin command.

Output command format:
    Commands follow this format

    -(execution_count)<commands as letters>
    REMARK: '-' can be replaced by '/'

    So each <commands as letters> run (execution_count) times (or 1 time if undefined).

        - You can escape chracters (" or spaces without double quotes) with '\'
        - With double quotes, new lines are considerated as characters like any others.
        - No commands will produce an error (Parsing error: No command specified).
        - Commands should be in litterals ONLY (Parsing error: Invalid litterals)
        - Commands are case-insensitive.

        You can write your commands througth multiples echoes :
            echo -5dn "This is a"
            echo      "small text"
            echo      "throught"
            echo      "multiples"
            echo      "lines"

Launcher (and working variations):
    Official launchers:

        Original (first) :
            @Echo off
            call game.bat | darkbox

        Original with Input server
            @Echo off
            darkbox -i | call game.bat | darkbox

        Enhanced (only in one file) :
            @Echo off
            if defined __ goto :(code)
            set __=.
            call %0 %* | darkbox
            set __=
            goto :eof

            "call" is facultative

        Enhanced with Input server
            @Echo off
            if defined __ goto :(code)
            set __=.
            darkbox -i | call %0 %* | darkbox
            set __=
            goto :eof

            "call" is facultative.

    Unofficial launcher (variants):
        @echo off
        if not defined $ (
            set "$=1"
              call "%~f0" %*
            ) | darkbox

Output commands reference:

        -a Integer

        Usage : Print the character corresponding to the integer


        Usage : Go to the next line

        -c color
        color is in hexadecimal format.

        Usage : Change the current color
               0xF0 : Background
               0x0F : Foreground

        -g x y

        Usage : Move cursor to (x;y)

    Hide/Show cursor:
        -h 0/1

        Usage : Hide or show cursor

    Clear Screen:

        Usage : Clear console

        -o x y

        Usage : Change goto origin


        Usage : Reset foreground and background colors


        Usage : Properly stop darkbox

        -w t

        Usage : Wait t miliseconds

        NOTE: Wait is internal to darkbox, it
              do not interrupt batch execution.

        REMARK: Wait flush stdout even if t is null.

Input callback reference:

        m x y b

        x: Mouse X position
        y: Mouse Y position
        b: Mouse button

    Keyboard press:
        k key

        key: Key code.

List of supported mouse buttons :
    1: NOTHING (mouse movement)
    4: DOUBLE LEFT_BUTTON (portability issues known (*NIX))
    5: DOUBLE RIGHT_BUTTON (portability issues known (*NIX))
    7: SCROLL_UP (portability issues known (Win32))
    8: SCROLL_DOWN (portability issues known (Win32))
    9: RELEASE

See also:
    Official post :
    Snake game :
    Exquation :

    tests for examples of uses

    C library core/core_i in "lib" directory (part of darkbox project)

    Dos9 project :
    darkbox_i and darkbox_t

If you need more help, you can ask me or see examples in the "tests" directory :mrgreen:.

Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 1 post ] 

All times are UTC-06:00

Who is online

Users browsing this forum: No registered users and 3 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited