GCubeSDK
©2026 FenixFox®Studios

Utils

Utility class providing common functionality used across the engine.
This class centralizes common utility functions that were previously duplicated across multiple classes, improving code maintainability and reducing bloat.

Methods

template<typename T> static T clamp(T value, T minVal, T maxVal)

Clamps value to the inclusive range [minVal, maxVal]

value Value to clamp
minVal Lower bound
maxVal Upper bound

static string generateUUID()

Generates a unique UUID string for objects

static u32 generateId(const string& className)

Generates a unique ID for objects of a specific class

className Name of the class for ID generation

static void printHex(const void* data, u32 count, u8 width)

Prints the specified number of bytes from a pointer in hexadecimal format

data Pointer to the data to print
count Number of bytes to print
width Number of cols displayed

static u16 read16LE(const u8* bytes)

Reads a 16-bit little-endian value from two bytes

bytes Pointer to at least 2 bytes

static u32 read32LE(const u8* bytes)

Reads a 32-bit little-endian value from four bytes

bytes Pointer to at least 4 bytes

constexpr u32 shash(const char* s, u32 h)

string hash helper

s c-string input
h initial seed 2166136261u

static f32 random()

Generates a uniform random value in the range [0.0f, 1.0f)

Properties