Add and use a custom canvas element on the page
Tell bevy to find the canvas with ID "#boids-canvas" instead of creating it's own.
This commit is contained in:
@@ -10,6 +10,7 @@ fn main() {
|
|||||||
App::new()
|
App::new()
|
||||||
.add_plugins(DefaultPlugins.set(WindowPlugin {
|
.add_plugins(DefaultPlugins.set(WindowPlugin {
|
||||||
primary_window: Some(Window {
|
primary_window: Some(Window {
|
||||||
|
canvas: Some("#boids-canvas".to_owned()),
|
||||||
fit_canvas_to_parent: true,
|
fit_canvas_to_parent: true,
|
||||||
prevent_default_event_handling: false,
|
prevent_default_event_handling: false,
|
||||||
..default()
|
..default()
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<body style="margin: 0px;">
|
<body style="margin: 0px;">
|
||||||
|
<canvas id="boids-canvas" width="1280" height="720"></canvas>
|
||||||
<script type="module">
|
<script type="module">
|
||||||
import init from './boids.js'
|
import init from './boids.js'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user