Skip to content

Commit 055dade

Browse files
committed
Embed Assets folder and use embedded background
1 parent 6698b26 commit 055dade

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

src/embed.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ struct Static;
1717
#[folder = "embed/config"]
1818
struct Config;
1919

20+
#[derive(RustEmbed)]
21+
#[folder = "assets"]
22+
pub struct Assets;
23+
2024
pub fn unload_files() {
2125
//Create templates folder in data path if not already exists
2226
let mut templates_path = CONFIG.data_path.clone();

src/player.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use image::GenericImage;
55
use karaoke::{
66
channel::{LiveCommand, PlayerCommand, LIVE_CHANNEL, PLAYER_CHANNEL},
77
collection::Kfile,
8+
embed::Assets,
89
queue::PLAY_QUEUE,
910
};
1011
use rodio::{Sink, Source};
@@ -69,7 +70,7 @@ impl Player {
6970

7071
//Load background image into Texture2d
7172
let image = image::load(
72-
Cursor::new(&include_bytes!("../assets/background.png")[..]),
73+
Cursor::new(&Assets::get("background.png").unwrap()[..]),
7374
image::PNG,
7475
)
7576
.unwrap()

0 commit comments

Comments
 (0)