use crate::core::MAYLIB;
use sdl2::image::{LoadSurface, LoadTexture};
pub fn set_window_icon(path: &str) {
let mut get = MAYLIB.lock().expect("Should be able to lock");
let current_window = get.current_window;
get.windows
.get_mut(¤t_window)
.expect("Window should be valid if loaded from switch_window")
.window
.set_icon(sdl2::surface::Surface::from_file(path).expect("Can't load image"));
}
pub fn draw_image(path: &str, x: i32, y: i32) {
let mut get = MAYLIB.lock().expect("Should be able to lock");
let current_window = get.current_window;
let window = get
.windows
.get_mut(¤t_window)
.expect("Window should be valid if loaded from switch_window");
let texture = window.texture.load_texture(path).expect("Can't load image");
let texture_query = texture.query();
let dst_rect = sdl2::rect::Rect::new(x, y, texture_query.width, texture_query.height);
window
.canvas
.copy(&texture, None, Some(dst_rect))
.expect("Can't copy image");
}