2023-05-24 17:24:37 +00:00
|
|
|
module hibis_rsdl.resources.font;
|
|
|
|
|
|
|
|
import hibis.resources.resource;
|
|
|
|
|
|
|
|
import sdl_ttf;
|
|
|
|
import std.string : toStringz;
|
|
|
|
import std.stdio;
|
2023-05-24 18:38:51 +00:00
|
|
|
import std.format : format;
|
2023-05-24 17:24:37 +00:00
|
|
|
|
|
|
|
class Font : Resource {
|
|
|
|
this(string path, uint size) {
|
|
|
|
const char* nPath = cast(const(char)*)toStringz(path);
|
|
|
|
loadedFont = TTF_OpenFont(nPath, size);
|
2023-05-24 18:38:51 +00:00
|
|
|
writeln(format("Loaded font at '%s'", path));
|
2023-05-24 17:24:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
~this() {
|
|
|
|
TTF_CloseFont(loadedFont);
|
|
|
|
}
|
|
|
|
|
|
|
|
public TTF_Font* loadedFont;
|
|
|
|
}
|