X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=rack-fancy.c;h=f2caa13adae6daa53bd43cf896903fda61598dde;hb=843863bc5725d169a5cb6da0a392d9398651cd51;hp=63677da3d52594a37b995256854ccfca8ea5a2ca;hpb=4a18152043dd8fa417e5b8db7047de2e3998da7b;p=wordgame diff --git a/rack-fancy.c b/rack-fancy.c index 63677da..f2caa13 100644 --- a/rack-fancy.c +++ b/rack-fancy.c @@ -27,6 +27,7 @@ #include "word-game.h" #include "demo-item.h" +#define RACK_DICT_ENTRY_FOUND (1<<1) #define MAX_TILES 7 typedef struct _tile @@ -77,14 +78,20 @@ typedef struct _dict_paint_cursor } dict_paint_cursor_t; static void -dict_paint_action (void *closure, char *word) +dict_paint_action (void *closure, char *word, dict_entry_t *entry) { dict_paint_cursor_t *cursor = closure; cairo_t *cr = cursor->cr; double new_x, new_y; cairo_move_to (cr, cursor->x, cursor->y); - cairo_show_text (cr, word); + if (*entry & RACK_DICT_ENTRY_FOUND) { + cairo_show_text (cr, word); + } else { + int i, length = strlen (word); + for (i = 0; i < length; i++) + cairo_show_text (cr, "_"); + } cairo_get_current_point (cr, &new_x, &new_y); if (new_x > cursor->max_column_width) cursor->max_column_width = new_x; @@ -313,10 +320,12 @@ on_key_press_event (GtkWidget *widget, if (event->keyval == GDK_Return) { dict_entry_t *entry; entry = dict_lookup (rack->solution, rack->guess); - if (DICT_ENTRY_IS_WORD (entry)) + if (DICT_ENTRY_IS_WORD (entry)) { + *entry = *entry | RACK_DICT_ENTRY_FOUND; printf ("%s is good\n", rack->guess); - else + } else { printf ("%s is not a word\n", rack->guess); + } rack_return_all (rack); return TRUE; }