This file contains global type definitions which are used throughout the entire engine and applicatio...
#define KAPI
Import/export qualifier.
Definition: defines.h:177
unsigned int u32
Unsigned 32-bit integer.
Definition: defines.h:25
signed char i8
Signed 8-bit integer.
Definition: defines.h:33
_Bool b8
8-bit boolean type
Definition: defines.h:58
float f32
32-bit floating point number
Definition: defines.h:47
double f64
64-bit floating point number
Definition: defines.h:50
signed int i32
Signed 32-bit integer.
Definition: defines.h:39
unsigned short u16
Unsigned 16-bit integer.
Definition: defines.h:22
signed short i16
Signed 16-bit integer.
Definition: defines.h:36
unsigned long long u64
Unsigned 64-bit integer.
Definition: defines.h:28
signed long long i64
Signed 64-bit integer.
Definition: defines.h:42
unsigned char u8
Unsigned 8-bit integer.
Definition: defines.h:19
KAPI b8 string_to_i16(const char *str, i16 *i)
Attempts to parse a 16-bit signed integer from the provided string.
KAPI void string_append_float(char *dest, const char *source, f32 f)
Appends the supplied float to source and outputs to dest.
KAPI b8 strings_equali(const char *str0, const char *str1)
Case-insensitive string comparison.
KAPI b8 string_to_u64(const char *str, u64 *u)
Attempts to parse a 64-bit unsigned integer from the provided string.
KAPI void string_append_string(char *dest, const char *source, const char *append)
KAPI char * string_copy(char *dest, const char *source)
Copies the string in source to dest. Does not perform any allocations.
KAPI b8 string_to_u16(const char *str, u16 *u)
Attempts to parse a 16-bit unsigned integer from the provided string.
KAPI u32 kstring_utf8_length(const kstring *string)
KAPI b8 bytes_to_codepoint(const char *bytes, u32 offset, i32 *out_codepoint, u8 *out_advance)
Obtains bytes needed from the byte array to form a UTF-8 codepoint, also providing how many bytes the...
KAPI void string_mid(char *dest, const char *source, i32 start, i32 length)
Gets a substring of the source string between start and length or to the end of the string....
KAPI b8 string_to_i8(const char *str, i8 *i)
Attempts to parse an 8-bit signed integer from the provided string.
KAPI b8 strings_equal(const char *str0, const char *str1)
Case-sensitive string comparison.
KAPI void string_append_char(char *dest, const char *source, char c)
Appends the supplied character to source and outputs to dest.
KAPI void kstring_from_cstring(const char *source, kstring *out_string)
KAPI b8 string_to_u32(const char *str, u32 *u)
Attempts to parse a 32-bit unsigned integer from the provided string.
KAPI char * string_trim(char *str)
Performs an in-place trim of the provided string. This removes all whitespace from both ends of the s...
KAPI b8 string_to_vec2(const char *str, vec2 *out_vector)
Attempts to parse a vector from the provided string.
KAPI b8 string_to_f32(const char *str, f32 *f)
Attempts to parse a 32-bit floating-point number from the provided string.
KAPI void string_directory_from_path(char *dest, const char *path)
Extracts the directory from a full file path.
KAPI void kstring_create(kstring *out_string)
KAPI u32 string_split(const char *str, char delimiter, char ***str_darray, b8 trim_entries, b8 include_empty)
Splits the given string by the delimiter provided and stores in the provided darray....
KAPI void kstring_destroy(kstring *string)
KAPI u32 string_utf8_length(const char *str)
Gets the length of a string in UTF-8 (potentially multibyte) characters.
KAPI void kstring_append_str(kstring *string, const char *s)
KAPI void string_cleanup_split_array(char **str_darray)
Cleans up string allocations in str_darray, but does not free the darray itself.
struct kstring kstring
A kstring is a managed string for higher-level logic to use. It is safer and, in some cases quicker t...
KAPI b8 strings_nequal(const char *str0, const char *str1, u64 length)
Case-sensitive string comparison for a number of characters.
KAPI i32 string_format(char *dest, const char *format,...)
Performs string formatting to dest given format string and parameters.
KAPI void string_append_bool(char *dest, const char *source, b8 b)
Appends the supplied boolean (as either "true" or "false") to source and outputs to dest.
KAPI u32 kstring_length(const kstring *string)
KAPI b8 string_to_f64(const char *str, f64 *f)
Attempts to parse a 64-bit floating-point number from the provided string.
KAPI b8 strings_nequali(const char *str0, const char *str1, u64 length)
Case-insensitive string comparison for a number of characters.
KAPI b8 string_to_mat4(const char *str, mat4 *out_mat)
Attempts to parse a 4x4 matrix from the provided string.
KAPI void string_free(char *str)
Frees the memory of the given string.
KAPI b8 string_to_i64(const char *str, i64 *i)
Attempts to parse a 64-bit signed integer from the provided string.
KAPI char * string_ncopy(char *dest, const char *source, i64 length)
Copies the string in source to dest up to the given length. Does not perform any allocations.
KAPI i32 string_format_v(char *dest, const char *format, void *va_list)
Performs variadic string formatting to dest given format string and va_list.
KAPI void kstring_append_kstring(kstring *string, const kstring *other)
KAPI void string_filename_from_path(char *dest, const char *path)
Extracts the filename (including file extension) from a full file path.
KAPI u64 string_length(const char *str)
Gets the length of the given string.
KAPI i32 string_index_of(const char *str, char c)
Returns the index of the first occurance of c in str; otherwise -1.
KAPI b8 string_to_u8(const char *str, u8 *u)
Attempts to parse an 8-bit unsigned integer from the provided string.
KAPI b8 string_to_bool(const char *str, b8 *b)
Attempts to parse a boolean from the provided string. "true" or "1" are considered true; anything els...
KAPI char * string_empty(char *str)
Empties the provided string by setting the first character to 0.
KAPI b8 string_to_i32(const char *str, i32 *i)
Attempts to parse a 32-bit signed integer from the provided string.
KAPI b8 string_to_vec4(const char *str, vec4 *out_vector)
Attempts to parse a vector from the provided string.
KAPI i32 string_index_of_str(const char *str_0, const char *str_1)
Returns the index of the first occurance of str_1 in str_0; otherwise -1.
KAPI b8 string_to_transform(const char *str, transform *out_transform)
Attempts to parse a transform from the provided string. If the string contains 10 elements,...
KAPI void string_filename_no_extension_from_path(char *dest, const char *path)
Extracts the filename (excluding file extension) from a full file path.
KAPI char * string_duplicate(const char *str)
Duplicates the provided string. Note that this allocates new memory, which should be freed by the cal...
KAPI void string_append_int(char *dest, const char *source, i64 i)
Appends the supplied integer to source and outputs to dest.
KAPI b8 string_to_vec3(const char *str, vec3 *out_vector)
Attempts to parse a vector from the provided string.
Contains various math types required for the engine.
A kstring is a managed string for higher-level logic to use. It is safer and, in some cases quicker t...
Definition: kstring.h:424
u32 length
The current length of the string in bytes.
Definition: kstring.h:426
u32 allocated
The amount of currently allocated memory. Always accounts for a null terminator.
Definition: kstring.h:428
char * data
The raw string data.
Definition: kstring.h:430
a 4x4 matrix, typically used to represent object transformations.
Definition: math_types.h:147
A 2-element vector.
Definition: math_types.h:19
A 3-element vector.
Definition: math_types.h:49
A 4-element vector.
Definition: math_types.h:89