8#include <entt/locator/locator.hpp>
24 auto& lua = entt::locator<sol::state>::value();
33 auto random_type = lua.new_usertype<
math::Random>(
"Random", sol::constructors<math::Random()>());
41 auto rectpack_type = lua.new_usertype<
math::RectPack>(
"RectPack", sol::constructors<math::RectPack()>());
Generates random numbers.
T gen(const T min, const T max) noexcept
Generate a random number of type T.
sf::Vector2< T > gen_vec2(const sf::Vector2< T > &min, const sf::Vector2< T > &max) noexcept
Generate a random vec2.
sf::Vector3< T > gen_vec3(const sf::Vector3< T > &min, const sf::Vector3< T > &max) noexcept
Generate a random vec3.
Rectangle 2D bin packing class.
void init(const int width, const int height) noexcept
Set starting width and height of rectangle.
std::optional< sf::IntRect > pack(const int width, const int height) noexcept
Pack a rectangle into the master rectangle.
int get_width() const noexcept
Get total width.
void clear() noexcept
Clear all data.
const std::vector< sf::IntRect > & get_free_space() const noexcept
Get free rectangles.
int get_height() const noexcept
Get total height.
void inject_math()
Injects math stuff into Lua.
std::string encode_base64(const std::string &input)
Compresses string into Base64.
std::string decode_base64(const std::string &input)
Decompresses string into Base64.
constexpr bits fnv1a(const char *const str, const bits value=fnv_1a_params< bits >::offset) noexcept
Convert string to hash.
float normalize(const Type val, const Type max) noexcept
Calc normalized value from range.
std::string encode_zlib(const std::string &input)
Compresses string into ZLib.
std::string decode_zlib(const std::string &input)
Decompresses string into ZLib.