Skip to content

Commit

Permalink
add img
Browse files Browse the repository at this point in the history
  • Loading branch information
xxrlzzz committed Jan 4, 2023
1 parent ece9d71 commit 65b78b0
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 3 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@ Note due to the performance issue, you should run in release mode to get enough
- Web(Wasm + WebGL)


## Screenshots

- web
![web](./img/web.png)

- desktop
![desktop](./img/desktop.png)

- integration with streaming and co-play
![stream](./img/stream_integration.png)

## TODO

- [x] Audio support
Expand Down
2 changes: 1 addition & 1 deletion build/android/app/jni/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ add_subdirectory(SDL)
#add_subdirectory(SDL_ttf)

# Your game and its CMakeLists.txt are in a subfolder named "src"
add_subdirectory(src)
#add_subdirectory(src)

Binary file added img/desktop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/stream_integration.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/web.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 0 additions & 2 deletions src/controller/web_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ pub fn keyboard_listen() -> Result<(), JsValue> {
info!("keyboard_listen");
{
let closure = Closure::wrap(Box::new(move |event: web_sys::KeyboardEvent| {
// message_keydown.set_text_content(Some(&format!("keydown: {}", event.key_code())));
KEYBOARD_STATE
.lock()
.unwrap()
Expand All @@ -65,7 +64,6 @@ pub fn keyboard_listen() -> Result<(), JsValue> {
}
{
let closure = Closure::wrap(Box::new(move |event: web_sys::KeyboardEvent| {
// message_keyup.set_text_content(Some(&format!("keyup: {}", event.key_code())));
KEYBOARD_STATE
.lock()
.unwrap()
Expand Down
10 changes: 10 additions & 0 deletions src/web.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ impl WebNes {
})
}

pub fn default() -> Self {
let data = include_bytes!("../assets/mario.nes");
let ele = "canvas";
let audio_sample_rate = 44100.0;
let data = js_sys::Uint8Array::from(data.as_ref());
let ele = JsValue::from_str(ele);
WebNes::new(data, ele, audio_sample_rate).unwrap()
}

pub fn do_frame(&mut self) {
let frame = self.emulator.frame(&mut self.instance);
if frame.is_some() {
Expand Down Expand Up @@ -76,6 +85,7 @@ impl WebNes {
}
}
}

pub fn create_gl(ele: &str) -> Result<GlWrapper, JsValue> {
let document = web_sys::window().unwrap().document().unwrap();
let canvas = document.get_element_by_id(ele);
Expand Down

0 comments on commit 65b78b0

Please sign in to comment.