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

View File

@ -57,11 +57,10 @@ pub fn main() !void {
return error.SDLInitializationFailed;
}
var x:c_int = 0;
var x: c_int = 0;
while (x < window_width) : (x += 1) {
var y:c_int = 0;
var y: c_int = 0;
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);
if (draw_result != 0) {
c.SDL_Log("Unable to draw point: %d", draw_result);
@ -70,12 +69,12 @@ pub fn main() !void {
}
}
var i:usize = 0;
var column:c_int = 0;
var i: usize = 0;
var column: c_int = 0;
x = 0;
var y:c_int = 0;
var y: c_int = 0;
// white: false, black: true
var color:bool = false;
var color: bool = false;
while (i < source_code.len) : (i += 1) {
if (source_code[i] == 10) {
y += 1;
@ -85,10 +84,10 @@ pub fn main() !void {
// std.debug.print("Column: {any}, x: {any}\n", .{column, column*column_width});
}
x = column * column_width;
continue;
}
if (source_code[i] == 32 and color) {
color = false;
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);
return error.SDLInitializationFailed;
}
}
else if (source_code[i] != 32 and !color) {
} else if (source_code[i] != 32 and !color) {
color = true;
const black_color_result = c.SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
if (black_color_result != 0) {