Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
use micro_musicbox::prelude::AudioSource;
use std::fmt::Debug;
use std::ops::{Deref, DerefMut};
use std::time::Duration;
use bevy_asset::Handle;
use bevy_ecs::prelude::*;
use bevy_render::prelude::*;
#[derive(Clone, Copy, Debug)]
pub enum SplashStepType {
FadeColour { from: Color, to: Color },
Wait,
}
#[derive(Clone, Copy, Debug)]
pub struct SplashStep {
duration: f32,
step_type: SplashStepType,
}
pub type SplashAnimation = Vec<SplashStep>;
#[derive(Resource)]
pub struct LogoHandle(pub Handle<Image>);
impl Deref for LogoHandle {
type Target = Handle<Image>;
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[derive(Resource)]
pub struct StingHandle(pub Handle<AudioSource>);
impl Deref for StingHandle {
type Target = Handle<AudioSource>;
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[derive(Clone, Debug, Resource, Default)]
pub struct SplashSettings<StateType: States> {
pub run_in: StateType,
pub transition_to: StateType,
pub sting_path: String,
pub logo_path: String,
pub duration: Duration,
pub skip_on_input: bool,
pub bg_color_tween: Option<(Color, Color)>,
pub logo_color_tween: Option<(Color, Color)>,
pub tween_duration: Option<Duration>,
}
#[derive(Clone, Copy, Debug, Component)]
pub struct ScaleToWindow;
#[derive(Default, Resource)]
pub struct TweenClearColor {
pub from: Color,
pub to: Color,
pub progress: Duration,
pub duration: Duration,
}
#[derive(Default, Resource)]
pub struct SplashTime(pub Duration);
impl Deref for SplashTime {
type Target = Duration;
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl DerefMut for SplashTime {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}