48 lines
1.0 KiB
C
48 lines
1.0 KiB
C
#ifndef UTILITIES_H
|
|
#define UTILITIES_H
|
|
|
|
#include <azur/gint/render.h>
|
|
#include <math.h>
|
|
#include <num/num.h>
|
|
|
|
void azrp_draw_text(int x, int y, char const *fmt, ...)
|
|
{
|
|
char str[128];
|
|
va_list args;
|
|
va_start(args, fmt);
|
|
vsnprintf(str, 128, fmt, args);
|
|
va_end(args);
|
|
|
|
extern bopti_image_t img_font;
|
|
|
|
for(int i = 0; str[i]; i++) {
|
|
if(str[i] < 32 || str[i] >= 0x7f) continue;
|
|
|
|
int row = (str[i] - 32) >> 4;
|
|
int col = (str[i] - 32) & 15;
|
|
azrp_subimage(x + 5 * i, y, &img_font, 7 * col + 1, 9 * row + 1, 6, 8, DIMAGE_NONE);
|
|
}
|
|
}
|
|
|
|
libnum::num32 COS( libnum::num32 angle )
|
|
{
|
|
float a = (float) angle;
|
|
float c = cos( a );
|
|
return libnum::num32(c);
|
|
}
|
|
|
|
libnum::num32 SIN( libnum::num32 angle )
|
|
{
|
|
float a = (float) angle;
|
|
float s = sin( a );
|
|
return libnum::num32(s);
|
|
}
|
|
|
|
#define MIN(a,b) ( ((a)>=(b)) ? (b) : (a) )
|
|
#define MAX(a,b) ( ((a)<=(b)) ? (b) : (a) )
|
|
#define ABS(a) ( ((a)>=0) ? (a) : -(a) )
|
|
#define SIGN(a) ( (a)<0 ? -1 : (a>0) ? +1 : 0 )
|
|
|
|
#define PI 3.14159265
|
|
|
|
#endif |