-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
257 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
name = "components" | ||
version = "0.0.1" | ||
authors = ["Tikitko <[email protected]>"] | ||
edition = "2018" | ||
edition = "2021" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,4 +15,4 @@ impl Direction { | |
Self::Up => Self::Down, | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,26 @@ | ||
use std::hash::Hash; | ||
use std::ops::{Add, Sub}; | ||
use std::hash::{Hash}; | ||
|
||
#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] | ||
pub struct Point<N> where | ||
N: Add<Output=N> + Sub<Output=N> + Copy + Eq + Hash { | ||
pub struct Point<N> | ||
where | ||
N: Add<Output = N> + Sub<Output = N> + Copy + Eq + Hash, | ||
{ | ||
x: N, | ||
y: N, | ||
} | ||
|
||
impl<N> Point<N> where | ||
N: Add<Output=N> + Sub<Output=N> + Copy + Eq + Hash { | ||
impl<N> Point<N> | ||
where | ||
N: Add<Output = N> + Sub<Output = N> + Copy + Eq + Hash, | ||
{ | ||
pub fn new(x: N, y: N) -> Self { | ||
Self { | ||
x, | ||
y, | ||
} | ||
Self { x, y } | ||
} | ||
pub fn x(&self) -> N { | ||
self.x | ||
} | ||
pub fn y(&self) -> N { | ||
self.y | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
name = "snake" | ||
version = "0.0.1" | ||
authors = ["Tikitko <[email protected]>"] | ||
edition = "2018" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
components = { path = "../components" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
extern crate components; | ||
|
||
pub mod snake; | ||
pub mod game; | ||
pub mod snake; | ||
pub mod world; | ||
|
||
pub type Point<N> = components::point::Point<N>; | ||
pub type Direction = components::direction::Direction; | ||
pub type AreaSize = u16; | ||
pub type AreaSize = u16; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.