-
Notifications
You must be signed in to change notification settings - Fork 4
OS Limitations
tl;dr: windows = fast & good input, posix = sometimes slow & limited input.
scone
is cross-platform, meaning it will work on both Windows and POSIX (Linux-based, such as Ubuntu and macOS). However there are some differences between the platforms. As a developer it is good practice to know what differs the OS versions. Let's take a look at the differences!
window.write(x,y, ...);
and window.print();
Uses the Windows Console API, resulting in fast output performance.
Uses setCursor(x,y)
and writeln(...)
combined with ANSI escape sequences, resulting in varied performance.
print();
works by looking looking at each line of the window, and determining what lines have been modified. For each modified line, setCursor(x,y);
is called (where y
is the line which is modified, and x
is at the first modified cell), and then all characters gets written to the terminal.
Unfortunately there are no real advice to speed up draw time, other than limiting the amount of times print();
is called.
window.getInputs();
and struct InputEvent {...}
Uses the Windows Console API, resulting in proper key press/release and support for multiple control-keys in each press.
A whole crap-ton of hokus pokus, magic, and prayer.
- Only key-presses are registered via the terminal (not key-releases).
-
InputEvent
s only store one control-key (last control-key pressed) per input. - If multiple keys are pressed at the same time, sometimes none get registered.
- Not all keys are available everywhere, as the inputs differ from machine to machine.
Due to how inputs work in the terminal, an input is sent as a sequence of bytes. These sequences are different on different distributions.
Is is possible to manually bind an input sequence to an input. This is done by entering a specifically formatted line into a file input_sequences.scone
in the same directory as the executable. The lines must follow this syntax:
# in file 'input_sequences.scone' at binary directory
<key (SK.**key**)> \t <control-key> \t <sequence>
# examples
key_2 none 50
a shift 65
down none 27,91,66