diff options
Diffstat (limited to 'src/sfml/graphics/Font.zig')
| -rw-r--r-- | src/sfml/graphics/Font.zig | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/sfml/graphics/Font.zig b/src/sfml/graphics/Font.zig new file mode 100644 index 0000000..78bd5a6 --- /dev/null +++ b/src/sfml/graphics/Font.zig @@ -0,0 +1,25 @@ +//! Class for loading and manipulating character fonts. + +const sf = @import("../sfml.zig"); + +const Font = @This(); + +// Constructor/destructor + +/// Loads a font from a file +pub fn createFromFile(path: [:0]const u8) !Font { + var font = sf.c.sfFont_createFromFile(path); + if (font == null) + return sf.Error.resourceLoadingError; + return Font{ .ptr = font.? }; +} +/// Destroys a font +pub fn destroy(self: Font) void { + sf.c.sfFont_destroy(self.ptr); +} + +pub const initFromMemory = @compileError("Function is not implemented yet."); +pub const initFromStream = @compileError("Function is not implemented yet."); + +/// Pointer to the csfml font +ptr: *sf.c.sfFont, |
