void mouseHover(struct game *g) { int clickedx, clickedy; if (!get_mousecoords(g, &clickedx, &clickedy)) { change_preview_visible(g, false); g->marked = false; redraw_field(g); return; } // falling tetramino g->marked = false; if (check_fallingtmino(g, clickedx, clickedy)) { mark_tmino(g, clickedx, clickedy); unmark_background(g); change_preview_visible(g, false); } else if (!fits_preview(g, clickedx, clickedy) && check_background(g, clickedx, clickedy)) { unmark_background(g); mark_background(g, clickedx, clickedy); change_preview_visible(g, false); } else { unmark_background(g); change_preview_visible(g, true); } redraw_field(g); }
// Print shell prompt. void prompt() { char *dirName = malloc(sizeof(char) * 256); getcwd(dirName, 256); // Check for any background jobs that have finished. check_background(); // Print the prompt. printf(ANSI_COLOR_GREEN "itsh" ANSI_COLOR_RESET ":" ANSI_COLOR_BLUE "%s" ANSI_COLOR_RESET "# ", dirName); free(dirName); }