Merge branch 'master' of https://github.com/im-tem/anm2ed
This commit is contained in:
10
src/COMMON.h
10
src/COMMON.h
@@ -84,6 +84,7 @@ static const f32 GL_UV_VERTICES[] =
|
||||
};
|
||||
#define IMVEC2_VEC2(value) ImVec2(value.x, value.y)
|
||||
#define VEC2_IMVEC2(value) glm::vec2(value.x, value.y)
|
||||
#define IMVEC4_VEC4(value) ImVec4(value.r, value.g, value.b, value.a)
|
||||
|
||||
static const GLuint GL_TEXTURE_INDICES[] = {0, 1, 2, 2, 3, 0};
|
||||
|
||||
@@ -94,19 +95,10 @@ static const vec4 COLOR_OPAQUE = {1.0f, 1.0f, 1.0f, 1.0f};
|
||||
static const vec4 COLOR_TRANSPARENT = {0.0f, 0.0f, 0.0f, 1.0f};
|
||||
static const vec3 COLOR_OFFSET_NONE = {0.0f, 0.0f, 0.0f};
|
||||
|
||||
|
||||
static inline const char* enum_to_string(const char* arr[], s32 count, s32 index) { return (index >= 0 && index < count) ? arr[index] : "undefined"; }
|
||||
static inline s32 string_to_enum(const char* str, const char* const* arr, s32 n) { for (s32 i=0; i<n; ++i) if (!strcmp(str, arr[i])) return i; return -1; }
|
||||
static inline bool string_to_bool(const char* str) { if (strcmp(str, "true") == 0) return true; return false; }
|
||||
|
||||
static inline void working_directory_from_path_set(const char* path)
|
||||
{
|
||||
std::filesystem::path filePath = path;
|
||||
std::filesystem::path dir = filePath.parent_path();
|
||||
if (!dir.empty())
|
||||
std::filesystem::current_path(dir);
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
static inline s32 map_next_id_get(const std::map<s32, T>& map) {
|
||||
s32 id = 0; for (const auto& [key, _] : map) if (key != id) break; else ++id; return id;
|
||||
|
Reference in New Issue
Block a user