Created
November 16, 2019 09:38
-
-
Save maciej-makowski/7520585e8eb61ed24a02e11c8847a54d to your computer and use it in GitHub Desktop.
JS13K game test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![no_std] | |
#![feature(maybe_uninit_ref)] | |
extern crate alloc; | |
use core::f64::consts::PI; | |
//use no_panic::no_panic; | |
use wasm_bindgen::prelude::*; | |
use web_sys::*; | |
// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global | |
// allocator. | |
#[cfg(feature = "wee_alloc")] | |
#[global_allocator] | |
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; | |
static mut C_X: f64 = 100_f64; | |
static mut C_Y: f64 = 100_f64; | |
#[wasm_bindgen] | |
pub fn render_frame(ctx: CanvasRenderingContext2d, time: f64) { | |
unsafe { | |
C_X += 50_f64 * time.sin(); | |
C_Y += 50_f64 * time.cos(); | |
ctx.arc(C_X, C_Y, 100_f64, 0_f64, 2_f64 * PI); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Retained Bytes │ Retained % │ Dominator Tree | |
────────────────┼────────────┼─────────────────────────────────────────────────────────────────────────────────── | |
8641 ┊ 98.80% ┊ export "render_frame" | |
8626 ┊ 98.63% ┊ ⤷ code[9] | |
8611 ┊ 98.46% ┊ ⤷ code[4] | |
5239 ┊ 59.90% ┊ ⤷ code[1] | |
3150 ┊ 36.02% ┊ ⤷ code[0] | |
69 ┊ 0.79% ┊ ⤷ data[2] | |
37 ┊ 0.42% ┊ ⤷ code[6] | |
8 ┊ 0.09% ┊ ⤷ type[4]: (i32, i32, i32, i32) -> i32 | |
1180 ┊ 13.49% ┊ ⤷ data[1] | |
867 ┊ 9.91% ┊ ⤷ code[2] | |
840 ┊ 9.60% ┊ ⤷ code[3] | |
251 ┊ 2.87% ┊ ⤷ code[5] | |
59 ┊ 0.67% ┊ ⤷ import ./js13k_test_rs.js::__widl_f_arc_CanvasRenderingContext2D | |
53 ┊ 0.61% ┊ ⤷ code[7] | |
7 ┊ 0.08% ┊ ⤷ type[5]: (i32, i32, f64, f64) -> nil | |
48 ┊ 0.55% ┊ ⤷ import ./js13k_test_rs.js::__wbindgen_object_drop_ref | |
18 ┊ 0.21% ┊ ⤷ data[0] | |
8 ┊ 0.09% ┊ ⤷ global[0] | |
5 ┊ 0.06% ┊ ⤷ type[3]: (f64) -> f64 | |
5 ┊ 0.06% ┊ ⤷ type[1]: (i32, f64) -> nil | |
47 ┊ 0.54% ┊ export "__wbindgen_exn_store" | |
24 ┊ 0.27% ┊ ⤷ code[8] | |
11 ┊ 0.13% ┊ export "memory" | |
2 ┊ 0.02% ┊ ⤷ memory[0] | |
8 ┊ 0.09% ┊ wasm magic bytes | |
7 ┊ 0.08% ┊ code section headers | |
4 ┊ 0.05% ┊ type[0]: (i32) -> nil | |
4 ┊ 0.05% ┊ data section headers | |
3 ┊ 0.03% ┊ type section headers | |
3 ┊ 0.03% ┊ import section headers | |
3 ┊ 0.03% ┊ memory section headers | |
3 ┊ 0.03% ┊ global section headers | |
3 ┊ 0.03% ┊ export section headers | |
9 ┊ 0.10% ┊ [1 Unreachable Items] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment