Commit bf1ed148 authored by Bruno Freitas Tissei's avatar Bruno Freitas Tissei
Browse files

Correção menu

parent 3a0b98fa
......@@ -10,6 +10,7 @@ void run(int ismenu, int running) {
last_time = getTime() / NANO;
readFileMap(&level);
readFileMenu(&me);
while (running) {
current_time = getTime() / NANO;
if (current_time >= last_time) {
......
......@@ -380,37 +380,37 @@ void renderMap(map *m, int time) {
}
break;
case('A'):
renderChar(zero, i, j, offx, offy);
renderChar(zero, i, j, offx, offy, 9);
break;
case('B'):
renderChar(one, i, j, offx, offy);
renderChar(one, i, j, offx, offy, 9);
break;
case('C'):
renderChar(two, i, j, offx, offy);
renderChar(two, i, j, offx, offy, 9);
break;
case('D'):
renderChar(three, i, j, offx, offy);
renderChar(three, i, j, offx, offy, 9);
break;
case('E'):
renderChar(four, i, j, offx, offy);
renderChar(four, i, j, offx, offy, 9);
break;
case('F'):
renderChar(five, i, j, offx, offy);
renderChar(five, i, j, offx, offy, 9);
break;
case('G'):
renderChar(six, i, j, offx, offy);
renderChar(six, i, j, offx, offy, 9);
break;
case('H'):
renderChar(seven, i, j, offx, offy);
renderChar(seven, i, j, offx, offy, 9);
break;
case('I'):
renderChar(eight, i, j, offx, offy);
renderChar(eight, i, j, offx, offy, 9);
break;
case('J'):
renderChar(nine, i, j, offx, offy);
renderChar(nine, i, j, offx, offy, 9);
break;
case('K'):
renderChar(symbol, i, j, offx, offy);
renderChar(symbol, i, j, offx, offy, 9);
break;
}
......
......@@ -89,8 +89,8 @@ void readFileMenu(menu *menu) {
menu->sprite = fopen("./sprites/menu.txt", "r");
for (i = 0; i < 3; i++)
for (j = 0; j < 3; j++)
fscanf(menu->sprite, "%d", &menuColors[i][j]);
for (j = 0; j < 3; j++)
fscanf(menu->sprite, "%d", &menuColors[i][j]);
for (i = 0; i < HEIGHT; i++) {
fscanf(menu->sprite, "%s", input);
......@@ -99,6 +99,7 @@ void readFileMenu(menu *menu) {
}
}
fclose(menu->sprite);
setMenuColors();
getmaxyx(stdscr, row, col);
offmenuy = (row / 2) - (12 * 3);
......@@ -126,6 +127,7 @@ int updateMenu(menu *menu, int action) {
void renderMenu(menu *menu){
int i, j, k, l;
mvprintw(0, 0, "%c", 'a');
for (i = 0; i < WIDTH; i++) {
for (j = 0; j < HEIGHT; j++) {
switch (menu->grid[i][j]) {
......@@ -139,102 +141,102 @@ void renderMenu(menu *menu){
case('1'):
attron(COLOR_PAIR(2));
renderChar(one, i, j, offmenux, offmenuy);
renderChar(one, i, j, offmenux, offmenuy, 2);
attroff(COLOR_PAIR(2));
break;
case('2'):
attron(COLOR_PAIR(3));
renderChar(two, i, j, offmenux, offmenuy);
renderChar(two, i, j, offmenux, offmenuy, 3);
attroff(COLOR_PAIR(3));
break;
case('h'):
attron(COLOR_PAIR(2));
renderChar(H, i, j, offmenux, offmenuy);
renderChar(H, i, j, offmenux, offmenuy, 2);
attroff(COLOR_PAIR(2));
break;
case('i'):
attron(COLOR_PAIR(2));
renderChar(I, i, j, offmenux, offmenuy);
renderChar(I, i, j, offmenux, offmenuy, 2);
attroff(COLOR_PAIR(2));
break;
case('g'):
attron(COLOR_PAIR(2));
renderChar(G, i, j, offmenux, offmenuy);
renderChar(G, i, j, offmenux, offmenuy, 2);
attroff(COLOR_PAIR(2));
break;
case('s'):
attron(COLOR_PAIR(2));
renderChar(S, i, j, offmenux, offmenuy);
renderChar(S, i, j, offmenux, offmenuy, 2);
attroff(COLOR_PAIR(2));
break;
case('o'):
attron(COLOR_PAIR(2));
renderChar(zero, i, j, offmenux, offmenuy);
renderChar(zero, i, j, offmenux, offmenuy, 2);
attroff(COLOR_PAIR(2));
break;
case('r'):
attron(COLOR_PAIR(2));
renderChar(R, i, j, offmenux, offmenuy);
renderChar(R, i, j, offmenux, offmenuy, 2);
attroff(COLOR_PAIR(2));
break;
case('e'):
attron(COLOR_PAIR(2));
renderChar(E, i, j, offmenux, offmenuy);
renderChar(E, i, j, offmenux, offmenuy, 2);
attroff(COLOR_PAIR(2));
break;
case('l'):
attron(COLOR_PAIR(2));
renderChar(L, i, j, offmenux, offmenuy);
renderChar(L, i, j, offmenux, offmenuy, 2);
attroff(COLOR_PAIR(2));
break;
case('a'):
attron(COLOR_PAIR(2));
renderChar(A, i, j, offmenux, offmenuy);
renderChar(A, i, j, offmenux, offmenuy, 2);
attroff(COLOR_PAIR(2));
break;
case('t'):
attron(COLOR_PAIR(2));
renderChar(T, i, j, offmenux, offmenuy);
renderChar(T, i, j, offmenux, offmenuy, 2);
attroff(COLOR_PAIR(2));
break;
case('<'):
attron(COLOR_PAIR(2));
renderChar(SL, i, j, offmenux, offmenuy);
renderChar(SL, i, j, offmenux, offmenuy, 2);
attroff(COLOR_PAIR(2));
break;
case('>'):
attron(COLOR_PAIR(2));
renderChar(SR, i, j, offmenux, offmenuy);
renderChar(SR, i, j, offmenux, offmenuy, 2);
attroff(COLOR_PAIR(2));
break;
case('c'):
attron(COLOR_PAIR(2));
renderChar(C, i, j, offmenux, offmenuy);
renderChar(C, i, j, offmenux, offmenuy, 2);
attroff(COLOR_PAIR(2));
break;
case('v'):
attron(COLOR_PAIR(2));
renderChar(V, i, j, offmenux, offmenuy);
renderChar(V, i, j, offmenux, offmenuy, 2);
attroff(COLOR_PAIR(2));
break;
case('n'):
attron(COLOR_PAIR(2));
renderChar(N, i, j, offmenux, offmenuy);
renderChar(N, i, j, offmenux, offmenuy, 2);
attroff(COLOR_PAIR(2));
break;
}
......
......@@ -13,17 +13,12 @@ char zero[3][6] = {" __ ", " | | ", " |__| "};
char symbol[3][6] = {" ", " /##\\ ", " \\##/ "};
void renderChar(char mat[3][6], int i, int j, int offx, int offy) {
void renderChar(char mat[3][6], int i, int j, int offx, int offy, int color) {
int k, l;
for (k = 0; k < 3; k++)
for (l = 0; l < 6; l++)
if (i == 3 || i == 4 || i == 12 || i == 13) {
attron(COLOR_PAIR(2));
mvprintw(3*j+k+offy, 6*i+l+offx, "%c", mat[k][l]);
attroff(COLOR_PAIR(2));
} else {
attron(COLOR_PAIR(9));
mvprintw(3*j+k+offy, 6*i+l+offx, "%c", mat[k][l]);
attroff(COLOR_PAIR(9));
}
//if (i == 3 || i == 4 || i == 12 || i == 13) {
attron(COLOR_PAIR(color));
mvprintw(3*j+k+offy, 6*i+l+offx, "%c", mat[k][l]);
attroff(COLOR_PAIR(color));
}
......@@ -25,6 +25,6 @@ char nine[3][6];
char zero[3][6];
char symbol[3][6];
void renderChar(char mat[3][6], int i, int j, int offx, int offy);
void renderChar(char mat[3][6], int i, int j, int offx, int offy, int color);
#endif
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