#ifndef UTILS_FUNCTIONS_HPP #define UTILS_FUNCTIONS_HPP #include #include #include namespace utils { template godot::Dictionary hashmap_to_dictionary(godot::HashMap const &map) { godot::Dictionary dict{}; for(godot::KeyValue const &kvp : map) dict[kvp.key] = kvp.value; return dict; } template godot::HashMap dictionary_to_hashmap(godot::Dictionary const &dict) { godot::HashMap map{}; godot::Array keys{dict.keys()}; for(size_t i = 0; i < keys.size(); ++i) map.insert(keys[i], dict[keys[i]]); return map; } static inline double time_seconds() { return double(godot::Time::get_singleton()->get_ticks_msec()) * 0.001; } } #endif // !UTILS_FUNCTIONS_HPP