Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 12 additions & 5 deletions code/beginner/tutorial1-window/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ use winit::{

#[cfg(target_arch = "wasm32")]
use wasm_bindgen::prelude::*;
#[cfg(target_arch = "wasm32")]
use winit::platform::web::EventLoopExtWebSys;

// This will store the state of our game
pub struct State {
Expand Down Expand Up @@ -156,11 +158,16 @@ pub fn run() -> anyhow::Result<()> {
}

let event_loop = EventLoop::with_user_event().build()?;
let mut app = App::new(
#[cfg(target_arch = "wasm32")]
&event_loop,
);
event_loop.run_app(&mut app)?;
#[cfg(not(target_arch = "wasm32"))]
{
let mut app = App::new();
event_loop.run_app(&mut app)?;
}
#[cfg(target_arch = "wasm32")]
{
let app = App::new(&event_loop);
event_loop.spawn_app(app);
}

Ok(())
}
Expand Down
17 changes: 12 additions & 5 deletions code/beginner/tutorial2-surface/src/challenge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ use winit::{

#[cfg(target_arch = "wasm32")]
use wasm_bindgen::prelude::*;
#[cfg(target_arch = "wasm32")]
use winit::platform::web::EventLoopExtWebSys;

pub struct State {
surface: wgpu::Surface<'static>,
Expand Down Expand Up @@ -291,11 +293,16 @@ pub fn run() -> anyhow::Result<()> {
}

let event_loop = EventLoop::with_user_event().build()?;
let mut app = App::new(
#[cfg(target_arch = "wasm32")]
&event_loop,
);
event_loop.run_app(&mut app)?;
#[cfg(not(target_arch = "wasm32"))]
{
let mut app = App::new();
event_loop.run_app(&mut app)?;
}
#[cfg(target_arch = "wasm32")]
{
let app = App::new(&event_loop);
event_loop.spawn_app(app);
}

Ok(())
}
Expand Down
17 changes: 12 additions & 5 deletions code/beginner/tutorial2-surface/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ use winit::{

#[cfg(target_arch = "wasm32")]
use wasm_bindgen::prelude::*;
#[cfg(target_arch = "wasm32")]
use winit::platform::web::EventLoopExtWebSys;

pub struct State {
surface: wgpu::Surface<'static>,
Expand Down Expand Up @@ -294,11 +296,16 @@ pub fn run() -> anyhow::Result<()> {
}

let event_loop = EventLoop::with_user_event().build()?;
let mut app = App::new(
#[cfg(target_arch = "wasm32")]
&event_loop,
);
event_loop.run_app(&mut app)?;
#[cfg(not(target_arch = "wasm32"))]
{
let mut app = App::new();
event_loop.run_app(&mut app)?;
}
#[cfg(target_arch = "wasm32")]
{
let app = App::new(&event_loop);
event_loop.spawn_app(app);
}

Ok(())
}
Expand Down
17 changes: 12 additions & 5 deletions code/beginner/tutorial3-pipeline/src/challenge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ use winit::{

#[cfg(target_arch = "wasm32")]
use wasm_bindgen::prelude::*;
#[cfg(target_arch = "wasm32")]
use winit::platform::web::EventLoopExtWebSys;

pub struct State {
surface: wgpu::Surface<'static>,
Expand Down Expand Up @@ -423,11 +425,16 @@ pub fn run() -> anyhow::Result<()> {
}

let event_loop = EventLoop::with_user_event().build()?;
let mut app = App::new(
#[cfg(target_arch = "wasm32")]
&event_loop,
);
event_loop.run_app(&mut app)?;
#[cfg(not(target_arch = "wasm32"))]
{
let mut app = App::new();
event_loop.run_app(&mut app)?;
}
#[cfg(target_arch = "wasm32")]
{
let app = App::new(&event_loop);
event_loop.spawn_app(app);
}

Ok(())
}
Expand Down
17 changes: 12 additions & 5 deletions code/beginner/tutorial3-pipeline/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ use winit::{

#[cfg(target_arch = "wasm32")]
use wasm_bindgen::prelude::*;
#[cfg(target_arch = "wasm32")]
use winit::platform::web::EventLoopExtWebSys;

pub struct State {
surface: wgpu::Surface<'static>,
Expand Down Expand Up @@ -361,11 +363,16 @@ pub fn run() -> anyhow::Result<()> {
}

let event_loop = EventLoop::with_user_event().build()?;
let mut app = App::new(
#[cfg(target_arch = "wasm32")]
&event_loop,
);
event_loop.run_app(&mut app)?;
#[cfg(not(target_arch = "wasm32"))]
{
let mut app = App::new();
event_loop.run_app(&mut app)?;
}
#[cfg(target_arch = "wasm32")]
{
let app = App::new(&event_loop);
event_loop.spawn_app(app);
}

Ok(())
}
Expand Down
17 changes: 12 additions & 5 deletions code/beginner/tutorial4-buffer/src/challenge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ use winit::{

#[cfg(target_arch = "wasm32")]
use wasm_bindgen::prelude::*;
#[cfg(target_arch = "wasm32")]
use winit::platform::web::EventLoopExtWebSys;

#[repr(C)]
#[derive(Copy, Clone, Debug, bytemuck::Pod, bytemuck::Zeroable)]
Expand Down Expand Up @@ -497,11 +499,16 @@ pub fn run() -> anyhow::Result<()> {
}

let event_loop = EventLoop::with_user_event().build()?;
let mut app = App::new(
#[cfg(target_arch = "wasm32")]
&event_loop,
);
event_loop.run_app(&mut app)?;
#[cfg(not(target_arch = "wasm32"))]
{
let mut app = App::new();
event_loop.run_app(&mut app)?;
}
#[cfg(target_arch = "wasm32")]
{
let app = App::new(&event_loop);
event_loop.spawn_app(app);
}

Ok(())
}
Expand Down
17 changes: 12 additions & 5 deletions code/beginner/tutorial4-buffer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ use winit::{

#[cfg(target_arch = "wasm32")]
use wasm_bindgen::prelude::*;
#[cfg(target_arch = "wasm32")]
use winit::platform::web::EventLoopExtWebSys;

#[repr(C)]
#[derive(Copy, Clone, Debug, bytemuck::Pod, bytemuck::Zeroable)]
Expand Down Expand Up @@ -437,11 +439,16 @@ pub fn run() -> anyhow::Result<()> {
}

let event_loop = EventLoop::with_user_event().build()?;
let mut app = App::new(
#[cfg(target_arch = "wasm32")]
&event_loop,
);
event_loop.run_app(&mut app)?;
#[cfg(not(target_arch = "wasm32"))]
{
let mut app = App::new();
event_loop.run_app(&mut app)?;
}
#[cfg(target_arch = "wasm32")]
{
let app = App::new(&event_loop);
event_loop.spawn_app(app);
}

Ok(())
}
Expand Down
17 changes: 12 additions & 5 deletions code/beginner/tutorial5-textures/src/challenge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ use winit::{

#[cfg(target_arch = "wasm32")]
use wasm_bindgen::prelude::*;
#[cfg(target_arch = "wasm32")]
use winit::platform::web::EventLoopExtWebSys;

mod texture;

Expand Down Expand Up @@ -526,11 +528,16 @@ pub fn run() -> anyhow::Result<()> {
}

let event_loop = EventLoop::with_user_event().build()?;
let mut app = App::new(
#[cfg(target_arch = "wasm32")]
&event_loop,
);
event_loop.run_app(&mut app)?;
#[cfg(not(target_arch = "wasm32"))]
{
let mut app = App::new();
event_loop.run_app(&mut app)?;
}
#[cfg(target_arch = "wasm32")]
{
let app = App::new(&event_loop);
event_loop.spawn_app(app);
}

Ok(())
}
Expand Down
17 changes: 12 additions & 5 deletions code/beginner/tutorial5-textures/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ use winit::{

#[cfg(target_arch = "wasm32")]
use wasm_bindgen::prelude::*;
#[cfg(target_arch = "wasm32")]
use winit::platform::web::EventLoopExtWebSys;

mod texture;

Expand Down Expand Up @@ -485,11 +487,16 @@ pub fn run() -> anyhow::Result<()> {
}

let event_loop = EventLoop::with_user_event().build()?;
let mut app = App::new(
#[cfg(target_arch = "wasm32")]
&event_loop,
);
event_loop.run_app(&mut app)?;
#[cfg(not(target_arch = "wasm32"))]
{
let mut app = App::new();
event_loop.run_app(&mut app)?;
}
#[cfg(target_arch = "wasm32")]
{
let app = App::new(&event_loop);
event_loop.spawn_app(app);
}

Ok(())
}
Expand Down
17 changes: 12 additions & 5 deletions code/beginner/tutorial6-uniforms/src/challenge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ use winit::{

#[cfg(target_arch = "wasm32")]
use wasm_bindgen::prelude::*;
#[cfg(target_arch = "wasm32")]
use winit::platform::web::EventLoopExtWebSys;

mod texture;

Expand Down Expand Up @@ -693,11 +695,16 @@ pub fn run() -> anyhow::Result<()> {
}

let event_loop = EventLoop::with_user_event().build()?;
let mut app = App::new(
#[cfg(target_arch = "wasm32")]
&event_loop,
);
event_loop.run_app(&mut app)?;
#[cfg(not(target_arch = "wasm32"))]
{
let mut app = App::new();
event_loop.run_app(&mut app)?;
}
#[cfg(target_arch = "wasm32")]
{
let app = App::new(&event_loop);
event_loop.spawn_app(app);
}

Ok(())
}
Expand Down
17 changes: 12 additions & 5 deletions code/beginner/tutorial6-uniforms/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ use winit::{

#[cfg(target_arch = "wasm32")]
use wasm_bindgen::prelude::*;
#[cfg(target_arch = "wasm32")]
use winit::platform::web::EventLoopExtWebSys;

mod texture;

Expand Down Expand Up @@ -686,11 +688,16 @@ pub fn run() -> anyhow::Result<()> {
}

let event_loop = EventLoop::with_user_event().build()?;
let mut app = App::new(
#[cfg(target_arch = "wasm32")]
&event_loop,
);
event_loop.run_app(&mut app)?;
#[cfg(not(target_arch = "wasm32"))]
{
let mut app = App::new();
event_loop.run_app(&mut app)?;
}
#[cfg(target_arch = "wasm32")]
{
let app = App::new(&event_loop);
event_loop.spawn_app(app);
}

Ok(())
}
Expand Down
17 changes: 12 additions & 5 deletions code/beginner/tutorial7-instancing/src/challenge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ use winit::{

#[cfg(target_arch = "wasm32")]
use wasm_bindgen::prelude::*;
#[cfg(target_arch = "wasm32")]
use winit::platform::web::EventLoopExtWebSys;

mod texture;

Expand Down Expand Up @@ -798,11 +800,16 @@ pub fn run() -> anyhow::Result<()> {
}

let event_loop = EventLoop::with_user_event().build()?;
let mut app = App::new(
#[cfg(target_arch = "wasm32")]
&event_loop,
);
event_loop.run_app(&mut app)?;
#[cfg(not(target_arch = "wasm32"))]
{
let mut app = App::new();
event_loop.run_app(&mut app)?;
}
#[cfg(target_arch = "wasm32")]
{
let app = App::new(&event_loop);
event_loop.spawn_app(app);
}

Ok(())
}
Expand Down
Loading
Loading