Commit 10ed6dd2 authored by Bruno Freitas Tissei's avatar Bruno Freitas Tissei
Browse files

Adicionado cores

parent 61e853a0
......@@ -25,6 +25,34 @@ void readFileMap(map *m, char *path) {
m->grid[j][i] = input[j];
}
}
start_color();
init_color(COLOR_WHITE, 700, 700, 700);
init_color(COLOR_BLACK, 0, 0, 0);
init_color(COLOR_RED, 556, 276, 76);
init_color(COLOR_YELLOW, 980, 888, 716);
init_color(COLOR_GREEN, 400, 400, 400);
init_color(COLOR_BLUE, 300, 300, 300);
init_color(COLOR_MAGENTA, 600, 0, 600);
// dirt color
init_pair(1, COLOR_BLACK, COLOR_RED);
// rock yellow color 1
init_pair(2, COLOR_YELLOW, COLOR_BLACK);
// rock gray color 1
init_pair(3, COLOR_BLACK, COLOR_GREEN);
// rock yellow color 2
init_pair(8, COLOR_BLACK, COLOR_YELLOW);
// rock gray color 2
init_pair(9, COLOR_BLACK, COLOR_GREEN);
// wall color
init_pair(4, COLOR_BLACK, COLOR_WHITE);
// steel color
init_pair(5, COLOR_WHITE, COLOR_BLUE);
// rockford color
init_pair(6, COLOR_MAGENTA, COLOR_BLACK);
// diamond color
init_pair(7, COLOR_YELLOW, COLOR_BLACK);
fclose(m->sprite);
}
......@@ -40,39 +68,64 @@ void renderMap(map *m) {
for (j = 0; j < HEIGHT; j++) {
switch (m->grid[i][j]) {
case('1'):
attron(COLOR_PAIR(5));
for (k = 0; k < 3; k++)
for (l = 0; l < 4; l++)
mvprintw(3*j+k+1, 4*i+l+1, "%c", steel[k][l]);
attroff(COLOR_PAIR(5));
break;
case('2'):
attron(COLOR_PAIR(1));
for (k = 0; k < 3; k++)
for (l = 0; l < 4; l++)
mvprintw(3*j+k+1, 4*i+l+1, "%c", dirt[k][l]);
attroff(COLOR_PAIR(1));
break;
case('3'):
attron(COLOR_PAIR(4));
for (k = 0; k < 3; k++)
for (l = 0; l < 4; l++)
mvprintw(3*j+k+1, 4*i+l+1, "%c", wall[k][l]);
attroff(COLOR_PAIR(4));
break;
case('4'):
attron(COLOR_PAIR(5));
for (k = 0; k < 3; k++)
for (l = 0; l < 4; l++)
mvprintw(3*j+k+1, 4*i+l+1, "%c", ext[k][l]);
attroff(COLOR_PAIR(5));
break;
case('5'):
attron(COLOR_PAIR(6));
for (k = 0; k < 3; k++)
for (l = 0; l < 4; l++)
mvprintw(3*j+k+1, 4*i+l+1, "%c", rockf[k][l]);
attroff(COLOR_PAIR(6));
break;
case('6'):
for (k = 0; k < 3; k++)
for (l = 0; l < 4; l++)
mvprintw(3*j+k+1, 4*i+l+1, "%c", bould[k][l]);
for (l = 0; l < 4; l++) {
if ((l == 1 ||l == 2) && (k == 2)) {
attron(COLOR_PAIR(3));
mvprintw(3*j+k+1, 4*i+l+1, "%c", bould[k][l]);
attroff(COLOR_PAIR(3));
} else if ((l == 1 || l == 2) && (k == 0)) {
attron(COLOR_PAIR(8));
mvprintw(3*j+k+1, 4*i+l+1, "%c", bould[k][l]);
attroff(COLOR_PAIR(8));
} else if (k != 0 && k != 2) {
attron(COLOR_PAIR(3));
mvprintw(3*j+k+1, 4*i+l+1, "%c", bould[k][l]);
attroff(COLOR_PAIR(3));
}
}
break;
case('7'):
attron(COLOR_PAIR(7));
for (k = 0; k < 3; k++)
for (l = 0; l < 4; l++)
mvprintw(3*j+k+1, 4*i+l+1, "%c", diamond[k][l]);
attroff(COLOR_PAIR(7));
break;
case('8'):
for (k = 0; k < 3; k++)
......
......@@ -3,7 +3,7 @@
#include "utils.h"
#include <sys/time.h>
#define NANO 1000000000.0
#define FPS 1.0/24.0
#define FPS 1.0/10.0
double getTime();
......
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