Console Engine
There was a huge internal change between versions 0.x and 1.x. See the Upgrade Guide to migrate your code. There's not much to change on your side !
This library provides simple features for handling user's input and display for terminal applications.
Besides the user input and display, this library also provides some tools to build standalone "screens" that can be used as simply as printing it.
It uses Crossterm as main tool for handling the screen and inputs. You don't have to worry about initalizing anything because the lib will handle this for you.
Features
- Build custom terminal display using shapes or text
- Terminal handling with a target frame per seconds
- Keyboard and mouse support
- Terminal resizing support
- You are not interested by keyboard/mouse handling, even terminal handling ? You can still build "screens" that will just print its content.
- Embedding screens to one another
Platforms
Since it uses crossterm
, it should work on Windows, Linux and possibly Mac (see Tested Terminals on Crossterm's page).
example usage
ConsoleEngine (managing input & output)
use pixel;
use Color;
use KeyCode;
Screens (generating output)
use Screen;
use pixel;
Documentation
Take a look at the generated documentation.
Examples
See examples :
- graph : Display a graph being generated with some values.
- snake : A simple game of snake.
- lines : Draw random lines of random colors on the screen.
- lines-fps : same example as lines, but with a FPS counter.
- shapes : Shape's functions testing tool
- mouse : Simple mouse clicking test
- drag-and-drop : Move a rectangle with your mouse
- screen-simple : Example usage of Screen struct instead of ConsoleEngine
- screen-embed : Example usage of Screen's
print_screen
function to embed one screen into another - screen-swap : Swap between several Screen structures
- tetris : A game of Tetris