/* * XScrabble - X version of the popular board game, for 1 to 4 players. * * This software comes with NO warranty whatsoever. I therefore take no * responsibility for any damages, losses or problems caused through use * or misuse of this program. * * I hereby grant permission for this program to be freely copied and * distributed by any means, provided no charge is made for it. * * Matthew Chapman, csuoq@csv.warwick.ac.uk * Oct 1994. */ /* display.c - output functions for X interface */ #include "scrab.h" #include "globals.h" void ShowTiles() { char lname[2]; int ac,dn; for (dn=0; dn2) && (i<10)) { /* in central part of bar */ ch=player[ply].bar[i-3]; bar[ply][i]=ch; sprintf(lett,"%c",ch); if (ch==' ') XtVaSetValues(br[ply][i],SETBG(app_data.barcolor),XtNlabel,lett,NULL); else XtVaSetValues(br[ply][i],SETBG(app_data.tilecolor),XtNlabel,lett,NULL); } else { XtVaSetValues(br[ply][i],SETBG(app_data.barcolor),XtNlabel," ",NULL); bar[ply][i]=' '; } } } void ShowScores() { int i,rep; char scoretext[256]="",scstring[8]; for (i=0; i"); else strcat(scoretext," "); strcat(scoretext,player[i].name); sprintf(scstring,"%d",player[i].score); for (rep=0; rep<(int)(16-strlen(player[i].name)-strlen(scstring)); rep++) strcat(scoretext,"."); strcat(scoretext,scstring); if (i10000) { char mess[256]; XtVaSetValues(pauseButton[curr_player], XtNmappedWhenManaged,False,NULL); XBell(dpy[curr_player],2*bell_level-100); sprintf(mess,PROMPT[OUT_TIME_ALL],player[curr_player].name); Message(curr_player,PROMPT[OUT_TIME],mess); Deselect(curr_player); RemoveFromBoard(); ShowTiles(); ShowBar(curr_player); num_passed=0; if (waiting_for_change) { XtPopdown(changeshell); XtDestroyWidget(changeshell); waiting_for_change=False; } if (waiting_for_blank) { XtPopdown(blankshell); XtDestroyWidget(blankshell); waiting_for_blank=False; } GotoNextPlayer(); } else { XtVaSetValues(timeleft[curr_player],XtNpercentageCompleted, comp,NULL); XtAppAddTimeOut(app_context,55*time_limit,Click, timeleft[curr_player]); } } } void MessageAll(char *mess) { /* send same message to everyone */ int i; for (i=0; i