Write file name inline

This commit is contained in:
Nathan McRae 2023-06-18 00:23:07 -07:00
parent 8a16eff9ba
commit d3e47ee184

View File

@ -32,6 +32,7 @@ pub fn main() !void {
defer c.SDL_DestroyRenderer(renderer); defer c.SDL_DestroyRenderer(renderer);
const source_code = @embedFile("GapProbeScan.cs"); const source_code = @embedFile("GapProbeScan.cs");
const file_name = "GapProbeScan.cs";
const color_result: c_int = c.SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255); const color_result: c_int = c.SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255);
if (color_result != 0) { if (color_result != 0) {
@ -62,7 +63,7 @@ pub fn main() !void {
return error.TTFFontLoadFailed; return error.TTFFontLoadFailed;
} }
const surface: [*c]c.SDL_Surface = c.TTF_RenderText_Solid(font, "Hello, World!", text_color); const surface: [*c]c.SDL_Surface = c.TTF_RenderText_Solid(font, file_name, text_color);
if (surface == null) { if (surface == null) {
c.SDL_Log("Unable to render text"); c.SDL_Log("Unable to render text");
return error.RenderTextFailed; return error.RenderTextFailed;
@ -118,7 +119,7 @@ pub fn main() !void {
var i: usize = 0; var i: usize = 0;
var column: c_int = 0; var column: c_int = 0;
x = 0; x = 0;
var y: c_int = 0; var y: c_int = surface.*.h;
// white: false, black: true // white: false, black: true
var color: bool = false; var color: bool = false;
while (i < source_code.len) : (i += 1) { while (i < source_code.len) : (i += 1) {