Skip to content
Snippets Groups Projects
Unverified Commit ee23f767 authored by milse113's avatar milse113 Committed by GitHub
Browse files

Basic multi-camera support (#86)

parent 927ebb38
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,9 @@ keywords = ["bevy"]
exclude = ["assets/*"]
[features]
multicam = []
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
# Enable max optimizations for dependencies, but not for our code:
......
......@@ -2,6 +2,9 @@ use bevy::{input::mouse::MouseMotion, prelude::*, window::PrimaryWindow};
use crate::{CosmicEditor, CosmicTextChanged};
#[cfg(feature = "multicam")]
use crate::CosmicPrimaryCamera;
/// For use with custom cursor control; Event is emitted when cursor enters a text widget
#[derive(Event)]
pub struct TextHoverIn;
......@@ -33,10 +36,17 @@ pub fn change_cursor(
}
}
#[cfg(feature = "multicam")]
type CameraQuery<'a, 'b, 'c, 'd> =
Query<'a, 'b, (&'c Camera, &'d GlobalTransform), With<CosmicPrimaryCamera>>;
#[cfg(not(feature = "multicam"))]
type CameraQuery<'a, 'b, 'c, 'd> = Query<'a, 'b, (&'c Camera, &'d GlobalTransform)>;
pub fn hover_sprites(
windows: Query<&Window, With<PrimaryWindow>>,
mut cosmic_edit_query: Query<(&mut Sprite, &GlobalTransform), With<CosmicEditor>>,
camera_q: Query<(&Camera, &GlobalTransform)>,
camera_q: CameraQuery,
mut hovered: Local<bool>,
mut last_hovered: Local<bool>,
mut evw_hover_in: EventWriter<TextHoverIn>,
......
......@@ -26,6 +26,10 @@ use render::{
on_scale_factor_change, CursorBlinkTimer, CursorVisibility, SwashCacheState,
};
#[cfg(feature = "multicam")]
#[derive(Component)]
pub struct CosmicPrimaryCamera;
#[derive(Clone, Component, PartialEq, Debug)]
pub enum CosmicText {
OneStyle(String),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment