Skip to content

A simple Rust game engine for WebAssembly

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

richardanaya/rangoon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rangoon

A simple game engine for WebAssembly.

Example

use rangoon::*;

struct Simplest {
    gfx: Graphics,
}

impl Game for Simplest {
    fn new() -> Simplest {
        Simplest {
            gfx: Simplest::build_graphics(),
        }
    }

    fn instance() -> MutexGuard<'static, Simplest> {
        lazy_static::lazy_static! {
            static ref SINGLETON: Mutex<Simplest> = {
                Mutex::new(Simplest::new())
            };
        }
        SINGLETON.lock()
    }

    fn run(&mut self, _delta: f64) {
        self.gfx.ctx.set_fill_color("red");
        self.gfx.ctx.fill_rect(50, 50, 50, 50);
    }

    fn key_down(&mut self, key_code: u32){
      ...
    }
    
    fn key_up(&mut self, key_code: u32){
      ...
    }

    fn mouse_down(&mut self, x: u32, y: u32){
      ...
    }
    
    fn mouse_up(&mut self, x: u32, y: u32){
      ...
    }
    
    fn mouse_move(&mut self, x: u32, y: u32){
      ...
    }
}

#[no_mangle]
pub fn main() {
    Simplest::start();
}

License

This project is licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in rangoon by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

A simple Rust game engine for WebAssembly

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages