├── .github
├── FUNDING.yml
└── workflows
│ └── ci.yml
├── .gitignore
├── .idea
└── workspace.xml
├── Cargo.toml
├── LICENSE-APACHE
├── LICENSE-MIT
├── README.md
├── assets
├── FiraMono-LICENSE.txt
├── FiraSans-Bold.ttf
└── bevy_logo.png
├── clippy.toml
├── default.nix
├── examples
├── custom_skip.rs
├── layouts.rs
├── screens.rs
└── simple.rs
├── flake.lock
├── flake.nix
├── release.toml
├── rust-toolchain.toml
├── rustfmt.toml
└── src
├── lens.rs
├── lib.rs
├── splash.rs
└── systems.rs
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: [ SergioRibera ]
4 |
--------------------------------------------------------------------------------
/.github/workflows/ci.yml:
--------------------------------------------------------------------------------
1 | name: CI
2 |
3 | on:
4 | pull_request:
5 | branches:
6 | - main
7 | - dev
8 | push:
9 | branches:
10 | - main
11 | paths-ignore:
12 | - "Makefile.toml"
13 | - "README.md"
14 | - "release.toml"
15 | - "examples/**"
16 |
17 | jobs:
18 | # Run cargo clippy -- -D warnings
19 | clippy_check:
20 | name: Clippy
21 | runs-on: ubuntu-latest
22 | steps:
23 | - name: Checkout sources
24 | uses: actions/checkout@v3
25 | - uses: Swatinem/rust-cache@v2
26 | - uses: dsherret/rust-toolchain-file@v1
27 | - name: Install Dependencies
28 | run: sudo apt-get update; sudo apt-get install pkg-config libx11-dev libasound2-dev libudev-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev
29 | - name: Run clippy
30 | uses: actions-rs/cargo@v1.0.1
31 | with:
32 | args: -- -D warnings
33 | command: clippy
34 |
35 | # Run cargo fmt --all -- --check
36 | format:
37 | name: Format
38 | runs-on: ubuntu-latest
39 | steps:
40 | - name: Checkout sources
41 | uses: actions/checkout@v3
42 | - uses: dsherret/rust-toolchain-file@v1
43 | - name: Run cargo fmt
44 | uses: actions-rs/cargo@v1.0.1
45 | with:
46 | args: --all -- --check
47 | command: fmt
48 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 | /Cargo.lock
3 |
--------------------------------------------------------------------------------
/.idea/workspace.xml:
--------------------------------------------------------------------------------
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 | "customColor": "",
34 | "associatedIndex": 6
35 | }
36 |
37 |
38 |
39 |
40 |
41 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 | 1746830868561
144 |
145 |
146 | 1746830868561
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
--------------------------------------------------------------------------------
/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "bevy_splash_screen"
3 | description = "A plugin for bevy which allows you to create screens to show the brands and development teams behind your amazing game"
4 | version = "0.7.0"
5 | edition = "2021"
6 | license = "MIT OR Apache-2.0"
7 | repository = "https://github.com/SergioRibera/bevy_splash_screen"
8 | keywords = ["gamedev", "ui", "bevy"]
9 |
10 | [workspace]
11 | resolver = "2"
12 |
13 | [profile.dev]
14 | opt-level = 0
15 |
16 | [profile.dev.package."*"]
17 | opt-level = 3
18 |
19 | [dev-dependencies]
20 | bevy = { version = "0.16.0", default-features = false, features = [
21 | "multi_threaded",
22 | "bevy_asset",
23 | "bevy_winit",
24 | "bevy_render",
25 | "bevy_sprite",
26 | "bevy_state",
27 | "png",
28 | ] }
29 |
30 | [features]
31 | default = []
32 | dev = [
33 | "bevy/bevy_asset",
34 | "bevy/bevy_scene",
35 | "bevy/bevy_winit",
36 | "bevy/bevy_core_pipeline",
37 | "bevy/bevy_render",
38 | "bevy/bevy_sprite",
39 | "bevy/bevy_state",
40 | "bevy/bevy_text",
41 | "bevy/bevy_ui",
42 | "bevy/multi_threaded",
43 | "bevy/png",
44 | "bevy/ktx2",
45 | "bevy/x11",
46 | "bevy/bevy_gizmos",
47 | "bevy/default_font",
48 | ]
49 |
50 | [[example]]
51 | name = "custom_skip"
52 | required-features = ["dev"]
53 | path = "./examples/custom_skip.rs"
54 |
55 | [[example]]
56 | name = "layouts"
57 | required-features = ["dev"]
58 | path = "./examples/layouts.rs"
59 |
60 | [[example]]
61 | name = "screens"
62 | required-features = ["dev"]
63 | path = "./examples/screens.rs"
64 |
65 | [[example]]
66 | name = "simple"
67 | required-features = ["dev"]
68 | path = "./examples/simple.rs"
69 |
70 | [dependencies]
71 | bevy = { version = "0.16.0", default-features = false , features = [
72 | "bevy_state",
73 | ] }
74 | bevy_math = "0.16.0"
75 | bevy_tweening = "0.13.0"
76 |
77 | [patch.crates-io]
78 | bevy_tweening = { git = "https://github.com/Rezan7CC/bevy_tweening", branch = "main" }
79 |
--------------------------------------------------------------------------------
/LICENSE-APACHE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
--------------------------------------------------------------------------------
/LICENSE-MIT:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in all
11 | copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | SOFTWARE.
20 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Bevy Splash Screen
2 | 
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | # Versions
11 | Aviable and compatible versions
12 |
13 | | bevy | SplashScreen |
14 | |--------|--------------|
15 | | 0.16 | 0.8.0 |
16 | | 0.15 | 0.7.0 |
17 | | 0.13 | 0.6.0 |
18 | | 0.12 | 0.5.0 |
19 | | 0.11 | 0.4.4 |
20 | | 0.10.1 | 0.3.0 |
21 |
22 | # Features
23 | - Suport multiple screens (Multiple brands on sequencial screens)
24 | - Multiple brands (images/text)
25 | - Animated color
26 | - Custom Skipable Method (Using Event)
27 | - Background Color for each screen
28 | - Manage workflow of splash scrreen with States
29 |
30 | # Usage
31 | Check out the [examples](./examples) for details.
32 |
33 | Add to Cargo.toml
34 | ```toml
35 | [dependencies]
36 | bevy = "0.12"
37 | bevy_splash_screen = "0.6.0"
38 | ```
39 |
40 | > **WARN:** You probably need to add this if you also use `bevy_tweening`
41 | > ```
42 | > [patch.crates-io]
43 | > bevy_tweening = { git = "https://github.com/SergioRibera/bevy_tweening", branch = "infinite_mirrored" }
44 | > ```
45 |
46 | # TODOs
47 | Open for contributions =D
48 |
49 | - [ ] Logic for static brands (persistent on all screen brands) :(
50 | - [ ] Tween more customizable (transform, scale, etc)
51 |
--------------------------------------------------------------------------------
/assets/FiraMono-LICENSE.txt:
--------------------------------------------------------------------------------
1 | Digitized data copyright (c) 2012-2015, The Mozilla Foundation and Telefonica S.A.
2 |
3 | This Font Software is licensed under the SIL Open Font License, Version 1.1.
4 | This license is copied below, and is also available with a FAQ at:
5 | http://scripts.sil.org/OFL
6 |
7 |
8 | -----------------------------------------------------------
9 | SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10 | -----------------------------------------------------------
11 |
12 | PREAMBLE
13 | The goals of the Open Font License (OFL) are to stimulate worldwide
14 | development of collaborative font projects, to support the font creation
15 | efforts of academic and linguistic communities, and to provide a free and
16 | open framework in which fonts may be shared and improved in partnership
17 | with others.
18 |
19 | The OFL allows the licensed fonts to be used, studied, modified and
20 | redistributed freely as long as they are not sold by themselves. The
21 | fonts, including any derivative works, can be bundled, embedded,
22 | redistributed and/or sold with any software provided that any reserved
23 | names are not used by derivative works. The fonts and derivatives,
24 | however, cannot be released under any other type of license. The
25 | requirement for fonts to remain under this license does not apply
26 | to any document created using the fonts or their derivatives.
27 |
28 | DEFINITIONS
29 | "Font Software" refers to the set of files released by the Copyright
30 | Holder(s) under this license and clearly marked as such. This may
31 | include source files, build scripts and documentation.
32 |
33 | "Reserved Font Name" refers to any names specified as such after the
34 | copyright statement(s).
35 |
36 | "Original Version" refers to the collection of Font Software components as
37 | distributed by the Copyright Holder(s).
38 |
39 | "Modified Version" refers to any derivative made by adding to, deleting,
40 | or substituting -- in part or in whole -- any of the components of the
41 | Original Version, by changing formats or by porting the Font Software to a
42 | new environment.
43 |
44 | "Author" refers to any designer, engineer, programmer, technical
45 | writer or other person who contributed to the Font Software.
46 |
47 | PERMISSION & CONDITIONS
48 | Permission is hereby granted, free of charge, to any person obtaining
49 | a copy of the Font Software, to use, study, copy, merge, embed, modify,
50 | redistribute, and sell modified and unmodified copies of the Font
51 | Software, subject to the following conditions:
52 |
53 | 1) Neither the Font Software nor any of its individual components,
54 | in Original or Modified Versions, may be sold by itself.
55 |
56 | 2) Original or Modified Versions of the Font Software may be bundled,
57 | redistributed and/or sold with any software, provided that each copy
58 | contains the above copyright notice and this license. These can be
59 | included either as stand-alone text files, human-readable headers or
60 | in the appropriate machine-readable metadata fields within text or
61 | binary files as long as those fields can be easily viewed by the user.
62 |
63 | 3) No Modified Version of the Font Software may use the Reserved Font
64 | Name(s) unless explicit written permission is granted by the corresponding
65 | Copyright Holder. This restriction only applies to the primary font name as
66 | presented to the users.
67 |
68 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69 | Software shall not be used to promote, endorse or advertise any
70 | Modified Version, except to acknowledge the contribution(s) of the
71 | Copyright Holder(s) and the Author(s) or with their explicit written
72 | permission.
73 |
74 | 5) The Font Software, modified or unmodified, in part or in whole,
75 | must be distributed entirely under this license, and must not be
76 | distributed under any other license. The requirement for fonts to
77 | remain under this license does not apply to any document created
78 | using the Font Software.
79 |
80 | TERMINATION
81 | This license becomes null and void if any of the above conditions are
82 | not met.
83 |
84 | DISCLAIMER
85 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93 | OTHER DEALINGS IN THE FONT SOFTWARE.
94 |
--------------------------------------------------------------------------------
/assets/FiraSans-Bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SergioRibera/bevy_splash_screen/4b2a7cd8d084fb850390c45ab7e37b537c7d91f0/assets/FiraSans-Bold.ttf
--------------------------------------------------------------------------------
/assets/bevy_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SergioRibera/bevy_splash_screen/4b2a7cd8d084fb850390c45ab7e37b537c7d91f0/assets/bevy_logo.png
--------------------------------------------------------------------------------
/clippy.toml:
--------------------------------------------------------------------------------
1 | too-many-arguments-threshold = 100
2 |
--------------------------------------------------------------------------------
/default.nix:
--------------------------------------------------------------------------------
1 | {
2 | system ? builtins.currentSystem,
3 | pkgs,
4 | lib ? pkgs.lib,
5 | crane,
6 | fenix,
7 | flake-utils,
8 | stdenv ? pkgs.stdenv,
9 | ...
10 | }: let
11 | # fenix: rustup replacement for reproducible builds
12 | toolchain = fenix.${system}.fromToolchainFile {
13 | file = ./rust-toolchain.toml;
14 | sha256 = "sha256-Qxt8XAuaUR2OMdKbN4u8dBJOhSHxS+uS06Wl9+flVEk=";
15 | };
16 | # crane: cargo and artifacts manager
17 | craneLib = crane.overrideToolchain toolchain;
18 |
19 | # buildInputs for Examples
20 | buildInputs = with pkgs; [
21 | stdenv.cc.cc.lib
22 | alsa-lib
23 | udev
24 | libxkbcommon
25 | libxkbcommon.dev
26 | wayland
27 | wayland-protocols
28 | xorg.libX11
29 | xorg.libXcursor
30 | xorg.libXrandr
31 | xorg.libXi
32 | vulkan-loader
33 | ];
34 |
35 | # Base args, need for build all crate artifacts and caching this for late builds
36 | deps = {
37 | nativeBuildInputs = with pkgs;
38 | [
39 | pkg-config
40 | autoPatchelfHook
41 | ]
42 | ++ lib.optionals stdenv.buildPlatform.isDarwin [
43 | libiconv
44 | ]
45 | ++ lib.optionals stdenv.buildPlatform.isLinux [
46 | libxkbcommon.dev
47 | ];
48 | runtimeDependencies = with pkgs;
49 | lib.optionals stdenv.isLinux [
50 | wayland
51 | libGL
52 | libxkbcommon
53 | ];
54 | inherit buildInputs;
55 | };
56 |
57 | # Lambda for build packages with cached artifacts
58 | commonArgs = targetName:
59 | deps
60 | // {
61 | src = lib.cleanSourceWith {
62 | src = craneLib.path ./.;
63 | filter = craneLib.filterCargoSources;
64 | };
65 | doCheck = false;
66 | CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER = "${stdenv.cc.targetPrefix}cc";
67 | CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUNNER = "qemu-aarch64";
68 | HOST_CC = "${stdenv.cc.nativePrefix}cc";
69 | pname = targetName;
70 | cargoExtraArgs = "-F dev --example ${targetName}";
71 | };
72 | bundleApp = targetName: flake-utils.lib.mkApp {
73 | drv = craneLib.buildPackage ((commonArgs targetName) // {
74 | cargoArtifacts = craneLib.buildDepsOnly (commonArgs targetName);
75 | });
76 | };
77 | customSkipApp = bundleApp "custom_skip";
78 | layoutsApp = bundleApp "layouts";
79 | screensApp = bundleApp "screens";
80 | simpleApp = bundleApp "simple";
81 | in {
82 | # `nix run`
83 | apps = rec {
84 | simple = simpleApp.app;
85 | layouts= layoutsApp.app;
86 | screens = screensApp.app;
87 | customSkip = customSkipApp.app;
88 | default = simple;
89 | };
90 | # `nix develop`
91 | devShells.default = craneLib.devShell {
92 | packages = with pkgs;
93 | [
94 | toolchain
95 | pkg-config
96 | cargo-release
97 | ] ++ buildInputs;
98 | LD_LIBRARY_PATH = lib.makeLibraryPath buildInputs;
99 | };
100 | }
101 |
--------------------------------------------------------------------------------
/examples/custom_skip.rs:
--------------------------------------------------------------------------------
1 | use std::time::Duration;
2 |
3 | use bevy::prelude::*;
4 | use bevy_splash_screen::{
5 | ClearSplash, SplashAssetType, SplashItem, SplashPlugin, SplashScreen, SplashScreenSkipEvent,
6 | SplashText, SplashTextColorLens, SplashTextSection,
7 | };
8 | use bevy_tweening::*;
9 |
10 | #[derive(Clone, Copy, Debug, Default, States, Hash, PartialEq, Eq)]
11 | enum ScreenStates {
12 | #[default]
13 | Splash,
14 | Menu,
15 | }
16 |
17 | fn main() {
18 | App::new()
19 | .add_plugins(DefaultPlugins)
20 | .init_state::()
21 | .add_plugins(
22 | SplashPlugin::new(ScreenStates::Splash, ScreenStates::Menu)
23 | .ignore_default_events()
24 | .skipable()
25 | .add_screen(SplashScreen {
26 | brands: vec![SplashItem {
27 | asset: SplashAssetType::SingleText(SplashText {
28 | sections: vec![
29 | SplashTextSection {
30 | text: "Sergio Ribera\n".into(),
31 | text_font: "FiraSans-Bold.ttf".to_string(),
32 | text_size: 76.,
33 | text_color: Color::WHITE.into(),
34 | },
35 | SplashTextSection {
36 | text: "presents\n".into(),
37 | text_font: "FiraSans-Bold.ttf".to_string(),
38 | text_size: 38.,
39 | text_color: Color::WHITE.with_alpha(0.75).into(),
40 | },
41 | ],
42 | text_alignment: JustifyText::Center,
43 | }),
44 | tint: Color::WHITE,
45 | width: Val::Percent(40.),
46 | height: Val::Px(80.),
47 | ease_function: EaseFunction::QuarticInOut.into(),
48 | duration: Duration::from_secs(5),
49 | is_static: false,
50 | }],
51 | background_color: BackgroundColor(Color::BLACK),
52 | ..default()
53 | })
54 | .add_screen(SplashScreen {
55 | brands: vec![SplashItem {
56 | asset: SplashAssetType::SingleText(SplashText {
57 | sections: vec![SplashTextSection {
58 | text: "Custom Skip\n".into(),
59 | text_font: "FiraSans-Bold.ttf".to_string(),
60 | text_size: 75.,
61 | text_color: Color::WHITE.into(),
62 | }],
63 | text_alignment: JustifyText::Center,
64 | }),
65 | tint: Color::WHITE,
66 | width: Val::Percent(35.),
67 | height: Val::Px(160.),
68 | ease_function: EaseFunction::QuarticInOut.into(),
69 | duration: Duration::from_secs(5),
70 | is_static: false,
71 | }],
72 | background_color: BackgroundColor(Color::BLACK),
73 | ..default()
74 | }),
75 | )
76 | .add_systems(Startup, create_scene)
77 | .add_systems(Update, button_system)
78 | .run();
79 | }
80 |
81 | fn create_scene(mut cmd: Commands, assets: ResMut) {
82 | cmd.spawn(Camera2d::default());
83 |
84 | cmd.spawn(Node {
85 | display: Display::Flex,
86 | position_type: PositionType::Absolute,
87 | align_items: AlignItems::FlexEnd,
88 | align_content: AlignContent::Center,
89 | justify_content: JustifyContent::Center,
90 | width: Val::Percent(100.),
91 | height: Val::Percent(100.),
92 | overflow: Overflow::clip(),
93 | ..default()
94 | })
95 | .insert(ClearSplash)
96 | .with_children(|cmd| {
97 | cmd.spawn((
98 | Button::default(),
99 | Node {
100 | height: Val::Px(65.0),
101 | justify_content: JustifyContent::Center,
102 | align_items: AlignItems::Center,
103 | ..default()
104 | },
105 | BackgroundColor(Color::WHITE.with_alpha(0.)),
106 | ))
107 | .with_children(|cmd| {
108 | cmd.spawn((
109 | Text("Press Any Key or Touch screen for skip".into()),
110 | TextFont {
111 | font: assets.load("FiraSans-Bold.ttf"),
112 | font_size: 50.,
113 | ..default()
114 | },
115 | Animator::new(
116 | Tween::new(
117 | EaseFunction::QuadraticInOut,
118 | Duration::from_secs(3),
119 | SplashTextColorLens::new(Color::WHITE),
120 | )
121 | .with_repeat_count(RepeatCount::Infinite)
122 | .with_repeat_strategy(RepeatStrategy::MirroredRepeat),
123 | ),
124 | ));
125 | });
126 | });
127 | }
128 |
129 | fn button_system(
130 | mut interaction_query: Query<&Interaction, (Changed, With