From 6a2d132873ce7b40405a3dc000a12539fffd969b Mon Sep 17 00:00:00 2001 From: tslil clingman <> Date: Wed, 1 Sep 2021 12:59:50 -0400 Subject: Init --- src/sfml/graphics/Font.zig | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/sfml/graphics/Font.zig (limited to 'src/sfml/graphics/Font.zig') 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, -- cgit v1.3.1