diff options
| author | Tom Barrett <tom@tombarrett.xyz> | 2021-12-20 18:19:19 +0100 | 
|---|---|---|
| committer | Tom Barrett <tom@tombarrett.xyz> | 2021-12-20 18:19:19 +0100 | 
| commit | 401bb91a64ae517a766be2525a237678666797fb (patch) | |
| tree | 18b236253da5732d1c02fc58ea1056b5c6677a8b /src | |
| parent | 83c27ccc818df03c906ddc90357b99fddbfafbc0 (diff) | |
setup
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.zig | 9 | ||||
| -rw-r--r-- | src/notcurses.zig | 30 | 
2 files changed, 22 insertions, 17 deletions
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);  }  | 
