|
|
@ -561,7 +561,8 @@ pub fn main() !void {
|
|
561
|
561
|
_ = c.SDL_RenderClear(renderer);
|
|
562
|
562
|
|
|
563
|
563
|
// thanks to https://stackoverflow.com/questions/22886500/how-to-render-text-in-sdl2 for some actually useful code here
|
|
564
|
|
const white: c.SDL_Color = c.SDL_Color{ .r = 255, .g = 255, .b = 255, .a = 255 };
|
|
|
564
|
const white: c.SDL_Color = c.SDL_Color{ .r = 255, .g = 255, .b = 255, .a = 0 };
|
|
|
565
|
const gray: c.SDL_Color = c.SDL_Color{ .r = 150, .g = 150, .b = 150, .a = 255 };
|
|
565
|
566
|
const black: c.SDL_Color = c.SDL_Color{ .r = 0, .g = 0, .b = 0, .a = 100 };
|
|
566
|
567
|
// Shaded vs Solid gives a nicer output, with solid the output
|
|
567
|
568
|
// was squiggly and not aligned with a baseline.
|
|
|
@ -576,6 +577,16 @@ pub fn main() !void {
|
|
576
|
577
|
continue;
|
|
577
|
578
|
}
|
|
578
|
579
|
|
|
|
580
|
{
|
|
|
581
|
const name = try gpa.dupeZ(u8, command.name);
|
|
|
582
|
const result_text = c.TTF_RenderUTF8_Shaded(font, name, gray, c.SDL_Color{ .r = 0, .g = 0, .b = 0, .a = 255 });
|
|
|
583
|
gpa.free(name);
|
|
|
584
|
const result_texture = c.SDL_CreateTextureFromSurface(renderer, result_text);
|
|
|
585
|
_ = c.SDL_RenderCopy(renderer, result_texture, null, &c.SDL_Rect{ .x = window_width - @intCast(c_int, command.name.len) * glyph_width, .y = 0, .w = @intCast(c_int, command.name.len) * glyph_width, .h = glyph_height });
|
|
|
586
|
c.SDL_FreeSurface(result_text);
|
|
|
587
|
c.SDL_DestroyTexture(result_texture);
|
|
|
588
|
}
|
|
|
589
|
|
|
579
|
590
|
//std.debug.print("{s} {d} {d}\n", .{ command.process.is_running(), command.process.stdout_buf.items.len, command.process.stdout_buf.capacity });
|
|
580
|
591
|
var lines = std.mem.split(u8, try command.output(), "\n");
|
|
581
|
592
|
var line = lines.next();
|