Skip to content

Commit

Permalink
Merge pull request #1 from bevyengine/master
Browse files Browse the repository at this point in the history
merge bevyengine/bevy -> ashneverdawn/bevy
  • Loading branch information
ashneverdawn authored Aug 24, 2020
2 parents 7db4821 + 7b6fbcb commit 77fdb0a
Show file tree
Hide file tree
Showing 179 changed files with 1,325 additions and 857 deletions.
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# These are supported funding model platforms

github: cart
23 changes: 22 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,35 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
components: rustfmt, clippy

- name: Install alsa
run: sudo apt-get install libasound2-dev

- name: Build
run: cargo check

- name: Check the format
run: cargo +nightly fmt --all -- --check

# type complexity must be ignored because we use huge templates for queries
- name: Run clippy
run: >
cargo +nightly clippy
--all-targets
--all-features
--
-D warnings
-A clippy::type_complexity
- name: Run tests
run: cargo test --workspace

39 changes: 39 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Code of Conduct

_This Code of Conduct is based on the [Rust Code of Conduct](https://www.rust-lang.org/policies/code-of-conduct), which is adapted from the [Node.js Policy on Trolling](http://blog.izs.me/post/30036893703/policy-on-trolling) and the [Contributor Covenant](https://www.contributor-covenant.org)._

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.

## Our Standards

In this community we strive to go the extra step to look out for each other. Don’t just aim to be technically unimpeachable, try to be your best self. In particular, avoid flirting with offensive or sensitive issues, particularly if they’re off-topic; this all too often leads to unnecessary fights, hurt feelings, and damaged trust; worse, it can drive people away from the community entirely.

And if someone takes issue with something you said or did, resist the urge to be defensive. Just stop doing what it was they complained about and apologize. Even if you feel you were misinterpreted or unfairly accused, chances are good there was something you could’ve communicated better — remember that it’s your responsibility to make your fellow Rustaceans comfortable. Everyone wants to get along and we are all here first and foremost because we want to talk about cool technology. You will find that people will be eager to assume good intent and forgive as long as you earn their trust.

* Please avoid using overtly sexual aliases or other nicknames that might detract from a friendly, safe and welcoming environment for all.
* Please be kind and courteous. There’s no need to be mean or rude.
* Respect that people have differences of opinion and that every design or implementation choice carries a trade-off and numerous costs. There is seldom a right answer.
* Please keep unstructured critique to a minimum. If you have solid ideas you want to experiment with, make a fork and see how it works.
* We will exclude you from interaction if you insult, demean or harass anyone. That is not welcome behavior. We interpret the term “harassment” as including the definition in the [Citizen Code of Conduct](https://github.com/stumpsyn/policies/blob/master/citizen_code_of_conduct.md); if you have any lack of clarity about what might be included in that concept, please read their definition. In particular, we don’t tolerate behavior that excludes people in socially marginalized groups.
* Private harassment is also unacceptable. No matter who you are, if you feel you have been or are being harassed or made uncomfortable by a community member, please contact the maintainers immediately. Whether you’re a regular contributor or a newcomer, we care about making this community a safe place for you and we’ve got your back.
* Do not make casual mention of slavery or indentured servitude and/or false comparisons of one's occupation or situation to slavery. Please consider using or asking about alternate terminology when referring to such metaphors in technology.
* Likewise any spamming, trolling, flaming, baiting or other attention-stealing behavior is not welcome.

## Moderation

These are the policies for upholding [our community’s standards of conduct](#our-standards). If you feel that a thread needs moderation, please contact the maintainers.

1. Remarks that violate the community standards of conduct, including hateful, hurtful, oppressive, or exclusionary remarks, are not allowed. (Cursing is allowed, but never targeting another user, and never in a hateful manner).
2. Remarks that maintainers find inappropriate, whether listed in the code of conduct or not, are also not allowed.
3. Maintainers will first respond to such remarks with a warning.
4. If the warning is unheeded, the user will be “kicked,” i.e., kicked out of the communication channel to cool off.
5. If the user comes back and continues to make trouble, they will be banned, i.e., indefinitely excluded.
6. Maintainers may choose at their discretion to un-ban the user if it was a first offense and they offer the offended party a genuine apology.
7. If a maintainer bans someone and you think it was unjustified, please take it up with that maintainer, or with a different maintainer, in private. Complaints about bans in-channel are not allowed.
8. Maintainers are held to a higher standard than other community members. If a maintainer creates an inappropriate situation, they should expect less leeway than others.

The enforcement policies in the code of conduct apply to all official venues, including Discord channels, GitHub repositories, the Twitter community and all other forums.
10 changes: 8 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bevy"
version = "0.1.2"
version = "0.1.3"
edition = "2018"
authors = ["Bevy Contributors <[email protected]>", "Carter Anderson <[email protected]>"]
description = "A refreshingly simple data-driven game engine and app framework"
Expand All @@ -27,6 +27,8 @@ flac = ["bevy_audio/flac"]
wav = ["bevy_audio/wav"]
vorbis = ["bevy_audio/vorbis"]

serialize = ["bevy_input/serialize"]

[workspace]
members = [
"crates/*",
Expand Down Expand Up @@ -123,6 +125,10 @@ path = "examples/app/headless.rs"
name = "plugin"
path = "examples/app/plugin.rs"

[[example]]
name = "return_after_run"
path = "examples/app/return_after_run.rs"

[[example]]
name = "thread_pool_resources"
path = "examples/app/thread_pool_resources.rs"
Expand Down Expand Up @@ -221,4 +227,4 @@ path = "examples/window/multiple_windows.rs"

[[example]]
name = "window_settings"
path = "examples/window/window_settings.rs"
path = "examples/window/window_settings.rs"
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,19 @@ Bevy is still in the _very_ early stages of development. APIs can and will chang
* **[Bevy Rust API Docs](https://docs.rs/bevy):** Bevy's Rust API docs, which are automatically generated from the doc comments in this repo.

## Community
* **[Discord Server](https://discord.gg/gMUk5Ph):** Bevy's official discord server.
Before contributing or participating in discussions with the community, you should familiarize yourself with our **[Code of Conduct](https://github.com/bevyengine/bevy/blob/master/CODE_OF_CONDUCT.md)**

* **[Discord](https://discord.gg/gMUk5Ph):** Bevy's official discord server.
* **[Reddit](https://reddit.com/r/bevy):** Bevy's official subreddit.
* **[Stack Overflow](https://stackoverflow.com/questions/tagged/bevy):** Questions tagged Bevy on Stack Overflow.
* **[Awesome Bevy](https://github.com/bevyengine/awesome-bevy):** A collection of awesome Bevy projects.

## Getting Started

We recommend checking out [The Bevy Book](https://bevyengine.org/learn/book/introduction) for a full tutorial. You can quickly try out the [examples](/examples) by cloning this repo and running the following command:
We recommend checking out [The Bevy Book](https://bevyengine.org/learn/book/introduction) for a full tutorial.

Follow the [Setup guide](https://bevyengine.org/learn/book/getting-started/setup/) to ensure your development environment is setup correctly.
Once setup, you can quickly try out the [examples](/examples) by cloning this repo and running the following command:

```sh
# Runs the "breakout" example
Expand All @@ -47,6 +55,14 @@ cargo run --example breakout

Bevy can be built just fine using default configuration on stable Rust. However for really fast iterative compiles, you should enable the "fast compiles" setup by [following the instructions here](http://bevyengine.org/learn/book/getting-started/setup/).

## Focus Areas

Bevy has the following [Focus Areas](https://github.com/bevyengine/bevy/labels/focus-area). We are currently focusing our development efforts in these areas and they will receive priority for Bevy developers' time. If you would like to contribute to Bevy, you are heavily encouraged to join in on these efforts:

### [Editor-Ready UI](https://github.com/bevyengine/bevy/issues/254)
### [PBR / Clustered Forward Rendering](https://github.com/bevyengine/bevy/issues/179)
### [Scenes](https://github.com/bevyengine/bevy/issues/255)

## Libraries Used

Bevy is only possible because of the hard work put into these foundational technologies:
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_app/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bevy_app"
version = "0.1.0"
version = "0.1.3"
edition = "2018"
authors = ["Bevy Contributors <[email protected]>", "Carter Anderson <[email protected]>"]
description = "Provides core App functionality for Bevy Engine"
Expand Down
1 change: 1 addition & 0 deletions crates/bevy_app/src/app.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::app_builder::AppBuilder;
use bevy_ecs::{ParallelExecutor, Resources, Schedule, World};

#[allow(clippy::needless_doctest_main)]
/// Containers of app logic and data
///
/// App store the ECS World, Resources, Schedule, and Executor. They also store the "run" function of the App, which
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_app/src/app_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl AppBuilder {
}

pub fn run(&mut self) {
let app = std::mem::replace(&mut self.app, App::default());
let app = std::mem::take(&mut self.app);
app.run();
}

Expand Down Expand Up @@ -209,7 +209,7 @@ impl AppBuilder {
where
R: FromResources + Send + Sync + 'static,
{
let resource = R::from_resources(&mut self.app.resources);
let resource = R::from_resources(&self.app.resources);
self.app.resources.insert(resource);

self
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_app/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ fn map_instance_event<T>(event_instance: &EventInstance<T>) -> &T {
&event_instance.event
}

/// Reads events of type `T` in order and tracks which events have already been read.
/// Reads events of type `T` in order and tracks which events have already been read.
pub struct EventReader<T> {
last_event_count: usize,
_marker: PhantomData<T>,
Expand Down Expand Up @@ -159,7 +159,7 @@ impl<T> EventReader<T> {
events: &'a Events<T>,
predicate: impl FnMut(&&T) -> bool,
) -> Option<&'a T> {
self.iter(events).rev().filter(predicate).next()
self.iter(events).rev().find(predicate)
}

/// Retrieves the earliest event in `events` that this reader hasn't seen yet. This updates the EventReader's
Expand Down
14 changes: 12 additions & 2 deletions crates/bevy_app/src/schedule_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ use crate::{
event::{EventReader, Events},
plugin::Plugin,
};
use std::{thread, time::Duration};
use std::{
thread,
time::{Duration, Instant},
};

/// Determines the method used to run an [App]'s `Schedule`
#[derive(Copy, Clone, Debug)]
Expand Down Expand Up @@ -51,6 +54,8 @@ impl Plugin for ScheduleRunnerPlugin {
app.schedule.run(&mut app.world, &mut app.resources);
}
RunMode::Loop { wait } => loop {
let start_time = Instant::now();

if let Some(app_exit_events) = app.resources.get_mut::<Events<AppExit>>() {
if app_exit_event_reader.latest(&app_exit_events).is_some() {
break;
Expand All @@ -65,8 +70,13 @@ impl Plugin for ScheduleRunnerPlugin {
}
}

let end_time = Instant::now();

if let Some(wait) = wait {
thread::sleep(wait);
let exe_time = end_time - start_time;
if exe_time < wait {
thread::sleep(wait - exe_time);
}
}
},
}
Expand Down
5 changes: 3 additions & 2 deletions crates/bevy_asset/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bevy_asset"
version = "0.1.0"
version = "0.1.3"
edition = "2018"
authors = ["Bevy Contributors <[email protected]>", "Carter Anderson <[email protected]>"]
description = "Provides asset functionality for Bevy Engine"
Expand All @@ -27,4 +27,5 @@ crossbeam-channel = "0.4.2"
anyhow = "1.0"
thiserror = "1.0"
log = { version = "0.4", features = ["release_max_level_info"] }
notify = { version = "5.0.0-pre.2", optional = true }
notify = { version = "5.0.0-pre.2", optional = true }
parking_lot = "0.10.2"
Loading

0 comments on commit 77fdb0a

Please sign in to comment.