-
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
11 changed files
with
75 additions
and
78 deletions.
There are no files selected for viewing
51 changes: 25 additions & 26 deletions
51
rpg_tools_core/src/model/character/appearance/hair/hairline.rs
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,47 +1,46 @@ | ||
use crate::model::size::Size; | ||
use crate::ui::parser::get_enum; | ||
use crate::ui::parser::UiParser; | ||
use crate::ui::{UiVisitor, UI}; | ||
use macro_convert::Convert; | ||
use macro_ui::ui; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
/// What type of hairline? It is not visible by some hair styles. | ||
/// | ||
/// The [`size`](Size) defines the y position of the hairline. | ||
#[derive(ui, Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] | ||
#[serde(tag = "type")] | ||
pub enum Hairline { | ||
Round { | ||
size: Size, | ||
}, | ||
Straight { | ||
size: Size, | ||
}, | ||
Triangle { | ||
size: Size, | ||
}, | ||
/// /// What style of hairline? It is not visible by some hair styles. | ||
#[derive(Convert, ui, Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)] | ||
pub enum HairlineStyle { | ||
#[default] | ||
Round, | ||
Straight, | ||
Triangle, | ||
/// ```svgbob | ||
/// +----* *----+ | ||
/// / \/ \ | ||
/// | | | ||
/// ``` | ||
WidowsPeak { | ||
size: Size, | ||
}, | ||
WidowsPeak, | ||
} | ||
|
||
/// How does the hairline look like? | ||
|
||
#[derive(ui, Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] | ||
pub struct Hairline { | ||
pub style: HairlineStyle, | ||
/// Defines the y position of the hairline. | ||
pub size: Size, | ||
} | ||
|
||
impl Hairline { | ||
pub fn get_y_position(&self) -> Size { | ||
match self { | ||
Hairline::Round { size } => *size, | ||
Hairline::Straight { size } => *size, | ||
Hairline::Triangle { size } => *size, | ||
Hairline::WidowsPeak { size } => *size, | ||
} | ||
pub fn new(style: HairlineStyle, size: Size) -> Self { | ||
Self { style, size } | ||
} | ||
} | ||
|
||
impl Default for Hairline { | ||
fn default() -> Self { | ||
Self::Round { size: Size::Medium } | ||
Self { | ||
style: HairlineStyle::default(), | ||
size: Size::Medium, | ||
} | ||
} | ||
} |
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
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
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
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