1 unstable release
0.1.0 | Mar 5, 2023 |
---|
#2153 in Game dev
61KB
1.5K
SLoC
Terminity
The entrypoint and only executable of the project. Check out the project's readme or the docs for more details.
lib.rs
:
Crate to register multiple terminal games, allow to choose a game and set up an environment to run them. This is at an extremely early development stage.
To try it, clone the project and run cargo run Chess
or cargo run SuperTicTacToe
.
The purposes and goals of this crate are to to:
- Make it easier to build good UI in terminal
- Make terminal games accessible to anyone and everyone. A windows
.exe
is to be expected, and I'd love to make a smartphone app.
I would also love to setup a P2P (peer to peer) system allowing to play the games online with anyone, and giving the programmers an API to setup an online game without a mandatory need for a server (although a way to create a server-client game is to be expected if the P2P system is created). Making the P2P system seems feasible, but I don't know yet for the API.
This project is of course not feasible alone. It needs at least a community to try it and give feedback. If you want to support this project in any way, from being part of a subreddit to be an active developer, please do!! You don't have to be a developer or have money to spend to help, and any help is probably more helping than you expect.
Currently, to ease the UI building, a bit of configuration is made to help making something of quality. That is:
- Enable paste, focus change, and mouse captures
- Put the terminal in "alternate screen"
- Enable raw mode
- Save cursor position and move it to 0,0
- When any unwind (and thus most panics) occurs, the terminal state is restored before the unwinding data is displayed (the display may be improved though). Without that, the terminal state keeps the configuration and the sh CLI becomes crappy.
The result of doing all this can be seen for instance on the chess implementation, where dragging with the mouse is supported, and any keyboard input is captured immediately.
Dependencies
~6–17MB
~177K SLoC