agdu 0.1.0

Amy's Game Dev Utilities
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use godot::{
	classes::{Engine, SceneTree, Window},
	obj::{Gd, Singleton},
};

#[must_use]
pub fn get_scene_root() -> Option<Gd<Window>> {
	get_scene_tree().and_then(|s| s.get_root())
}

#[must_use]
pub fn get_scene_tree() -> Option<Gd<SceneTree>> {
	Engine::singleton()
		.get_main_loop()
		.and_then(|m| m.try_cast::<SceneTree>().ok())
}