mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Basic camera control API (#15796)
This commit is contained in:
parent
50819ace8f
commit
ba62808fe8
18 changed files with 162 additions and 42 deletions
|
@ -5,6 +5,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <string_view>
|
||||
#include <type_traits>
|
||||
|
||||
struct EnumString
|
||||
{
|
||||
|
@ -14,4 +15,13 @@ struct EnumString
|
|||
|
||||
bool string_to_enum(const EnumString *spec, int &result, std::string_view str);
|
||||
|
||||
template <typename T, std::enable_if_t<std::is_enum_v<T>, bool> = true>
|
||||
bool string_to_enum(const EnumString *spec, T &result, std::string_view str)
|
||||
{
|
||||
int result_int = result;
|
||||
bool ret = string_to_enum(spec, result_int, str);
|
||||
result = static_cast<T>(result_int);
|
||||
return ret;
|
||||
}
|
||||
|
||||
const char *enum_to_string(const EnumString *spec, int num);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue