Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rust 1.06 KB | None | 0 0
  1. use amethyst::config::Config;
  2.  
  3. use serde::{Deserialize, Serialize};
  4.  
  5. #[derive(Debug, Deserialize, Serialize)]
  6. pub struct ArenaConfig {
  7.     pub height: f32,
  8.     pub width: f32,
  9. }
  10.  
  11. impl Default for ArenaConfig {
  12.     fn default() -> Self {
  13.         ArenaConfig {
  14.             height: 100.0,
  15.             width: 100.0,
  16.         }
  17.     }
  18. }
  19.  
  20. #[derive(Debug, Deserialize, Serialize)]
  21. pub struct BallConfig {
  22.     pub velocity: [f32; 2],
  23.     pub radius: f32,
  24. }
  25.  
  26. impl Default for BallConfig {
  27.     fn default() -> Self {
  28.         BallConfig {
  29.             velocity: [75.0, 50.0],
  30.             radius: 2.5,
  31.         }
  32.     }
  33. }
  34.  
  35. #[derive(Debug, Deserialize, Serialize)]
  36. pub struct PaddleConfig {
  37.     pub height: f32,
  38.     pub width: f32,
  39. }
  40.  
  41. impl Default for PaddleConfig {
  42.     fn default() -> Self {
  43.         PaddleConfig {
  44.             height: 15.0,
  45.             width: 2.5,
  46.         }
  47.     }
  48. }
  49.  
  50. #[derive(Debug, Default, Deserialize, Serialize)]
  51. pub struct GameConfig {
  52.     pub arena: ArenaConfig,
  53.     pub ball: BallConfig,
  54.     pub paddle: PaddleConfig,
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement