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

Add more default types #47

Merged
merged 4 commits into from
Dec 29, 2018
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Create and destroy entities at runtime. Thanks to [mh84]! ([#40])
* `sync_components`, `read_components`, `sync_resources`, and `read_resources`
macros have been added for registering many components/resources at once. ([#43])
* `sync_default_types` now registers `FlyControlTag`, `HideCursor`, `WindowFocus`, `UiText`, `UiButton`, `UiTransform`, `CameraOrtho`, `DestroyAtTime`, `DestroyInTime`, `MouseReactive`, and `Named`. ([#47])

### Removed

Expand Down Expand Up @@ -87,6 +88,7 @@ EditorLogger::new(&editor_sync_bundle).start();
[#40]: https://github.com/amethyst/amethyst-editor-sync/pull/40
[#43]: https://github.com/amethyst/amethyst-editor-sync/pull/43
[#46]: https://github.com/amethyst/amethyst-editor-sync/pull/46
[#47]: https://github.com/amethyst/amethyst-editor-sync/pull/47
[tap]: https://crates.io/crates/tap
[mh84]: https://github.com/mh84

Expand Down
34 changes: 28 additions & 6 deletions src/bundle.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use crate::systems::*;
use crate::types::IncomingComponent;
use crate::types::*;
use amethyst::core::{Result as BundleResult, SystemBundle};
use amethyst::ecs::{Component, DispatcherBuilder};
use amethyst::shred::Resource;
Expand All @@ -9,8 +11,6 @@ use std::collections::HashMap;
use std::marker::PhantomData;
use std::net::UdpSocket;
use std::time::Duration;
use crate::systems::*;
use crate::types::*;

/// Bundles all necessary systems for serializing all registered components and resources and
/// sending them to the editor.
Expand Down Expand Up @@ -114,11 +114,33 @@ impl SyncEditorBundle {
///
/// Currently only a small set is supported. This will be expanded in the future.
pub fn sync_default_types(&mut self) {
use amethyst::core::{GlobalTransform, Transform};
use amethyst::renderer::{AmbientColor, Camera, Light};
use amethyst::{
controls::{FlyControlTag, HideCursor, WindowFocus},
core::{GlobalTransform, Named, Transform},
renderer::{AmbientColor, Camera, Light},
ui::{MouseReactive, UiButton, UiText, UiTransform},
utils::ortho_camera::CameraOrtho,
utils::time_destroy::{DestroyAtTime, DestroyInTime},
};

sync_components!(self, Light, Camera, Transform, GlobalTransform);
sync_resources!(self, AmbientColor);
sync_components!(
self,
Camera,
CameraOrtho,
DestroyAtTime,
DestroyInTime,
FlyControlTag,
GlobalTransform,
Light,
MouseReactive,
Named,
Transform,
UiButton,
UiTransform,
);
read_components!(self, UiText);
sync_resources!(self, AmbientColor, HideCursor);
read_resources!(self, WindowFocus);
}

/// Register a component for synchronizing with the editor. This will result in a
Expand Down
4 changes: 4 additions & 0 deletions tests/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ fn large_world() -> amethyst::Result<()> {
run_world(10_000)
}

// NOTE: This is ignored for now because it's super slow and sometimes fails on
// Windows. We absolutely need to be able to run on worlds with more than
// 100,000 entities, so we'll need to revisit this as an optimization pass.
#[test]
#[ignore]
fn huge_world() -> amethyst::Result<()> {
run_world(100_000)
}