Skip to content

Commit

Permalink
[#42] Update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Orchaldir committed Sep 23, 2023
1 parent 7b8b89e commit 97a87fe
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 14 deletions.
17 changes: 10 additions & 7 deletions rpg_tools_rendering/examples/pants.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
extern crate rpg_tools_core;
extern crate rpg_tools_rendering;

use crate::utils::render::render_2_sets;
use crate::utils::render::{add_names, render_2_sets};
use rpg_tools_core::model::character::appearance::body::{Body, BodyShape};
use rpg_tools_core::model::character::appearance::Appearance;
use rpg_tools_core::model::color::Color;
Expand All @@ -21,17 +21,20 @@ fn main() {
render_2_sets(
"pants.svg",
pants,
BodyShape::get_all(),
add_names(BodyShape::get_all()),
create_appearance,
false,
);
}

fn create(style: PantsStyle) -> Pants {
Pants {
style,
color: Color::Blue,
}
fn create(style: PantsStyle) -> (String, Pants) {
(
style.to_string(),
Pants {
style,
color: Color::Blue,
},
)
}

fn create_appearance(height: Length, pants: &Pants, shape: &BodyShape) -> Appearance {
Expand Down
21 changes: 14 additions & 7 deletions rpg_tools_rendering/examples/shirts.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
extern crate rpg_tools_core;
extern crate rpg_tools_rendering;

use crate::utils::render::render_2_sets;
use crate::utils::render::{add_names, render_2_sets};
use rpg_tools_core::model::character::appearance::body::{Body, BodyShape};
use rpg_tools_core::model::character::appearance::Appearance;
use rpg_tools_core::model::color::Color;
Expand All @@ -16,23 +16,30 @@ fn main() {

for neckline in Neckline::get_all() {
for sleeve_style in SleeveStyle::get_all() {
shirts.push(Shirt {
sleeve_style,
neckline,
color: Color::Aqua,
})
shirts.push(create(neckline, sleeve_style))
}
}

render_2_sets(
"shirts.svg",
shirts,
BodyShape::get_all(),
add_names(BodyShape::get_all()),
create_appearance,
false,
);
}

fn create(neckline: Neckline, sleeve_style: SleeveStyle) -> (String, Shirt) {
(
format!("{} {}", neckline, sleeve_style),
Shirt {
sleeve_style,
neckline,
color: Color::Aqua,
},
)
}

fn create_appearance(height: Length, shirt: &Shirt, shape: &BodyShape) -> Appearance {
Appearance::humanoid(
Body {
Expand Down

0 comments on commit 97a87fe

Please sign in to comment.