You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.1KB

  1. use sprite::Sprite;
  2. use tile::*;
  3. // player, creatures, treasure, objects etc
  4. #[derive(Debug, Clone, Copy)]
  5. pub struct Entity {
  6. pub pos: Tile2D,
  7. pub hue: f32,
  8. pub sprite: Sprite,
  9. }
  10. impl Default for Entity {
  11. fn default() -> Entity {
  12. Entity {
  13. pos: Tile2D { x: 0, y: 0 },
  14. hue: 0.0,
  15. sprite: Sprite::Coin,
  16. }
  17. }
  18. }
  19. // walls, floors, anything that's part of the background or a barrier
  20. // no pos as these will be stationary and managed by an owning object
  21. //
  22. #[derive(Debug, Clone, Copy)]
  23. pub struct Terrain {
  24. pub pos: Tile2D,
  25. pub hue: f32,
  26. pub saturation: f32,
  27. pub lightness: f32,
  28. pub sprite: Sprite,
  29. pub is_barrier: bool,
  30. pub priority: i32, // only useful during level generation
  31. }
  32. impl Default for Terrain {
  33. fn default() -> Terrain {
  34. Terrain {
  35. pos: Tile2D { x: 0, y: 0 },
  36. hue: 0.0,
  37. saturation: 70.0,
  38. lightness: 50.0,
  39. sprite: Sprite::WallRed,
  40. is_barrier: false,
  41. priority: 0,
  42. }
  43. }
  44. }