Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Engel Simulator 2020
Engel Simulator 2020
Commits
ec958e70
Commit
ec958e70
authored
Jan 11, 2021
by
Anton Weber
Browse files
test SVG rendering
parent
fd64e440
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Cargo.toml
View file @
ec958e70
...
...
@@ -51,6 +51,10 @@ features = [
"KeyboardEvent"
,
"HtmlCollection"
,
"HtmlAnchorElement"
,
"SvgGraphicsElement"
,
"SvgTransform"
,
"SvgTransformList"
,
"SvgAnimatedTransformList"
,
]
[profile.dev]
...
...
src/states/ingame.rs
View file @
ec958e70
...
...
@@ -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
()
...
...
www/src/index.html
View file @
ec958e70
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment