highlight letter value
authorMazet Laurent <mazet@softndesign.org>
Thu, 6 Jun 2024 05:41:12 +0000 (07:41 +0200)
committerMazet Laurent <mazet@softndesign.org>
Thu, 6 Jun 2024 05:41:12 +0000 (07:41 +0200)
display.c
display.h
scrabble.c

index dee09c8cc81c9b813a0e26de631ca3b1c9d5406a..df37cc4edc46428a8214eae4062baf75023f12e5 100644 (file)
--- a/display.c
+++ b/display.c
@@ -153,7 +153,7 @@ void helpwindow (char *msg, char *msg2, int xoffset, int yoffset, int length)
     j += _helpwindow (msg2, xoffset, yoffset + j, length);
 }
 
-void valuewindow (bag_t *bag, int xoffset, int yoffset, int length)
+void valuewindow (bag_t *bag, int xoffset, int yoffset, int length, char current)
 {
     char *title = "Tile values";
     int i;
@@ -168,7 +168,7 @@ void valuewindow (bag_t *bag, int xoffset, int yoffset, int length)
     for (i = 0; i < bag->nbletters; i++) {
         int x = xoffset + (i % 2) + 5 * (i / N);
         int y = yoffset + 2 + (i % N);
-        set_color (black);
+        set_color (((bag->lettervalues + i)->letter == current) ? yellow : black);
         mvaddch (y, x, (bag->lettervalues + i)->letter);
         set_color (white);
         char msg[3];
index 01be18bb74984da87b2971a7014c9bea4f486459..85d754b341338bfb23542dc708c51cf85325cbfd 100644 (file)
--- a/display.h
+++ b/display.h
@@ -11,7 +11,7 @@ void showboard (play_t *play, board_t *board, int xoffset, int yoffset, int full
 
 void helpwindow (char *msg, char *msg2, int xoffset, int yoffset, int length);
 
-void valuewindow (bag_t *bag, int xoffset, int yoffset, int length);
+void valuewindow (bag_t *bag, int xoffset, int yoffset, int length, char current);
 
 void drawwindow (draw_t *game, int xoffset, int yoffset);
 
index 73908b57c4612fbc97cb018e05549e0e151d0ce8..3c64e54da73fea3872b0db73d6ff66ed2b375441 100644 (file)
@@ -147,7 +147,6 @@ int main (int argc, char *argv[])
     int xdrawwin = xoffset;
     int ydrawwin = 2 * yoffset + max (board->ysize, 1 + (bag->nbletters + 1) /2);
 
-    valuewindow (bag, xvaluewin, yvaluewin, 10);
     helpwindow (help, getextrahelp (language), xhelpwin, yhelpwin, 30);
 
     int mode = 0;
@@ -160,12 +159,12 @@ int main (int argc, char *argv[])
     drawwindow (game, xdrawwin, ydrawwin);
     int stop = 0;
     while (!stop) {
-        current = gessletter (play, x, y);
+        char highlight = current = gessletter (play, x, y);
         if (current == ' ') {
-            showletter (letter, x + xoffset, y + yoffset, 1);
-        } else {
-            showletter (current, x + xoffset, y + yoffset, 0);
+            highlight = letter;
         }
+        showletter (highlight, x + xoffset, y + yoffset, 1);
+        valuewindow (bag, xvaluewin, yvaluewin, 10, highlight);
 
         switch (getch ()) {
         case '\t':