// ============================================= // Aster: constants.h // Copyright (c) 2020-2024 Anish Bhobe // ============================================= #pragma once #include #include #include #include #include using c8 = char; using u8 = uint8_t; using u16 = uint16_t; using u32 = uint32_t; using u64 = uint64_t; using i8 = int8_t; using i16 = int16_t; using i32 = int32_t; using i64 = int64_t; using f32 = float; using f64 = double; using f128 = long double; using b8 = bool; using b32 = u32; using usize = size_t; using p64 = intptr_t; constexpr usize strlen_c(const char *s) { usize len = 0; char c = '\0'; do { c = s[len]; len++; } while (c != '\0'); return len; } constexpr auto ANSI_Black = "\u001b[30m"; constexpr auto ANSI_Red = "\u001b[31m"; constexpr auto ANSI_Green = "\u001b[32m"; constexpr auto ANSI_Yellow = "\u001b[33m"; constexpr auto ANSI_Blue = "\u001b[34m"; constexpr auto ANSI_Magenta = "\u001b[35m"; constexpr auto ANSI_Cyan = "\u001b[36m"; constexpr auto ANSI_White = "\u001b[37m"; constexpr auto ANSI_Reset = "\u001b[0m"; template using Option = std::optional; template constexpr auto cast(from_t &&_in) { return static_cast(std::forward(_in)); } template constexpr auto recast(from_t &&_in) { return reinterpret_cast(std::forward(_in)); } constexpr f32 operator""_deg(long double degrees) { return glm::radians(cast(degrees)); } constexpr f32 operator""_deg(unsigned long long int degrees) { return glm::radians(cast(degrees)); } constexpr f32 operator""_rad(long double rads) { return cast(rads); } constexpr f32 operator""_rad(unsigned long long int rads) { return cast(rads); } using glm::ivec2; using glm::ivec3; using glm::ivec4; using glm::vec2; using glm::vec3; using glm::vec4; using glm::mat2; using glm::mat3; using glm::mat4; constexpr auto *PROJECT_NAME = "Aster"; struct Version { u32 major; u32 minor; u32 patch; }; constexpr Version VERSION = { .major = 0, .minor = 1, .patch = 0, }; template constexpr T max_value = std::numeric_limits::max(); template constexpr T min_value = std::numeric_limits::min(); template constexpr T lowest_value = std::numeric_limits::lowest(); template constexpr T err_epsilon = std::numeric_limits::epsilon(); template constexpr T positive_inf = std::numeric_limits::infinity(); template constexpr T negative_inf = -std::numeric_limits::infinity(); template constexpr T qnan = std::numeric_limits::quiet_NaN(); template constexpr T snan = std::numeric_limits::signalling_NaN();