Commit ec958e70 authored by Anton Weber's avatar Anton Weber

test SVG rendering

parent fd64e440
......@@ -51,6 +51,10 @@ features = [
"KeyboardEvent",
"HtmlCollection",
"HtmlAnchorElement",
"SvgGraphicsElement",
"SvgTransform",
"SvgTransformList",
"SvgAnimatedTransformList",
]
[profile.dev]
......
......@@ -16,6 +16,7 @@ pub struct InGameState {
resources: legion::Resources,
schedule: legion::Schedule,
registered_images: Vec<resources::ImageHandle>,
transform: web_sys::SvgTransform,
}
impl InGameState {
......@@ -73,12 +74,25 @@ impl InGameState {
;
let schedule = schedule_builder.build();
let svg_test_element =
utils::get_element_by_id::<web_sys::SvgGraphicsElement>("svgtest").unwrap();
crate::console_log!(
"number_of_items: {}",
svg_test_element.transform().base_val().number_of_items()
);
let transform = svg_test_element.transform().base_val().get(0).unwrap();
transform.set_rotate(90., 1000., 500.).unwrap();
InGameState {
gui_svg: utils::get_element_by_id("ingame-ui").unwrap(),
world,
resources,
schedule,
registered_images: vec![foreground, background],
transform,
}
}
}
......@@ -150,6 +164,9 @@ impl gamestate::State for InGameState {
fn update(&mut self, timestamp: f64) -> gamestate::Transition {
use legion::IntoQuery;
// self.transform
// .set_rotate(timestamp as f32, 1920. / 2., 1080. / 2.);
self.resources
.get_mut::<resources::Clock>()
.unwrap()
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment