Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demo idea: wasm4 #3

Open
osa1 opened this issue Oct 5, 2022 · 1 comment
Open

Demo idea: wasm4 #3

osa1 opened this issue Oct 5, 2022 · 1 comment

Comments

@osa1
Copy link
Owner

osa1 commented Oct 5, 2022

I was thinking about a fun demo application that we can implement using wasmrun, and I think wasm4 would be a fun one.

We need to implement this API in host:

fn blit(sprite: *const u8, x: i32, y: i32, width: u32, height: u32, flags: u32);

fn blit_sub(
    sprite: *const u8,
    x: i32,
    y: i32,
    width: u32,
    height: u32,
    src_x: u32,
    src_y: u32,
    stride: u32,
    flags: u32,
);

fn line(x1: i32, y1: i32, x2: i32, y2: i32);

fn oval(x: i32, y: i32, width: u32, height: u32);

fn rect(x: i32, y: i32, width: u32, height: u32);

fn text(text: *const u8, length: usize, x: i32, y: i32);

fn vline(x: i32, y: i32, len: u32);

fn hline(x: i32, y: i32, len: u32);

fn tone(frequency: u32, duration: u32, volume: u32, flags: u32);

fn diskr(dest: *mut u8, size: u32) -> u32;

fn diskw(src: *const u8, size: u32) -> u32;

fn trace(trace: *const u8, length: usize);

And write user input to a specific location in Wasm application memory and render the bitmap.

@osa1
Copy link
Owner Author

osa1 commented Oct 6, 2022

pixels, minifb, or softbuffer could be used for the windowing and rendering parts. I don't know if they play sounds out of the box, but it should be fine to ignore tone calls at least initially.

softbuffer README says:

Softbuffer should be used over pixels when its GPU-accelerated post-processing effects are not needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant