API for the creation of character based games in Linux. The inspiration came from the olcConsoleGameEngine. This is my attempt to recreate few of its features in Linux.
At the current stage, the library contains API for the following.
- To create a game board (which is a rectangle of some width and height in characters, called
cells
). - Functions to
draw
strings,set
a cell and tofill
a portion of the board with block Unicode characters. These functions are used to draw the 'World' as well as other 'assets' for the game. - Function to read input from keyboard in a non-blocking faction.
- Arjob's Rust Library - For FFI calls.
use libconsolegameengine::game_engine::*;
struct MyGamePlay;
impl GamePlay for MyGamePlay {
fn init(&mut self, engine: &mut GameEngine) -> bool {
// No static assets.
true
}
fn draw(&mut self, engine: &mut GameEngine, elapsed_time: f64) -> bool {
// Clear the game board.
engine.fill(
0,
0,
engine.width(),
engine.height(),
BlockChars::DarkShade,
BackgroundColors::Black,
ForegroundColors::White,
);
true
}
}
fn main() {
let mut game_play = MyGamePlay;
let mut engine = GameEngine::new(80, 40);
engine.begin(&mut game_play).unwrap();
}