Files
factorygame/util/font.h
2025-06-10 21:59:51 +02:00

32 lines
603 B
C

//
// Created by bruno on 1.2.2025.
//
#ifndef RISCB_FONT_H
#define RISCB_FONT_H
#include <SDL2/SDL_render.h>
#include <SDL2/SDL_ttf.h>
#include <math.h>
#define fontCount 5
typedef struct {
SDL_Texture *atlas;
SDL_Rect glyphs[256];
uint8_t size;
SDL_Rect atlasRect;
SDL_Color color;
} BitmapFont;
extern BitmapFont fonts[fontCount];
BitmapFont prepText(SDL_Renderer *renderer, unsigned char pxSize, const char *file);
void destroyFont(BitmapFont *font);
void renderText(SDL_Renderer *renderer, BitmapFont font, char *string, uint16_t x, uint16_t y);
#endif //RISCB_FONT_H