Commit 4764ac71 authored by Bruno Freitas Tissei's avatar Bruno Freitas Tissei
Browse files

Adcionado highscore

parent a66b3339
......@@ -17,7 +17,9 @@ typedef struct {
typedef struct {
FILE *sprite;
FILE *highscore;
char grid[WIDTH][HEIGHT];
int high;
} menu;
#endif
......@@ -7,7 +7,9 @@ int menuaction;
void run(int ismenu, int running) {
double last_time, current_time, delta = FPS;
int sleep_time, action = 0, s = 0;
me.highscore = fopen("./data/highscore.txt", "r");
fscanf(me.highscore, "%d", &me.high);
last_time = getTime() / NANO;
readFileMap(&level);
readFileMenu(&me);
......
......@@ -182,31 +182,15 @@ void renderMap(map *m, int time) {
attroff(COLOR_PAIR(5));
break;
case('2'):
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", dirt[k][l]);
attroff(COLOR_PAIR(1));
renderChar(dirt, i, j, offx, offy, 1);
break;
case('z'):
attron(COLOR_PAIR(4));
for (k = 0; k < 3; k++)
for (l = 0; l < 6; l++)
mvprintw(3*j+k+offy, 6*i+l+offx, "%c", wall[k][l]);
attroff(COLOR_PAIR(4));
renderChar(wall, i, j, offx, offy, 4);
case('w'):
attron(COLOR_PAIR(4));
for (k = 0; k < 3; k++)
for (l = 0; l < 6; l++)
mvprintw(3*j+k+offy, 6*i+l+offx, "%c", wall2[k][l]);
attroff(COLOR_PAIR(4));
break; break;
renderChar(wall2, i, j, offx, offy, 4);
break;
case('4'):
attron(COLOR_PAIR(5));
for (k = 0; k < 3; k++)
for (l = 0; l < 6; l++)
mvprintw(3*j+k+offy, 6*i+l+offx, "%c", ext[k][l]);
attroff(COLOR_PAIR(5));
renderChar(ext, i, j, offx, offy, 5);
break;
case('5'):
attron(COLOR_PAIR(6));
......@@ -257,9 +241,7 @@ void renderMap(map *m, int time) {
attroff(COLOR_PAIR(7));
break;
case('8'):
for (k = 0; k < 3; k++)
for (l = 0; l < 6; l++)
mvprintw(3*j+k+offy, 6*i+l+offx, "%c", butterfly[k][l]);
renderChar(butterfly, i, j, offx, offy, 5);
break;
case('f'):
for (k = 0; k < 3; k++)
......
......@@ -49,32 +49,25 @@ int updateMenu(menu *menu, int action) {
}
void renderMenu(menu *menu){
int i, j, k, l;
mvprintw(0, 0, "%c", 'a');
int i, j;
/*menu->grid[31][0] = ((menu->high / 100000) % 10) + 'A';
menu->grid[32][0] = ((menu->high / 10000) % 10) + 'A';
menu->grid[33][0] = ((menu->high / 1000) % 10) + 'A';
menu->grid[34][0] = ((menu->high / 100) % 10) + 'A';
menu->grid[35][0] = ((menu->high / 10) % 10) + 'A';
menu->grid[36][0] = (menu->high % 10) + '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));
renderChar(empty, i, j, offmenux, offmenuy, 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));
renderChar(empty, i, j, offmenux, offmenuy, 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));
renderChar(empty, i, j, offmenux, offmenuy, 3);
break;
case('h'):
renderChar(H, i, j, offmenux, offmenuy, 2);
......
#include "utils.h"
char empty[3][6] = {" ", " ", " "};
char one[3][6] = {" ", " -| ", " _|_ "};
char two[3][6] = {" __ ", " __] ", " |__ "};
char three[3][6] = {" __ ", " __] ", " __] "};
......
......@@ -13,6 +13,7 @@
#define MAPVALUE 1
char empty[3][6];
char one[3][6];
char two[3][6];
char three[3][6];
......
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