Advertisement
Guest User

Untitled

a guest
Jan 31st, 2015
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. extern crate tcod;
  2.  
  3. use std::collections::VecMap;
  4.  
  5. use tcod::{
  6. Console,
  7. Color,
  8. BackgroundFlag,
  9. };
  10.  
  11. use tcod::colors;
  12.  
  13. struct Object(u32);
  14.  
  15. struct Position {
  16. x: i32,
  17. y: i32,
  18. }
  19.  
  20. struct Appearance {
  21. color: Color,
  22. character: char,
  23. }
  24.  
  25. struct Engine {
  26. object_counter: u32,
  27.  
  28. positions: VecMap,
  29. appearances: VecMap,
  30. }
  31.  
  32. impl Engine {
  33. fn new() -> Self {
  34. Engine {
  35. object_counter: 0,
  36.  
  37. positions: VecMap::new(),
  38. appearances: VecMap::new(),
  39. }
  40. }
  41.  
  42. fn new_object(&self) -> Object {
  43. object_counter += 1
  44. Object(object_counter)
  45. }
  46. }
  47.  
  48. fn main() {
  49. let mut root = Console::init_root(64, 48, "Hello, world!", false);
  50. root.clear();
  51.  
  52. let engine = Engine::new();
  53.  
  54. let player = engine.new_object();
  55.  
  56. while !Console::window_closed() {
  57. Console::flush();
  58.  
  59. let key = Console::wait_for_keypress(true);
  60. }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement