mirror of https://github.com/fairyglade/ly.git
Update termbox2
Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
parent
aa0222948a
commit
f988bd334b
|
|
@ -13,8 +13,8 @@
|
||||||
.hash = "zigini-0.3.2-BSkB7aVHAADhxwo0aEdWtNzaVXer3d8RwXMuZd-q-spO",
|
.hash = "zigini-0.3.2-BSkB7aVHAADhxwo0aEdWtNzaVXer3d8RwXMuZd-q-spO",
|
||||||
},
|
},
|
||||||
.termbox2 = .{
|
.termbox2 = .{
|
||||||
.url = "git+https://github.com/AnErrupTion/termbox2?ref=get_cell#e975d250ee6567773400e9d5b0b5c2f175349c57",
|
.url = "git+https://github.com/AnErrupTion/termbox2?ref=master#290ac6b8225aacfd16851224682b851b65fcb918",
|
||||||
.hash = "N-V-__8AAMruBACJ7xT-O64hnS7lNeTiZQMketHdkHKrR1A8",
|
.hash = "N-V-__8AAGcUBQAa5vov1Yi_9AXEffFQ1e2KsXaK4dgygRKq",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
.paths = .{""},
|
.paths = .{""},
|
||||||
|
|
|
||||||
|
|
@ -117,24 +117,28 @@ pub fn cascade(self: TerminalBuffer) bool {
|
||||||
|
|
||||||
while (y > 0) : (y -= 1) {
|
while (y > 0) : (y -= 1) {
|
||||||
for (0..self.width) |x| {
|
for (0..self.width) |x| {
|
||||||
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.tb_get_cell(@intCast(x), @intCast(y - 1), 1, &cell);
|
_ = termbox.tb_get_cell(@intCast(x), @intCast(y - 1), 1, &cell);
|
||||||
_ = termbox.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);
|
// This shouldn't happen under normal circumstances, but because
|
||||||
|
// this is a *secret* animation, there's no need to care that much
|
||||||
|
if (cell == null or cell_under == null) continue;
|
||||||
|
|
||||||
|
const char: u8 = @truncate(cell.?.ch);
|
||||||
if (std.ascii.isWhitespace(char)) continue;
|
if (std.ascii.isWhitespace(char)) continue;
|
||||||
|
|
||||||
const char_under: u8 = @truncate(cell_under.ch);
|
const char_under: u8 = @truncate(cell_under.?.ch);
|
||||||
if (!std.ascii.isWhitespace(char_under)) continue;
|
if (!std.ascii.isWhitespace(char_under)) continue;
|
||||||
|
|
||||||
changed = true;
|
changed = true;
|
||||||
|
|
||||||
if ((self.random.int(u16) % 10) > 7) continue;
|
if ((self.random.int(u16) % 10) > 7) continue;
|
||||||
|
|
||||||
_ = termbox.tb_set_cell(@intCast(x), @intCast(y), cell.ch, cell.fg, cell.bg);
|
_ = termbox.tb_set_cell(@intCast(x), @intCast(y), cell.?.ch, cell.?.fg, cell.?.bg);
|
||||||
_ = termbox.tb_set_cell(@intCast(x), @intCast(y - 1), ' ', cell_under.fg, cell_under.bg);
|
_ = termbox.tb_set_cell(@intCast(x), @intCast(y - 1), ' ', cell_under.?.fg, cell_under.?.bg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue