diff options
-rw-r--r-- | build.zig | 2 | ||||
-rw-r--r-- | src/main.zig | 9 | ||||
-rw-r--r-- | src/notcurses.zig | 30 |
3 files changed, 24 insertions, 17 deletions
@@ -8,7 +8,9 @@ pub fn build(b: *std.build.Builder) void { exe.setTarget(target); exe.setBuildMode(mode); exe.install(); + exe.linkSystemLibrary("ncurses"); exe.linkSystemLibrary("notcurses"); + exe.linkSystemLibrary("notcurses-core"); exe.linkSystemLibrary("c"); const run_cmd = exe.run(); diff --git a/src/main.zig b/src/main.zig index a93a524..fefba0a 100644 --- a/src/main.zig +++ b/src/main.zig @@ -1,6 +1,11 @@ const std = @import("std"); -const notcurses = @import("notcurses.zig"); +const nc = @import("notcurses.zig"); pub fn main() anyerror!void { - var nc = notcurses.init(); + var runtime = nc.init(); + var plane = nc.stdplane(runtime); + nc.plane_putchar_yx(plane, 1, 2, 'T'); + while (true) { + nc.render(runtime); + } } diff --git a/src/notcurses.zig b/src/notcurses.zig index 4a790b8..2adba41 100644 --- a/src/notcurses.zig +++ b/src/notcurses.zig @@ -1,18 +1,18 @@ -const std = @import("std"); -const notcurses = @cImport(@cInclude("notcurses/notcurses.h")); +//const std = @import("std"); +const nc = @cImport(@cInclude("notcurses/notcurses.h")); -pub const default_notcurses_options = notcurses.notcurses_options{ - .termtype = null, - //.renderfp = null, - .loglevel = notcurses.ncloglevel_e.NCLOGLEVEL_SILENT, - .margin_t = 0, - .margin_r = 0, - .margin_b = 0, - .margin_l = 0, - .flags = 0, -}; +pub fn init() ?*nc.notcurses { + return nc.notcurses_init(null, null); +} + +pub fn stdplane(runtime: ?*nc.notcurses) ?*nc.ncplane { + return nc.notcurses_stdplane(runtime); +} + +pub fn plane_putchar_yx(plane: ?*nc.ncplane, y: u8, x: u8, c: u8) void { + var ret = nc.ncplane_putchar_yx(plane, y, x, c); +} -pub fn init() ?*notcurses.notcurses { - var options = default_notcurses_options; - return notcurses.notcurses_init(&options, null); +pub fn render(runtime: ?*nc.notcurses) void { + var ret = nc.notcurses_render(runtime); } |