LibGame
v0.4.0
The LG Game Engine - Copyright (C) 2024 ETMSoftware
|
Functions | |
int | check_datatype_sizes () |
float | lg_tv_diff (struct timeval *t_diff, struct timeval *t2, struct timeval *t1) |
int | lg_show_pixel_format_info_from_sdl_display_mode (SDL_DisplayMode *display_mode) |
lg_endianness | lg_get_arch_endianness () |
float | lg_swap_float_values (float *x, float *y) |
double | lg_swap_double_values (double *x, double *y) |
int32_t | lg_swap_int32_values (int32_t *x, int32_t *y) |
uint32_t | lg_swap_uint32_values (uint32_t *x, uint32_t *y) |
int16_t | lg_swap_int16_values (int16_t *x, int16_t *y) |
uint16_t | lg_swap_uint16_values (uint16_t *x, uint16_t *y) |
int8_t | lg_swap_int8_values (int8_t *x, int8_t *y) |
uint8_t | lg_swap_uint8_values (uint8_t *x, uint8_t *y) |
void | lg_print_out_error_codes () |
int | lg_check_gl_context () |
void | debug_start_max_int_in_loop () |
void | debug_max_int_in_loop (unsigned long i, const char *file, int line) |
void | debug_end_max_int_in_loop () |
void | debug_start_max_float_in_loop () |
void | debug_max_float_in_loop (float f, const char *file, int line) |
void | debug_end_max_float_in_loop () |
void | lg_show_struct_sizes (zboolean everything) |
It's just that, a loose collection of funcs that don't belong to a specific module
int check_datatype_sizes | ( | ) |
Check C and OpenGL types at runtime
Also see: https://www.khronos.org/opengl/wiki/OpenGL_Type
float lg_tv_diff | ( | struct timeval * | t_diff, |
struct timeval * | t2, | ||
struct timeval * | t1 | ||
) |
Compute t2 - t1 (in s and µs) and store the result in t_diff.
t_diff | A pointer to a struct timeval |
t2 | A pointer to a struct timeval |
t1 | A pointer to a struct timeval |
int lg_show_pixel_format_info_from_sdl_display_mode | ( | SDL_DisplayMode * | display_mode | ) |
Show pixel format info bla bla
See: https://wiki.libsdl.org/SDL_PixelFormat
display_mode | Pointer to a SDL_DisplayMode struct |
lg_endianness lg_get_arch_endianness | ( | ) |
Get architecture endianness
From: https://developer.ibm.com/articles/au-endianc/
float lg_swap_float_values | ( | float * | x, |
float * | y | ||
) |
Portable value swapping
=== CHECKME: redundant ? what about bswap_16, bswap_32, bswap_64 ? ===
x | Pointer to float |
y | Pointer to float |
double lg_swap_double_values | ( | double * | x, |
double * | y | ||
) |
Portable value swapping
x | Pointer to double |
y | Pointer to double |
int32_t lg_swap_int32_values | ( | int32_t * | x, |
int32_t * | y | ||
) |
Portable value swapping
x | Pointer to int32_t |
y | Pointer to int32_t |
uint32_t lg_swap_uint32_values | ( | uint32_t * | x, |
uint32_t * | y | ||
) |
Portable value swapping
x | Pointer to uint32_t |
y | Pointer to uint32_t |
int16_t lg_swap_int16_values | ( | int16_t * | x, |
int16_t * | y | ||
) |
Portable value swapping
x | Pointer to int16_t |
y | Pointer to int16_t |
uint16_t lg_swap_uint16_values | ( | uint16_t * | x, |
uint16_t * | y | ||
) |
Portable value swapping
x | Pointer to uint16_t |
y | Pointer to uint16_t |
int8_t lg_swap_int8_values | ( | int8_t * | x, |
int8_t * | y | ||
) |
Portable value swapping
x | Pointer to int8_t |
y | Pointer to int8_t |
uint8_t lg_swap_uint8_values | ( | uint8_t * | x, |
uint8_t * | y | ||
) |
Portable value swapping
x | Pointer to uint8_t |
y | Pointer to uint8_t |
void lg_print_out_error_codes | ( | ) |
Print out error codes
int lg_check_gl_context | ( | ) |
Check OpenGL context, ie whether the current context has changed since app startup
void debug_start_max_int_in_loop | ( | ) |
For debugging purposes - 'Reset' max_int_in_loop
void debug_max_int_in_loop | ( | unsigned long | i, |
const char * | file, | ||
int | line | ||
) |
For debugging purposes - Print out max value found so far while running loop
Example use:
i = 0; debug_start_max_int_in_loop(); for (y = 0; y < h; y++) { for (x = 0; x < w; x++) { debug_max_int_in_loop((unsigned long)i, __FILE__, __LINE__); // ... terrain->vbo_data[i].x = (float)x / (float)w; terrain->vbo_data[i].y = heightmap[x + y * w] * vert_scaling_k; terrain->vbo_data[i].z = (float)y / (float)h; // ... i++; } } debug_end_max_int_in_loop();
i | Integer to test |
file | Should be "__FILE__" |
line | Should be "__LINE__" |
void debug_end_max_int_in_loop | ( | ) |
For debugging purposes - Just print out closing '\n'
void debug_start_max_float_in_loop | ( | ) |
For debugging purposes - 'Reset' max_float_in_loop
void debug_max_float_in_loop | ( | float | f, |
const char * | file, | ||
int | line | ||
) |
For debugging purposes - Print out max value found so far while running loop
Example use: same as above with float instead of int
f | float to test |
file | Should be "__FILE__" |
line | Should be "__LINE__" |
void debug_end_max_float_in_loop | ( | ) |
For debugging purposes - Just print out closing '\n'
void lg_show_struct_sizes | ( | zboolean | everything | ) |
Mainly for internal testing, but quite informative about memory consumption
Make sure to add new structs
everything | Every structs if TRUE , only big ones otherwise |