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

Menu imprimindo corretamente

parent bf1ed148
......@@ -19,18 +19,6 @@ char explosion[3][6] = {" ", " ## ", " "};
char explosion2[3][6] = {"\\\\||//", "--##--", "//||\\\\"};
char explosion3[3][6] = {"#%$@%@", "#@ ##", "&@*@*#"};
/*char one[3][6] = {" ", " -| ", " _|_ "};
char two[3][6] = {" __ ", " __] ", " |__ "};
char three[3][6] = {" __ ", " __] ", " __] "};
char four[3][6] = {" ", " /_| ", " | "};
char five[3][6] = {" __ ", " |__ ", " __] "};
char six[3][6] = {" __ ", " |__ ", " [__] "};
char seven[3][6] = {" ___ ", " / ", " / "};
char eight[3][6] = {" __ ", " [__] ", " [__] "};
char nine[3][6] = {" __ ", " [__] ", " _/ "};
char zero[3][6] = {" __ ", " | | ", " |__| "};
char symbol[3][6] = {" ", " /##\\ ", " \\##/ "};*/
int colors[7][3];
char input[WIDTH];
......@@ -380,34 +368,64 @@ void renderMap(map *m, int time) {
}
break;
case('A'):
renderChar(zero, i, j, offx, offy, 9);
if (i == 3 || i == 4 || i == 12 || i == 13)
renderChar(zero, i, j, offx, offy, 2);
else
renderChar(zero, i, j, offx, offy, 9);
break;
case('B'):
renderChar(one, i, j, offx, offy, 9);
if (i == 3 || i == 4 || i == 12 || i == 13)
renderChar(one, i, j, offx, offy, 2);
else
renderChar(one, i, j, offx, offy, 9);
break;
case('C'):
renderChar(two, i, j, offx, offy, 9);
if (i == 3 || i == 4 || i == 12 || i == 13)
renderChar(two, i, j, offx, offy, 2);
else
renderChar(two, i, j, offx, offy, 9);
break;
case('D'):
renderChar(three, i, j, offx, offy, 9);
if (i == 3 || i == 4 || i == 12 || i == 13)
renderChar(three, i, j, offx, offy, 2);
else
renderChar(three, i, j, offx, offy, 9);
break;
case('E'):
renderChar(four, i, j, offx, offy, 9);
if (i == 3 || i == 4 || i == 12 || i == 13)
renderChar(four, i, j, offx, offy, 2);
else
renderChar(four, i, j, offx, offy, 9);
break;
case('F'):
renderChar(five, i, j, offx, offy, 9);
if (i == 3 || i == 4 || i == 12 || i == 13)
renderChar(five, i, j, offx, offy, 2);
else
renderChar(five, i, j, offx, offy, 9);
break;
case('G'):
renderChar(six, i, j, offx, offy, 9);
if (i == 3 || i == 4 || i == 12 || i == 13)
renderChar(six, i, j, offx, offy, 2);
else
renderChar(six, i, j, offx, offy, 9);
break;
case('H'):
renderChar(seven, i, j, offx, offy, 9);
if (i == 3 || i == 4 || i == 12 || i == 13)
renderChar(seven, i, j, offx, offy, 2);
else
renderChar(seven, i, j, offx, offy, 9);
break;
case('I'):
renderChar(eight, i, j, offx, offy, 9);
if (i == 3 || i == 4 || i == 12 || i == 13)
renderChar(eight, i, j, offx, offy, 2);
else
renderChar(eight, i, j, offx, offy, 9);
break;
case('J'):
renderChar(nine, i, j, offx, offy, 9);
if (i == 3 || i == 4 || i == 12 || i == 13)
renderChar(nine, i, j, offx, offy, 2);
else
renderChar(nine, i, j, offx, offy, 9);
break;
case('K'):
renderChar(symbol, i, j, offx, offy, 9);
......
#include "menu.h"
/*char one[3][6] = {" ",
" -| ",
" _|_ "};
char two[3][6] = {" __ ",
" __] ",
" |__ "};
char three[3][6] = {" __ ",
" __] ",
" __] "};
char four[3][6] = {" ",
" /_| ",
" | "};
char five[3][6] = {" __ ",
" |__ ",
" __] "};
char six[3][6] = {" __ ",
" |__ ",
" [__] "};
char seven[3][6] = {" ___ ",
" / ",
" / "};
char eight[3][6] = {" __ ",
" [__] ",
" [__] "};
char nine[3][6] = {" __ ",
" [__] ",
" _/ "};
char zero[3][6] = {" __ ",
" | | ",
" |__| "};*/
char A[3][6] = {" __ ",
" |__| ",
" | | "};
char B[3][6] = {" __ ",
" | ) ",
" |__) "};
char C[3][6] = {" __ ",
" | ",
" |__ "};
char D[3][6] = {" __ ",
" | \\ ",
" |__/ "};
char E[3][6] = {" __ ",
" |__ ",
" |__ "};
char G[3][6] = {" __ ",
" | _ ",
" |__| "};
char H[3][6] = {" ",
" |__| ",
" | | "};
char I[3][6] = {" ___ ",
" | ",
" _|_ "};
char L[3][6] = {" ",
" | ",
" |__ "};
char N[3][6] = {" ",
" |\\ | ",
" | \\| "};
char R[3][6] = {" __ ",
" |__| ",
" | \\ "};
char S[3][6] = {" __ ",
" |__ ",
" __| "};
char T[3][6] = {" ___ ",
" | ",
" | "};
char V[3][6] = {" ",
" \\ / ",
" \\/ "};
char SL[3][6] = {" ",
" /___ ",
" \\ "};
char SR[3][6] = {" ",
" ___\\ ",
" / "};
int menuColors[3][3];
char input[WIDTH];
int offmenuy, offmenux;
......@@ -94,9 +15,8 @@ void readFileMenu(menu *menu) {
for (i = 0; i < HEIGHT; i++) {
fscanf(menu->sprite, "%s", input);
for (j = 0; j < WIDTH; j++) {
for (j = 0; j < WIDTH; j++)
menu->grid[j][i] = input[j];
}
}
fclose(menu->sprite);
setMenuColors();
......@@ -119,6 +39,9 @@ void setMenuColors() {
// background_smallbox
init_pair(3, COLOR_BLUE, COLOR_BLUE);
// all white
init_pair(4, COLOR_WHITE, COLOR_WHITE);
}
int updateMenu(menu *menu, int action) {
......@@ -129,117 +52,76 @@ 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]) {
case('0'):
attron(COLOR_PAIR(1));
for (k = 0; k < 3; k++)
for (l = 0; l < 6; l++)
mvprintw(3*j+k+offmenuy, 6*i+l+offmenux, "%c", ' ');
attroff(COLOR_PAIR(1));
break;
case('1'):
attron(COLOR_PAIR(2));
renderChar(one, i, j, offmenux, offmenuy, 2);
attroff(COLOR_PAIR(2));
break;
case('2'):
attron(COLOR_PAIR(3));
renderChar(two, i, j, offmenux, offmenuy, 3);
attroff(COLOR_PAIR(3));
break;
case('h'):
attron(COLOR_PAIR(2));
renderChar(H, i, j, offmenux, offmenuy, 2);
attroff(COLOR_PAIR(2));
break;
case('i'):
attron(COLOR_PAIR(2));
renderChar(I, i, j, offmenux, offmenuy, 2);
attroff(COLOR_PAIR(2));
break;
case('g'):
attron(COLOR_PAIR(2));
renderChar(G, i, j, offmenux, offmenuy, 2);
attroff(COLOR_PAIR(2));
break;
case('s'):
attron(COLOR_PAIR(2));
renderChar(S, i, j, offmenux, offmenuy, 2);
attroff(COLOR_PAIR(2));
break;
case('o'):
attron(COLOR_PAIR(2));
renderChar(zero, i, j, offmenux, offmenuy, 2);
attroff(COLOR_PAIR(2));
break;
case('r'):
attron(COLOR_PAIR(2));
renderChar(R, i, j, offmenux, offmenuy, 2);
attroff(COLOR_PAIR(2));
break;
case('e'):
attron(COLOR_PAIR(2));
renderChar(E, i, j, offmenux, offmenuy, 2);
attroff(COLOR_PAIR(2));
break;
case('l'):
attron(COLOR_PAIR(2));
renderChar(L, i, j, offmenux, offmenuy, 2);
attroff(COLOR_PAIR(2));
break;
case('a'):
attron(COLOR_PAIR(2));
renderChar(A, i, j, offmenux, offmenuy, 2);
attroff(COLOR_PAIR(2));
break;
case('t'):
attron(COLOR_PAIR(2));
renderChar(T, i, j, offmenux, offmenuy, 2);
attroff(COLOR_PAIR(2));
break;
case('<'):
attron(COLOR_PAIR(2));
renderChar(SL, i, j, offmenux, offmenuy, 2);
attroff(COLOR_PAIR(2));
break;
case('>'):
attron(COLOR_PAIR(2));
renderChar(SR, i, j, offmenux, offmenuy, 2);
attroff(COLOR_PAIR(2));
break;
case('c'):
attron(COLOR_PAIR(2));
renderChar(C, i, j, offmenux, offmenuy, 2);
attroff(COLOR_PAIR(2));
break;
case('v'):
attron(COLOR_PAIR(2));
renderChar(V, i, j, offmenux, offmenuy, 2);
attroff(COLOR_PAIR(2));
break;
case('n'):
attron(COLOR_PAIR(2));
renderChar(N, i, j, offmenux, offmenuy, 2);
attroff(COLOR_PAIR(2));
break;
}
for (j = 0; j < HEIGHT; j++) {
switch (menu->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+offmenuy, 6*i+l+offmenux, "%c", ' ');
attroff(COLOR_PAIR(1));
break;
case('1'):
attron(COLOR_PAIR(4));
for (k = 0; k < 3; k++)
for (l = 0; l < 6; l++)
mvprintw(3*j+k+offmenuy, 6*i+l+offmenux, "%c", ' ');
attroff(COLOR_PAIR(4));
break;
case('2'):
attron(COLOR_PAIR(3));
for (k = 0; k < 3; k++)
for (l = 0; l < 6; l++)
mvprintw(3*j+k+offmenuy, 6*i+l+offmenux, "%c", ' ');
attroff(COLOR_PAIR(3));
break;
case('h'):
renderChar(H, i, j, offmenux, offmenuy, 2);
break;
case('i'):
renderChar(I, i, j, offmenux, offmenuy, 2);
break;
case('g'):
renderChar(G, i, j, offmenux, offmenuy, 2);
break;
case('s'):
renderChar(S, i, j, offmenux, offmenuy, 2);
break;
case('o'):
renderChar(zero, i, j, offmenux, offmenuy, 2);
break;
case('r'):
renderChar(R, i, j, offmenux, offmenuy, 2);
break;
case('e'):
renderChar(E, i, j, offmenux, offmenuy, 2);
break;
case('l'):
renderChar(L, i, j, offmenux, offmenuy, 2);
break;
case('a'):
renderChar(A, i, j, offmenux, offmenuy, 2);
break;
case('t'):
renderChar(T, i, j, offmenux, offmenuy, 2);
break;
case('<'):
renderChar(SL, i, j, offmenux, offmenuy, 2);
break;
case('>'):
renderChar(SR, i, j, offmenux, offmenuy, 2);
break;
case('c'):
renderChar(C, i, j, offmenux, offmenuy, 2);
break;
case('v'):
renderChar(V, i, j, offmenux, offmenuy, 2);
break;
case('n'):
renderChar(N, i, j, offmenux, offmenuy, 2);
break;
}
}
}
}
......@@ -11,14 +11,29 @@ char eight[3][6] = {" __ ", " [__] ", " [__] "};
char nine[3][6] = {" __ ", " [__] ", " _/ "};
char zero[3][6] = {" __ ", " | | ", " |__| "};
char symbol[3][6] = {" ", " /##\\ ", " \\##/ "};
char A[3][6] = {" __ ", " |__| ", " | | "};
char B[3][6] = {" __ ", " | ) ", " |__) "};
char C[3][6] = {" __ ", " | ", " |__ "};
char D[3][6] = {" __ ", " | \\ ", " |__/ "};
char E[3][6] = {" __ ", " |__ ", " |__ "};
char G[3][6] = {" __ ", " | _ ", " |__| "};
char H[3][6] = {" ", " |__| ", " | | "};
char I[3][6] = {" ___ ", " | ", " _|_ "};
char L[3][6] = {" ", " | ", " |__ "};
char N[3][6] = {" ", " |\\ | ", " | \\| "};
char R[3][6] = {" __ ", " |__| ", " | \\ "};
char S[3][6] = {" __ ", " |__ ", " __| "};
char T[3][6] = {" ___ ", " | ", " | "};
char V[3][6] = {" ", " \\ / ", " \\/ "};
char SL[3][6] = {" ", " /___ ", " \\ "};
char SR[3][6] = {" ", " ___\\ ", " / "};
void renderChar(char mat[3][6], int i, int j, int offx, int offy, int color) {
int k, l;
attron(COLOR_PAIR(color));
for (k = 0; k < 3; k++)
for (l = 0; l < 6; l++)
//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));
attroff(COLOR_PAIR(color));
}
......@@ -24,6 +24,22 @@ char eight[3][6];
char nine[3][6];
char zero[3][6];
char symbol[3][6];
char A[3][6];
char B[3][6];
char C[3][6];
char D[3][6];
char E[3][6];
char G[3][6];
char H[3][6];
char I[3][6];
char L[3][6];
char N[3][6];
char R[3][6];
char S[3][6];
char T[3][6];
char V[3][6];
char SL[3][6];
char SR[3][6];
void renderChar(char mat[3][6], int i, int j, int offx, int offy, int color);
......
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