Load config test
This commit is contained in:
parent
e72ab56197
commit
be50d94f78
src
|
@ -0,0 +1,28 @@
|
|||
const std = @import("std");
|
||||
const fs = std.fs;
|
||||
const io = std.io;
|
||||
|
||||
pub fn getConfig(path: []const u8) void {
|
||||
var file = fs.cwd().createFile(path, .{.read = true, .truncate = false}) catch |err| {
|
||||
// TODO: Tirar error cap a dalt
|
||||
std.debug.print("Error opening config file '{s}': {any}", .{ path, err });
|
||||
return;
|
||||
};
|
||||
defer file.close();
|
||||
|
||||
var buf: [256]u8 = undefined;
|
||||
|
||||
var fbs = io.fixedBufferStream(&buf);
|
||||
|
||||
var reader = file.reader();
|
||||
|
||||
while (true) {
|
||||
reader.streamUntilDelimiter(fbs.writer(), '\n', buf.len) catch |err| {
|
||||
std.debug.print("{any}\n", .{err});
|
||||
break;
|
||||
};
|
||||
defer fbs.reset();
|
||||
|
||||
std.debug.print("{s}\n", .{fbs.getWritten()});
|
||||
}
|
||||
}
|
|
@ -5,10 +5,14 @@ const shouldClose = @import("raylib.zig").windowShouldClose;
|
|||
const Renderer = @import("Renderer.zig");
|
||||
const Game = @import("Game.zig");
|
||||
const MainMenu = @import("MainMenu.zig");
|
||||
const config = @import("Config/config.zig");
|
||||
|
||||
const State = @import("flow.zig").State;
|
||||
|
||||
pub fn main() !void {
|
||||
|
||||
config.getConfig("test");
|
||||
|
||||
var renderer = try Renderer.init();
|
||||
defer renderer.deinit();
|
||||
|
||||
|
|
Loading…
Reference in New Issue