javascript constructor
This commit is contained in:
parent
a473b78756
commit
a0a125b61c
2
main.js
2
main.js
|
@ -148,7 +148,7 @@ async function run() {
|
||||||
|
|
||||||
const width = 40;
|
const width = 40;
|
||||||
const height = 50;
|
const height = 50;
|
||||||
const universe = Universe.new(width, height);
|
const universe = new Universe(width, height);
|
||||||
|
|
||||||
const TIMEFACTOR = 10000.0;
|
const TIMEFACTOR = 10000.0;
|
||||||
const MAX_DT = 2.0/Math.max(width, height);
|
const MAX_DT = 2.0/Math.max(width, height);
|
||||||
|
|
|
@ -22,6 +22,7 @@ pub struct Universe {
|
||||||
|
|
||||||
#[wasm_bindgen]
|
#[wasm_bindgen]
|
||||||
impl Universe {
|
impl Universe {
|
||||||
|
#[wasm_bindgen(constructor)]
|
||||||
pub fn new(width: u32, height: u32) -> Self {
|
pub fn new(width: u32, height: u32) -> Self {
|
||||||
Self {
|
Self {
|
||||||
sys: (System::new(width, height), System::new(width, height)),
|
sys: (System::new(width, height), System::new(width, height)),
|
||||||
|
|
Loading…
Reference in New Issue