31 lines
795 B
C
31 lines
795 B
C
//---
|
|
// util: General utilities (what a surprise huh?)
|
|
//---
|
|
|
|
#pragma once
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
/* Like qsort(), but actually it's a heap sort. */
|
|
void heap_sort(void *base, size_t n, size_t elsize,
|
|
int (*compare)(void const *, void const *));
|
|
|
|
/* Integer square root (recursive, logarithmic complexity). */
|
|
int64_t sqrtll(int64_t n);
|
|
|
|
/* Round F-key. */
|
|
void fkey_button(int position, char const *text, int color);
|
|
|
|
/* Size of text with digit-only image font. */
|
|
void font_damage_size(int value, int *w, int *h);
|
|
|
|
/* Render text with digit-only image font. */
|
|
void font_damage_print(int x, int y, int color, int align_x, int align_y,
|
|
int value);
|
|
|
|
#define RGB24(hex) \
|
|
(((hex & 0xf80000) >> 8) | \
|
|
((hex & 0x00fc00) >> 5) | \
|
|
((hex & 0x0000f8) >> 3))
|