Hello, I want to move my player character downward constantly with a thread and a while loop. However, GTK-RS is not thread safe. I want to know how I can do this, or if there’s a different approach that I could take. Code:
pub fn create_player(layout: &Fixed){
let player = Image::from_file("/home/dequog/dev/Game/src/bird.png");
let mut y = 20;
layout.put(&player, 20, y);
thread::spawn(move || {
while true {
y += 1;
layout.move_(&player, 20, y);
thread::sleep(Duration::from_millis(1));
}
});
}