Image
This commit is contained in:
parent
0d5b18f458
commit
d091b6474b
1 changed files with 19 additions and 5 deletions
|
|
@ -1,18 +1,32 @@
|
|||
use bevy::prelude::*;
|
||||
|
||||
#[derive(Resource)]
|
||||
pub struct LofparaAtlas(TextureAtlasLayout);
|
||||
pub struct LofparaAtlasLayout(pub TextureAtlasLayout);
|
||||
|
||||
#[derive(Resource)]
|
||||
pub struct LofparaAtlasImage(Handle<Image>);
|
||||
|
||||
impl LofparaAtlasImage {
|
||||
pub fn get(&self) -> Handle<Image> {
|
||||
return self.0.clone();
|
||||
}
|
||||
}
|
||||
|
||||
pub struct LofparaAtlasPlugin;
|
||||
|
||||
impl Plugin for LofparaAtlasPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
let mut atlas = TextureAtlasLayout::new_empty(UVec2::new(1920, 1080));
|
||||
let mut atlas_layout = TextureAtlasLayout::new_empty(UVec2::new(1920, 1080));
|
||||
//Card, index = 0
|
||||
atlas.add_texture(URect::new(0, 0, 258, 363));
|
||||
atlas_layout.add_texture(URect::new(0, 0, 258, 363));
|
||||
//Cardholder, index = 1
|
||||
atlas.add_texture(URect::new(259, 0, 166, 166));
|
||||
atlas_layout.add_texture(URect::new(259, 0, 166, 166));
|
||||
|
||||
app.insert_resource(LofparaAtlas(atlas));
|
||||
app.insert_resource(LofparaAtlasLayout(atlas_layout))
|
||||
.add_systems(Startup, startup_image);
|
||||
}
|
||||
}
|
||||
|
||||
fn startup_image(mut commands: Commands, asset_server: Res<AssetServer>) {
|
||||
commands.insert_resource(LofparaAtlasImage(asset_server.load("atlas.png")));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue