Skip to content

Commit

Permalink
Update loop
Browse files Browse the repository at this point in the history
  • Loading branch information
nanoqsh committed Nov 16, 2023
1 parent 7e1cc8c commit f5d19a8
Show file tree
Hide file tree
Showing 10 changed files with 239 additions and 256 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ members = [
"examples/cube",
"examples/scene",
"examples/scene_android",
"examples/scene_wasm",
# "examples/scene_wasm",
"examples/triangle",
]
default-members = ["dunge"]
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ Then, let's create a new window to draw something in it:
```rust,ignore
use dunge::{CanvasConfig, InitialState};
fn main() -> ! {
fn main() {
dunge::make_window(InitialState::default())
.run_blocking(CanvasConfig::default(), App::new)
.into_panic()
.expect("loop error");
}
```

Expand Down
466 changes: 225 additions & 241 deletions dunge/src/canvas.rs

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dunge/src/shader_data/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub struct ModelTransform(Mat);

impl ModelTransform {
pub(crate) const LAYOUT_ATTRIBUTES_LEN: u32 = Self::LAYOUT.attributes.len() as u32;
pub(crate) const LAYOUT: VertexBufferLayout<'_> = {
pub(crate) const LAYOUT: VertexBufferLayout<'static> = {
use std::mem;

VertexBufferLayout {
Expand Down Expand Up @@ -68,7 +68,7 @@ pub struct ModelColor([f32; 3]);

impl ModelColor {
pub(crate) const LAYOUT_ATTRIBUTES_LEN: u32 = Self::LAYOUT.attributes.len() as u32;
pub(crate) const LAYOUT: VertexBufferLayout<'_> = {
pub(crate) const LAYOUT: VertexBufferLayout<'static> = {
use std::mem;

VertexBufferLayout {
Expand Down
4 changes: 2 additions & 2 deletions dunge_shader/src/shader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ pub struct Shader {
}

impl Shader {
pub const VERTEX_ENTRY_POINT: &str = "vsmain";
pub const FRAGMENT_ENTRY_POINT: &str = "fsmain";
pub const VERTEX_ENTRY_POINT: &'static str = "vsmain";
pub const FRAGMENT_ENTRY_POINT: &'static str = "fsmain";

#[allow(clippy::missing_panics_doc)]
pub fn generate(scheme: Scheme) -> Self {
Expand Down
4 changes: 2 additions & 2 deletions examples/cube/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
fn main() -> ! {
fn main() {
use {
cube::App,
dunge::{CanvasConfig, InitialState, WindowMode},
Expand All @@ -13,5 +13,5 @@ fn main() -> ! {
..Default::default()
})
.run_blocking(CanvasConfig::default(), App::new)
.into_panic()
.expect("loop error");
}
1 change: 0 additions & 1 deletion examples/scene/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,6 @@ impl Loop for App {
let (w, h) = context.size();
let v = self.view.model((w, h)).into_mat().inverse();

dbg!(x, y);
let x = -x;
let a = match self.projection {
Projection::Perspective => Vec3::ZERO,
Expand Down
4 changes: 2 additions & 2 deletions examples/scene/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
fn main() -> ! {
fn main() {
use {
dunge::{CanvasConfig, InitialState, WindowMode},
scene::App,
Expand All @@ -14,5 +14,5 @@ fn main() -> ! {
..Default::default()
})
.run_blocking(CanvasConfig::default(), App::new)
.into_panic()
.expect("loop error");
}
2 changes: 1 addition & 1 deletion examples/scene_android/android/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ fn android_main(app: AndroidApp) {

dunge::from_app(app)
.run_blocking(CanvasConfig::default(), App::new)
.into_panic();
.expect("loop error");
}
4 changes: 2 additions & 2 deletions examples/triangle/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ impl Shader for TriangleShader {
type Vertex = Vert;
}

fn main() -> ! {
fn main() {
env_logger::init();
dunge::make_window(InitialState {
title: "Triangle",
Expand All @@ -24,7 +24,7 @@ fn main() -> ! {
..Default::default()
})
.run_blocking(CanvasConfig::default(), App::new)
.into_panic()
.expect("loop error");
}

struct App {
Expand Down

0 comments on commit f5d19a8

Please sign in to comment.