Start HUD
This commit is contained in:
parent
6d31c3c492
commit
b177e924dd
5 changed files with 78 additions and 12 deletions
24
renderer.h
24
renderer.h
|
@ -31,7 +31,7 @@
|
|||
#define LCR_RENDERER_MODEL_COUNT 10
|
||||
#define LCR_RENDERER_CAR_SCALE (LCR_RENDERER_UNIT / 4)
|
||||
|
||||
#define LCR_RENDERER_FONT_SEGMENT_SIZE 4
|
||||
#define LCR_RENDERER_FONT_SEGMENT_SIZE (2 + LCR_EFFECTIVE_RESOLUTION_X / 512)
|
||||
|
||||
/** For some reason the map model is a bit misaligned with physics world, this
|
||||
kinda hotfixes it -- later try to discover source of this bug. TODO */
|
||||
|
@ -128,6 +128,28 @@ void _LCR_rendererDrawFontPixel(int x, int y, uint16_t color)
|
|||
#endif
|
||||
}
|
||||
|
||||
int LCR_rendererComputeTextWidth(const char *text, int size)
|
||||
{
|
||||
int r = 0;
|
||||
size *= LCR_RENDERER_FONT_SEGMENT_SIZE;
|
||||
|
||||
while (*text)
|
||||
{
|
||||
text++;
|
||||
r += 2 * size;
|
||||
|
||||
if (text[1])
|
||||
r += 3 * size / 4;
|
||||
}
|
||||
|
||||
return r + LCR_FONT_PIXEL_SIZE - 1;
|
||||
}
|
||||
|
||||
int LCR_rendererComputeTextHeight(int size)
|
||||
{
|
||||
return 2 * size * LCR_RENDERER_FONT_SEGMENT_SIZE + LCR_FONT_PIXEL_SIZE - 1;
|
||||
}
|
||||
|
||||
void LCR_rendererDrawText(const char *text, int x, int y, uint16_t color,
|
||||
int size)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue