Skip to content

Commit

Permalink
move logo ascii into source code to make executable standalone
Browse files Browse the repository at this point in the history
  • Loading branch information
EwanMe committed Jan 7, 2023
1 parent 19300c4 commit 451f38b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 34 deletions.
17 changes: 0 additions & 17 deletions img/logo.txt

This file was deleted.

3 changes: 0 additions & 3 deletions img/toast.txt

This file was deleted.

41 changes: 27 additions & 14 deletions toast.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,25 @@
#define TP_COL_W 6
#define TMP_PREC 1

char toast_logo[] = "\
.,,,,,,,,,,,,,,,#&&&&&&&&,,,,. \n\
,,,&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&,, \n\
,&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&,,* \n\
,,&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&%,,%\n\
.,&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&,,,%\n\
,,&&&&&&&&&&&&&&&&&&&&&&&&&&,,,&&&&&&&&,,,,%\n\
,,&&&&&&&&,,,&&&&&&&&&&&&&&&&&&&&&&&,,,%% \n\
,,&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&,,,%. \n\
,,&&&&&&&&&&&&&&&&&&&,&&&&&&&&&&&&*,,% \n\
,&&&&&&&&&&&&,,&&&&*,&&&&&&&&&&&&&,,% \n\
,&&&&&&&&&&&&&&&,,*&&&&&&&&&&&&&&&,,,% \n\
,&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&,,,% \n\
,,&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&,,,% \n\
,,&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&(,,% \n\
,&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&,,,% \n\
,&&&&&&&&/,,,,,,,,,,,,,,,,,,,,,,,,,,% \n\
,,,,,,,,,,(%%%%%%%%%%%%%(,,,,,,,.." ;

struct curses_info {
WINDOW *window;
int old_cursor;
Expand Down Expand Up @@ -70,25 +89,18 @@ int get_num_thermal_zones() {
}

void print_logo() {
FILE* f = fopen("./img/logo.txt", "r");
if (f == NULL) {
perror("Could not read logo file");
}

char *line = NULL;
size_t len = 0;
ssize_t read;
attron(COLOR_PAIR(PRIM_COLOR));

int i = 0;
char *line = strtok(toast_logo, "\n");

attron(COLOR_PAIR(PRIM_COLOR));
while ((read = getline(&line, &len, f)) != -1) {
while (line != NULL) {
mvprintw(i + 1, 40, "%s", line);
i++;
line = strtok(NULL, "\n");
i++;
}
attroff(COLOR_PAIR(PRIM_COLOR));

fclose(f);
if (line) free(line);
attroff(COLOR_PAIR(PRIM_COLOR));
}

void print_header() {
Expand Down Expand Up @@ -200,4 +212,5 @@ int main() {

stop_curses();
cleanup();
return 0;
}

0 comments on commit 451f38b

Please sign in to comment.