feat: added time_seconds

stripped
Sara 2024-06-11 09:10:40 +02:00
parent d680ebf55f
commit 08e21f0568
1 changed files with 6 additions and 0 deletions

View File

@ -2,6 +2,7 @@
#define UTILS_FUNCTIONS_HPP #define UTILS_FUNCTIONS_HPP
#include <godot_cpp/variant/dictionary.hpp> #include <godot_cpp/variant/dictionary.hpp>
#include <godot_cpp/classes/time.hpp>
#include <godot_cpp/templates/hash_map.hpp> #include <godot_cpp/templates/hash_map.hpp>
namespace utils { namespace utils {
@ -21,6 +22,11 @@ godot::HashMap<T, U> dictionary_to_hashmap(godot::Dictionary const &dict) {
map.insert(keys[i], dict[keys[i]]); map.insert(keys[i], dict[keys[i]]);
return map; return map;
} }
static inline
double time_seconds() {
return double(godot::Time::get_singleton()->get_ticks_msec()) * 0.001;
}
} }
#endif // !UTILS_FUNCTIONS_HPP #endif // !UTILS_FUNCTIONS_HPP