Crates.io | gamemap |
lib.rs | gamemap |
version | 0.1.0 |
source | src |
created_at | 2017-11-06 22:53:34.230144 |
updated_at | 2017-11-06 22:53:34.230144 |
description | A small 2D Map library for console games in Rust. |
homepage | |
repository | https://github.com/DimChtz/rust-gamemap |
max_upload_size | |
id | 38388 |
size | 6,539 |
A small 2D Map library for console games in Rust.
let mut m = gamemap::Map::new(20, 20);
m.update();
let mut utext = String::from("This is some text above the map!!!");
let mut ltext = String::from("This is some text below the map!!!");
m.set_uppertext(utext)
.set_lowertext(ltext)
.update();
let mut sprites = vec![((15u32, 7u32), 'P'),
((9u32, 12u32), 'E'),
((11u32, 6u32), 'E')];
m.add_sprite(sprites[0])
.add_sprite(sprites[1])
.add_sprite(sprites[2])
.update();
m.move_sprite(sprites[0].0, (1u32, 1u32))
.update();
m.remove_sprite(sprites[1].0)
.remove_sprite(sprites[2].0)
.update();
m.clear()
.update();
Add this line to your Cargo.toml:
[dependencies]
gamemap = "0.1.0"
and then add this line to your main.rs:
extern crate gamemap;