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 , 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 ).
Windows download : http://sachadee.org/Ts/darkbox/darkbox-dist.7z
Unix download : http://sachadee.org/Ts/darkbox/darkbox-dist.tar.xz
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 : http://pix.toile-libre.org/upload/original/1487159497.png http://pix.toile-libre.org/upload/original/1487159523.png
it.bat : http://pix.toile-libre.org/upload/original/1487159539.png http://pix.toile-libre.org/upload/original/1487159553.png
geometry.bat : http://pix.toile-libre.org/upload/original/1487159567.png http://pix.toile-libre.org/upload/original/1487159584.png
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
Also, darkbox accept both new syntax ('-') and batbox/tinybg syntax ('/') to
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"
Launcher (and working variations):
Original (first) :
call game.bat | darkbox
Original with Input server
darkbox -i | call game.bat | darkbox
Enhanced (only in one file) :
if defined __ goto :(code)
call %0 %* | darkbox
"call" is facultative
Enhanced with Input server
if defined __ goto :(code)
darkbox -i | call %0 %* | darkbox
"call" is facultative.
Unofficial launcher (variants):
if not defined $ (
call "%~f0" %*
) | darkbox
Output commands reference:
Usage : Print the character corresponding to the integer
Usage : Go to the next line
color is in hexadecimal format.
Usage : Change the current color
0xF0 : Background
0x0F : Foreground
-g x y
Usage : Move cursor to (x;y)
Usage : Hide or show cursor
Usage : Clear console
-o x y
Usage : Change goto origin
Usage : Reset foreground and background colors
Usage : Properly stop darkbox
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
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))
Official post : http://batch.xoo.it/t5526-Dev-Darkbox-TSnake41.htm
Snake game : http://batch.xoo.it/t5614-Batch-Snake-IK-DC.htm
Exquation : http://batch.xoo.it/t5654-Batch-Exquation-IK-DC.htm
tests for examples of uses
C library core/core_i in "lib" directory (part of darkbox project)
Dos9 project : dos9.org
darkbox_i and darkbox_t
If you need more help, you can ask me or see examples in the "tests" directory .