aboutsummaryrefslogtreecommitdiff
path: root/src/sfml/graphics/Font.zig
diff options
context:
space:
mode:
authortslil clingman <>2021-09-01 12:59:50 -0400
committertslil clingman <>2021-09-01 12:59:50 -0400
commit6a2d132873ce7b40405a3dc000a12539fffd969b (patch)
tree3b730360b348900fbc937bd44b89c293c39ca00c /src/sfml/graphics/Font.zig
Init
Diffstat (limited to 'src/sfml/graphics/Font.zig')
-rw-r--r--src/sfml/graphics/Font.zig25
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,