Commit 13d064ac authored by Ivo Júnior's avatar Ivo Júnior
Browse files

Cores no Menu

parent 4d306dbd
......@@ -86,6 +86,10 @@ void readFileMenu(menu *menu) {
int i, j;
menu->sprite = fopen("./sprites/menu.txt", "r");
for (i = 0; i < 3; i++)
for (j = 0; j < 3; j++)
fscanf(menu->sprite, "%d", &colors[i][j]);
for (i = 0; i < HEIGHT; i++) {
fscanf(menu->sprite, "%s", input);
for (j = 0; j < WIDTH; j++) {
......@@ -99,86 +103,139 @@ void readFileMenu(menu *menu) {
offmenux = (col / 2) - (20 * 6);
}
void setColors() {
init_color(COLOR_WHITE, colors[0][0], colors[0][1], colors[0][2]);
init_color(COLOR_BLACK, colors[1][0], colors[1][1], colors[1][2]);
init_color(COLOR_BLUE, colors[2][0], colors[2][1], colors[2][2]);
// background
init_pair(1, COLOR_BLACK, COLOR_BLACK);
// objects
init_pair(2, COLOR_WHITE, COLOR_BLACK);
// background_smallbox
init_pair(3, COLOR_BLUE, COLOR_BLUE);
}
void renderMenu(){
for (i = 0; i < WIDTH; i++) {
for (j = 0; j < HEIGHT; j++) {
switch (m->grid[i][j]) {
case('0'):
attron(COLOR_PAIR(1));
for (k = 0; k < 3; k++)
for (l = 0; l < 6; l++)
mvprintw(3*j+k+offy, 6*i+l+offx, "%c", ' ');
attroff(COLOR_PAIR(1));
break;
case('1'):
attron(COLOR_PAIR(2));
renderChar(one, i, j, offmenux, offmenuy);
attroff(COLOR_PAIR(2));
break;
case('2'):
attron(COLOR_PAIR(3));
renderChar(two, i, j, offmenux, offmenuy);
attroff(COLOR_PAIR(3));
break;
case('h'):
attron(COLOR_PAIR(2));
renderChar(H, i, j, offmenux, offmenuy);
attroff(COLOR_PAIR(2));
break;
case('i'):
attron(COLOR_PAIR(2));
renderChar(I, i, j, offmenux, offmenuy);
attroff(COLOR_PAIR(2));
break;
case('g'):
attron(COLOR_PAIR(2));
renderChar(G, i, j, offmenux, offmenuy);
attroff(COLOR_PAIR(2));
break;
case('s'):
attron(COLOR_PAIR(2));
renderChar(S, i, j, offmenux, offmenuy);
attroff(COLOR_PAIR(2));
break;
case('c'):
attron(COLOR_PAIR(2));
renderChar(C, i, j, offmenux, offmenuy);
attroff(COLOR_PAIR(2));
break;
case('o'):
attron(COLOR_PAIR(2));
renderChar(zero, i, j, offmenux, offmenuy);
attroff(COLOR_PAIR(2));
break;
case('r'):
attron(COLOR_PAIR(2));
renderChar(R, i, j, offmenux, offmenuy);
attroff(COLOR_PAIR(2));
break;
case('e'):
attron(COLOR_PAIR(2));
renderChar(E, i, j, offmenux, offmenuy);
attroff(COLOR_PAIR(2));
break;
case('l'):
attron(COLOR_PAIR(2));
renderChar(L, i, j, offmenux, offmenuy);
attroff(COLOR_PAIR(2));
break;
case('a'):
attron(COLOR_PAIR(2));
renderChar(A, i, j, offmenux, offmenuy);
attroff(COLOR_PAIR(2));
break;
case('t'):
attron(COLOR_PAIR(2));
renderChar(T, i, j, offmenux, offmenuy);
attroff(COLOR_PAIR(2));
break;
case('<'):
attron(COLOR_PAIR(2));
renderChar(SL, i, j, offmenux, offmenuy);
attroff(COLOR_PAIR(2));
break;
case('>'):
attron(COLOR_PAIR(2));
renderChar(SR, i, j, offmenux, offmenuy);
attroff(COLOR_PAIR(2));
break;
case('c'):
attron(COLOR_PAIR(2));
renderChar(C, i, j, offmenux, offmenuy);
attroff(COLOR_PAIR(2));
break;
case('v'):
attron(COLOR_PAIR(2));
renderChar(V, i, j, offmenux, offmenuy);
attroff(COLOR_PAIR(2));
break;
case('n'):
attron(COLOR_PAIR(2));
renderChar(N, i, j, offmenux, offmenuy);
attroff(COLOR_PAIR(2));
break;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment