mirror of https://github.com/fairyglade/ly.git
refactor: remove termbox_extras in favor of the fork
This commit is contained in:
parent
6933c4db02
commit
5fb40899e5
|
@ -2,7 +2,6 @@ const std = @import("std");
|
||||||
const builtin = @import("builtin");
|
const builtin = @import("builtin");
|
||||||
const interop = @import("../interop.zig");
|
const interop = @import("../interop.zig");
|
||||||
const Cell = @import("Cell.zig");
|
const Cell = @import("Cell.zig");
|
||||||
const termbox_extras = @import("termbox_extras.zig");
|
|
||||||
|
|
||||||
const Random = std.Random;
|
const Random = std.Random;
|
||||||
|
|
||||||
|
@ -114,8 +113,8 @@ pub fn cascade(self: TerminalBuffer) bool {
|
||||||
var cell: termbox.tb_cell = undefined;
|
var cell: termbox.tb_cell = undefined;
|
||||||
var cell_under: termbox.tb_cell = undefined;
|
var cell_under: termbox.tb_cell = undefined;
|
||||||
|
|
||||||
_ = termbox_extras.tb_get_cell(@intCast(x), @intCast(y - 1), 1, &cell);
|
_ = termbox.tb_get_cell(@intCast(x), @intCast(y - 1), 1, &cell);
|
||||||
_ = termbox_extras.tb_get_cell(@intCast(x), @intCast(y), 1, &cell_under);
|
_ = termbox.tb_get_cell(@intCast(x), @intCast(y), 1, &cell_under);
|
||||||
|
|
||||||
const char: u8 = @truncate(cell.ch);
|
const char: u8 = @truncate(cell.ch);
|
||||||
if (std.ascii.isWhitespace(char)) continue;
|
if (std.ascii.isWhitespace(char)) continue;
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
const std = @import("std");
|
|
||||||
const interop = @import("../interop.zig");
|
|
||||||
const termbox = interop.termbox;
|
|
||||||
|
|
||||||
pub fn tb_get_cell(x: c_int, y: c_int, back: c_int, cell: *termbox.tb_cell) c_int {
|
|
||||||
if (back == 0) {
|
|
||||||
return termbox.TB_ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
const width = termbox.tb_width();
|
|
||||||
const height = termbox.tb_height();
|
|
||||||
|
|
||||||
if (x < 0 or x >= width or y < 0 or y >= height) {
|
|
||||||
return termbox.TB_ERR_OUT_OF_BOUNDS;
|
|
||||||
}
|
|
||||||
|
|
||||||
const buffer = termbox.tb_cell_buffer();
|
|
||||||
if (buffer == null) {
|
|
||||||
return termbox.TB_ERR_NOT_INIT;
|
|
||||||
}
|
|
||||||
|
|
||||||
const index = y * width + x;
|
|
||||||
cell.* = buffer[@intCast(index)];
|
|
||||||
|
|
||||||
return termbox.TB_OK;
|
|
||||||
}
|
|
Loading…
Reference in New Issue