Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix background image #305

Merged
merged 1 commit into from
Mar 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/screen/background.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,11 @@ impl Screen for Background {
let path = self.vars.get(BACKGROUND_IMAGE);
self.last_path = (*path).clone();
let background =
if Renderer::get_texture_optional(renderer.get_textures_ref(), &format!("#{}", path))
.is_some()
{
if Renderer::get_texture_optional(renderer.get_textures_ref(), &path).is_some() {
Some(
ui::ImageBuilder::new()
.draw_index(i16::MIN as isize)
.texture(&*format!("#{}", self.vars.get(BACKGROUND_IMAGE)))
.texture(path.as_str())
.size(
renderer.screen_data.read().safe_width as f64,
renderer.screen_data.read().safe_height as f64,
Expand Down
2 changes: 1 addition & 1 deletion src/screen/launcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ impl super::Screen for Launcher {
.pick_file();
if let Some(files) = files {
let file_name = files.as_path().to_str().unwrap();
game.vars.set(BACKGROUND_IMAGE, file_name.to_string());
game.vars.set(BACKGROUND_IMAGE, format!("#{}", file_name));
}
true
})
Expand Down
Loading