example/dodge_the_creeps: Replace unsafe code
This merge request replaces the currently used `unsafe` code with safe
implementation using `get_viewport_rect`
Discovered during quality assurance for
@@ -32,8 +32,8 @@ impl Player {
#[export]
fn _ready(&mut self, owner: &Area2D) {
- let viewport = unsafe { owner.get_viewport().unwrap().assume_safe() };
- self.screen_size = viewport.size();
+ let viewport = owner.get_viewport_rect();
+ self.screen_size = viewport.size.to_vector();
owner.hide();
}
