This commit is contained in:
Nathan McRae 2023-06-10 21:34:42 -07:00
parent b61717cf21
commit 727eeb8710

View File

@ -61,7 +61,6 @@ pub fn main() !void {
while (x < window_width) : (x += 1) { while (x < window_width) : (x += 1) {
var y: c_int = 0; var y: c_int = 0;
while (y < window_height) : (y += 1) { while (y < window_height) : (y += 1) {
// std.debug.print("x: {any}, y: {any}\n", .{x, y});
const draw_result = c.SDL_RenderDrawPoint(renderer, x, y); const draw_result = c.SDL_RenderDrawPoint(renderer, x, y);
if (draw_result != 0) { if (draw_result != 0) {
c.SDL_Log("Unable to draw point: %d", draw_result); c.SDL_Log("Unable to draw point: %d", draw_result);
@ -85,10 +84,10 @@ pub fn main() !void {
// std.debug.print("Column: {any}, x: {any}\n", .{column, column*column_width}); // std.debug.print("Column: {any}, x: {any}\n", .{column, column*column_width});
} }
x = column * column_width; x = column * column_width;
continue; continue;
} }
if (source_code[i] == 32 and color) { if (source_code[i] == 32 and color) {
color = false; color = false;
const white_color_result = c.SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255); const white_color_result = c.SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255);
@ -96,8 +95,7 @@ pub fn main() !void {
c.SDL_Log("Unable to set draw color: %d", white_color_result); c.SDL_Log("Unable to set draw color: %d", white_color_result);
return error.SDLInitializationFailed; return error.SDLInitializationFailed;
} }
} } else if (source_code[i] != 32 and !color) {
else if (source_code[i] != 32 and !color) {
color = true; color = true;
const black_color_result = c.SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255); const black_color_result = c.SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
if (black_color_result != 0) { if (black_color_result != 0) {