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

86 application window #88

Merged
merged 9 commits into from
Apr 4, 2023
Merged

86 application window #88

merged 9 commits into from
Apr 4, 2023

Conversation

martinjonsson01
Copy link
Owner

Enables rendering of an application window alongside the ECS running in the background. Part of this meant we had to generalize how plugins are added to the ECS engine.

Note: this is a sub-task of #61.

The window is currently completely empty, as rendering of contents will be implemented in #87.
image

The new way of adding a plugin is:

// Define a trait which describes a property which the application can have:
pub trait Audible {
    fn with_audio(self) -> AudioResult<()>;
}

// Implement the trait for all types of application:
impl<App: Application> Audible for App {
...
}

(see gfx-plugin\lib.rs for a real example of this)

and now this plugin can be enabled by calling:

let mut app = BasicApplication::default().with_audio()?;

Closes #86

martinjonsson01 and others added 5 commits April 2, 2023 09:25
This will make it easier to implement plugins and decorators
that modify application behavior.
instead of Fn-traits, since they are easier to work with.

Since closures have unique types, and function items are also special,
they're not very easy to work with.
Currently the ECS doesn't run, only the window.
We should avoid automatic error conversions, so it's more clear.
@github-actions
Copy link

github-actions bot commented Apr 3, 2023

Benchmark for d49a9fc

Click to view benchmark
Test Base PR %
sleep 161.3±3.94µs 162.2±7.53µs +0.56%
sleep x/1 60.3±1.71µs 16.2 KElem/sec N/A N/A
sleep x/2 62.4±4.36µs 31.3 KElem/sec N/A N/A
sleep x/3 64.5±3.14µs 45.4 KElem/sec N/A N/A
sleep x/4 62.8±1.59µs 62.2 KElem/sec N/A N/A
sleep x/5 64.0±1.68µs 76.3 KElem/sec N/A N/A
sleep x/6 66.0±4.47µs 88.7 KElem/sec N/A N/A
sleep x/7 66.2±2.43µs 103.3 KElem/sec N/A N/A
sleep x/8 67.6±2.76µs 115.6 KElem/sec N/A N/A
sleep x/9 68.2±2.18µs 128.8 KElem/sec N/A N/A

Copy link
Collaborator

@EdvinNilsson EdvinNilsson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

crates/gfx-plugin/examples/rendered-ecs.rs Show resolved Hide resolved
crates/gfx-plugin/src/lib.rs Outdated Show resolved Hide resolved
crates/gfx/src/engine.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@JacobBredin JacobBredin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Cool Ideas used 👍

crates/ecs/src/profiling.rs Show resolved Hide resolved
crates/gfx-plugin/src/lib.rs Show resolved Hide resolved
@github-actions
Copy link

github-actions bot commented Apr 4, 2023

Benchmark for 76caa33

Click to view benchmark
Test Base PR %
sleep 166.6±11.10µs 164.6±5.16µs -1.20%
sleep x/1 75.4±75.13µs 13.0 KElem/sec N/A N/A
sleep x/2 63.4±3.78µs 30.8 KElem/sec N/A N/A
sleep x/3 66.0±5.39µs 44.4 KElem/sec N/A N/A
sleep x/4 69.2±25.57µs 56.4 KElem/sec N/A N/A
sleep x/5 67.6±3.94µs 72.2 KElem/sec N/A N/A
sleep x/6 69.1±4.66µs 84.8 KElem/sec N/A N/A
sleep x/7 69.9±6.43µs 97.8 KElem/sec N/A N/A
sleep x/8 70.5±2.88µs 110.8 KElem/sec N/A N/A
sleep x/9 71.9±2.62µs 122.2 KElem/sec N/A N/A

@github-actions
Copy link

github-actions bot commented Apr 4, 2023

Benchmark for c21f5cc

Click to view benchmark
Test Base PR %
sleep 165.1±6.78µs 166.1±4.01µs +0.61%
sleep x/1 63.2±3.81µs 15.5 KElem/sec N/A N/A
sleep x/2 63.7±3.12µs 30.7 KElem/sec N/A N/A
sleep x/3 65.7±4.68µs 44.6 KElem/sec N/A N/A
sleep x/4 66.8±3.15µs 58.5 KElem/sec N/A N/A
sleep x/5 68.5±6.83µs 71.3 KElem/sec N/A N/A
sleep x/6 69.3±4.51µs 84.6 KElem/sec N/A N/A
sleep x/7 70.1±3.94µs 97.6 KElem/sec N/A N/A
sleep x/8 70.6±2.69µs 110.7 KElem/sec N/A N/A
sleep x/9 72.1±4.80µs 121.9 KElem/sec N/A N/A

@github-actions
Copy link

github-actions bot commented Apr 4, 2023

Benchmark for a6c1767

Click to view benchmark
Test Base PR %
sleep 169.0±10.59µs 169.6±9.00µs +0.36%
sleep x/1 64.7±3.14µs 15.1 KElem/sec N/A N/A
sleep x/2 67.3±6.43µs 29.0 KElem/sec N/A N/A
sleep x/3 69.5±4.42µs 42.1 KElem/sec N/A N/A
sleep x/4 69.2±3.75µs 56.5 KElem/sec N/A N/A
sleep x/5 71.5±4.49µs 68.3 KElem/sec N/A N/A
sleep x/6 70.9±6.48µs 82.7 KElem/sec N/A N/A
sleep x/7 73.7±5.15µs 92.7 KElem/sec N/A N/A
sleep x/8 74.2±4.38µs 105.3 KElem/sec N/A N/A
sleep x/9 74.3±4.37µs 118.3 KElem/sec N/A N/A

@martinjonsson01 martinjonsson01 merged commit c7fa9a1 into master Apr 4, 2023
@martinjonsson01 martinjonsson01 deleted the 86-application-window branch April 4, 2023 14:48
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

Successfully merging this pull request may close these issues.

Application window
3 participants