|
|
@ -533,8 +533,11 @@ pub fn main() !void {
|
|
533
|
533
|
var skip: i32 = 0;
|
|
534
|
534
|
var skip_horizontal: usize = 0;
|
|
535
|
535
|
var num_lines: i32 = 0;
|
|
|
536
|
var output_length: usize = 0;
|
|
536
|
537
|
|
|
537
|
538
|
var changed = false;
|
|
|
539
|
|
|
|
540
|
var hasChanged = false;
|
|
538
|
541
|
var lastChange: u32 = 0;
|
|
539
|
542
|
|
|
540
|
543
|
while (!quit) {
|
|
|
@ -681,10 +684,22 @@ pub fn main() !void {
|
|
681
|
684
|
changed = false;
|
|
682
|
685
|
lastChange = c.SDL_GetTicks();
|
|
683
|
686
|
|
|
|
687
|
hasChanged = true;
|
|
|
688
|
|
|
684
|
689
|
skip = 0;
|
|
685
|
690
|
skip_horizontal = 0;
|
|
686
|
691
|
}
|
|
687
|
692
|
|
|
|
693
|
// do not render if nothing has changed
|
|
|
694
|
for (commands) |*command| {
|
|
|
695
|
if (command.isActive(cmd)) {
|
|
|
696
|
const out = try command.output();
|
|
|
697
|
if (!hasChanged and out.len == output_length) {
|
|
|
698
|
continue;
|
|
|
699
|
}
|
|
|
700
|
}
|
|
|
701
|
}
|
|
|
702
|
|
|
688
|
703
|
_ = c.SDL_SetRenderDrawColor(renderer, 0, 0, 0, 100);
|
|
689
|
704
|
//_ = c.SDL_SetRenderDrawBlendMode(renderer, c.SDL_BlendMode.SDL_BLENDMODE_BLEND);
|
|
690
|
705
|
_ = c.SDL_RenderClear(renderer);
|
|
|
@ -720,6 +735,9 @@ pub fn main() !void {
|
|
720
|
735
|
continue;
|
|
721
|
736
|
}
|
|
722
|
737
|
|
|
|
738
|
const output = try command.output();
|
|
|
739
|
output_length = output.len;
|
|
|
740
|
|
|
723
|
741
|
// TODO: indicate if command is still running
|
|
724
|
742
|
|
|
725
|
743
|
{
|
|
|
@ -733,7 +751,7 @@ pub fn main() !void {
|
|
733
|
751
|
}
|
|
734
|
752
|
|
|
735
|
753
|
//std.debug.print("{s} {d} {d}\n", .{ command.process.is_running(), command.process.stdout_buf.items.len, command.process.stdout_buf.capacity });
|
|
736
|
|
var lines = std.mem.split(u8, try command.output(), "\n");
|
|
|
754
|
var lines = std.mem.split(u8, output, "\n");
|
|
737
|
755
|
var line = lines.next();
|
|
738
|
756
|
{
|
|
739
|
757
|
var skipped: i32 = 0;
|