Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extern crate tcod;
- use std::collections::VecMap;
- use tcod::{
- Console,
- Color,
- BackgroundFlag,
- };
- use tcod::colors;
- struct Object(u32);
- struct Position {
- x: i32,
- y: i32,
- }
- struct Appearance {
- color: Color,
- character: char,
- }
- struct Engine {
- object_counter: u32,
- positions: VecMap,
- appearances: VecMap,
- }
- impl Engine {
- fn new() -> Self {
- Engine {
- object_counter: 0,
- positions: VecMap::new(),
- appearances: VecMap::new(),
- }
- }
- fn new_object(&self) -> Object {
- object_counter += 1
- Object(object_counter)
- }
- }
- fn main() {
- let mut root = Console::init_root(64, 48, "Hello, world!", false);
- root.clear();
- let engine = Engine::new();
- let player = engine.new_object();
- while !Console::window_closed() {
- Console::flush();
- let key = Console::wait_for_keypress(true);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement