Remove serde dependency

This commit is contained in:
Stephen Seo 2023-02-23 18:08:41 +09:00
parent b647364e2e
commit e3f74d3f3e
4 changed files with 13 additions and 37 deletions

21
Cargo.lock generated
View file

@ -97,7 +97,6 @@ version = "0.1.1"
dependencies = [ dependencies = [
"bindgen", "bindgen",
"rand", "rand",
"serde",
] ]
[[package]] [[package]]
@ -245,26 +244,6 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
[[package]]
name = "serde"
version = "1.0.152"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.152"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]] [[package]]
name = "shlex" name = "shlex"
version = "1.1.0" version = "1.1.0"

View file

@ -9,7 +9,7 @@ edition = "2021"
[dependencies] [dependencies]
#quicksilver = { version = "0.3.19", default-features = false, features = [ "fonts", "saving", "sounds" ] } #quicksilver = { version = "0.3.19", default-features = false, features = [ "fonts", "saving", "sounds" ] }
rand = "0.7.2" rand = "0.7.2"
serde = { version = "1.0.101", features = ["derive"] } #serde = { version = "1.0.101", features = ["derive"] }
[build-dependencies] [build-dependencies]
bindgen = "0.64" bindgen = "0.64"

View file

@ -2,13 +2,11 @@ use std::collections::HashMap;
use std::ops::{Add, AddAssign, Mul, Sub, SubAssign}; use std::ops::{Add, AddAssign, Mul, Sub, SubAssign};
use std::path::Path; use std::path::Path;
use serde::{Deserialize, Serialize};
use crate::agnostic_interface::{ use crate::agnostic_interface::{
FontInterface, GameInterface, ImageInterface, MusicInterface, SoundInterface, FontInterface, GameInterface, ImageInterface, MusicInterface, SoundInterface,
}; };
#[derive(Copy, Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub struct Color { pub struct Color {
pub r: u8, pub r: u8,
pub g: u8, pub g: u8,
@ -43,7 +41,7 @@ impl Color {
} }
} }
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq)]
pub struct Rectangle { pub struct Rectangle {
pub x: f32, pub x: f32,
pub y: f32, pub y: f32,
@ -73,7 +71,7 @@ impl Default for Rectangle {
} }
} }
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq)]
pub struct Circle { pub struct Circle {
pub x: f32, pub x: f32,
pub y: f32, pub y: f32,
@ -91,7 +89,7 @@ impl Circle {
} }
} }
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq)]
pub struct Vector { pub struct Vector {
pub x: f32, pub x: f32,
pub y: f32, pub y: f32,
@ -156,7 +154,7 @@ impl From<(f32, f32)> for Vector {
} }
} }
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq)]
pub struct Transform { pub struct Transform {
pub mat: [f32; 9], pub mat: [f32; 9],
} }

View file

@ -3,7 +3,6 @@ use std::{path::PathBuf, str::FromStr};
use crate::agnostic_interface::CameraInterface; use crate::agnostic_interface::CameraInterface;
use crate::faux_quicksilver::{Circle, Color, Rectangle, Transform, Vector, Window}; use crate::faux_quicksilver::{Circle, Color, Rectangle, Transform, Vector, Window};
use rand::prelude::*; use rand::prelude::*;
use serde::{Deserialize, Serialize};
const WIDTH_F: f32 = 800.0; const WIDTH_F: f32 = 800.0;
const HEIGHT_F: f32 = 600.0; const HEIGHT_F: f32 = 600.0;
@ -523,7 +522,7 @@ impl Menu {
} }
} }
#[derive(Serialize, Deserialize, Clone)] #[derive(Clone)]
struct Particle { struct Particle {
rect: Rectangle, rect: Rectangle,
circle: Circle, circle: Circle,
@ -536,7 +535,7 @@ struct Particle {
life_timer: f32, life_timer: f32,
} }
#[derive(Serialize, Deserialize, Clone)] #[derive(Clone)]
struct ParticleSystem { struct ParticleSystem {
particles: Vec<Particle>, particles: Vec<Particle>,
spawn_timer: f32, spawn_timer: f32,
@ -687,7 +686,7 @@ impl ParticleSystem {
} }
} }
#[derive(Serialize, Deserialize, Clone)] #[derive(Clone)]
struct RotatingParticleSystem { struct RotatingParticleSystem {
particle_system: ParticleSystem, particle_system: ParticleSystem,
r: f32, r: f32,
@ -885,7 +884,7 @@ impl ExplConvParticleSystem {
} }
} }
#[derive(Serialize, Deserialize, Clone)] #[derive(Clone)]
struct Planet { struct Planet {
circle: Circle, circle: Circle,
color: Color, color: Color,
@ -971,7 +970,7 @@ impl Planet {
} }
} }
#[derive(Clone, Serialize, Deserialize)] #[derive(Clone)]
struct Star { struct Star {
color: Color, color: Color,
particle_system: ParticleSystem, particle_system: ParticleSystem,
@ -1039,7 +1038,7 @@ impl Star {
} }
} }
#[derive(Clone, Serialize, Deserialize)] #[derive(Clone)]
struct Fish { struct Fish {
pos: Vector, pos: Vector,
r: f32, r: f32,
@ -1172,7 +1171,7 @@ impl Fish {
} }
} }
#[derive(Serialize, Deserialize, Clone)] #[derive(Clone)]
struct SaveData { struct SaveData {
planets: Vec<Planet>, planets: Vec<Planet>,
stars: Vec<Star>, stars: Vec<Star>,