From 401bb91a64ae517a766be2525a237678666797fb Mon Sep 17 00:00:00 2001 From: Tom Barrett Date: Mon, 20 Dec 2021 18:19:19 +0100 Subject: setup --- src/main.zig | 9 +++++++-- src/notcurses.zig | 30 +++++++++++++++--------------- 2 files changed, 22 insertions(+), 17 deletions(-) (limited to 'src') 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); } -- cgit v1.2.3