idea was to improve examples/snake.cpp, but one thing led to another and here are the (not yet done) results:
tui.hpp
macro renames
better (doc) comments
usable screen::size() incredibly fast
doesn't brake existing code ( I suppose )
input
a pretty handy header with (I'd say) high-level functions and types to improve reading input from cin.
it's quite minimal though, uses macro magic (not intentionally, but it's needed to reduce code size and overcome some of c++ 's difficulties)
supported input:
basic characters, be it upper or lowercase, special ones like: ['ö', 'ä', 'á', ...] are ignored
basic symbols, such as ['~', ';', '*', ...], but not ['$', '€', ...]
Ctrl+alphabetical characters
arrows
Backspace, Tab, Enter/Return
F[1,2,3,4]
[!IMPORTANT]
caveats:
can't properly read Escape: there is a one character input delay, as there are Escape Sentences (like Arrows, F keys), which hence the name, start with an Escape
windows is weird, might get better
snake
visible score during game
adaptive speed
snake starts at size 5
examples
new examples/read_input.cpp showing the capabilities of Input
others were updated to use Input as well
readme
updated accordingly
misc/ci
created CMakeLists.txt, that builds everything from examples.
idea was to improve
examples/snake.cpp
, but one thing led to another and here are the (not yet done) results:tui.hpp
screen::size()
incredibly fastdoesn't brake existing code ( I suppose )
input
a pretty handy header with (I'd say) high-level functions and types to improve reading input from
cin
.it's quite minimal though, uses macro magic (not intentionally, but it's needed to reduce code size and overcome some of
c++
's difficulties)supported input:
['ö', 'ä', 'á', ...]
are ignored['~', ';', '*', ...]
, but not['$', '€', ...]
+alphabetical characters
snake
examples
examples/read_input.cpp
showing the capabilities ofInput
Input
as wellreadme
updated accordingly
misc/ci
created
CMakeLists.txt
, that builds everything fromexamples
.