Added "color" retaining transparancy. Pixels are now drawn solid

This commit is contained in:
Sheldon Lee
2020-06-18 22:26:14 +01:00
parent 5a8285eb31
commit 59f7bfa061
2 changed files with 22 additions and 8 deletions
+8 -2
View File
@@ -96,10 +96,16 @@ void drawGrid(Grid* grid)
unsigned int width, height;
width = grid->width;
height = grid->size/width;
// Init color pair init_pair(index, fg, bg);
init_pair(1, COLOR_BLUE, COLOR_WHITE);
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
if (grid->state[toIndex(grid, x, y)]) mvprintw(y, x, "X");
else mvprintw(y, x, " ");
if (grid->state[toIndex(grid, x, y)]){
attron(COLOR_PAIR(1));
mvaddch(y, x, ' ');
attroff(COLOR_PAIR(1));
}
else mvaddch(y, x, ' ');
}
}
}