3 define GREEN = Color { 0,128,0 };
4 define BLUE = Color { 0,0,128 };
5 define PINK = Color { 128,64,64 };
6 define VIOLET = Color { 128,0,128 };
7 define ORANGE = Color { 255,128,0 };
8 define PURPLE = Color { 255,0,128 };
9 define CYAN = Color { 0,255,255 };
10 define RED = Color { 192,0,0 };
17 borderStyle = fixed, hasVertScroll = true, text = "The Scores", anchor = Anchor { horz = 0.3, vert = 0.1 }, clientSize = Size { 316,441 };
21 SetScrollLineStep(1, 20);
22 SetScrollArea(1, 102 * 20, true);
26 void OnResize(int w, int h)
28 vertScroll.pageStep = 400;
31 void ShowScore(Surface surface, int x, int y, int score, int r)
36 sprintf(temp,"(%d)",-score);
37 surface.SetForeground((r % 2) ? RED : ORANGE);
41 sprintf(temp,"%d",score);
42 surface.SetForeground((r % 2) ? black : white);
44 surface.CenterTextf(x,y,temp);
47 void OnRedraw(Surface surface)
51 Ruff ruff = (Ruff)master;
55 int scoreScroll = vertScroll.thumbPosition / 20;
57 surface.SetBackground(BLUE);
58 surface.Area(1,1,49,39);
60 surface.SetBackground(BLUE);
61 surface.Area(151,1,199,39);
64 surface.SetBackground(CYAN);
65 surface.Area(51,1,149,39);
66 surface.Area(201,1,299,39);
68 surface.CenterTextf(100,0,ruff.game.players[0].name);
69 surface.CenterTextf(250,0,ruff.game.players[1].name);
70 surface.CenterTextf(100,20,ruff.game.players[2].name);
71 surface.CenterTextf(250,20,ruff.game.players[3].name);
75 Round * round = &ruff.game.rounds[r + scoreScroll];
76 int shuffle = (ruff.game.rounds[0].shuffle + r + scoreScroll) % 4;
79 surface.SetBackground(PINK);
80 surface.Area(1,41+r*20,24,59+r*20);
81 surface.SetBackground(VIOLET);
82 surface.Area(26,41+r*20,49,59+r*20);
85 surface.SetBackground(white);
87 surface.SetBackground(GREEN);
88 surface.Area(51,41+r*20,149,59+r*20);
89 surface.Area(201,41+r*20,299,59+r*20);
91 surface.SetBackground(((r+scoreScroll)%2) ? PURPLE : ORANGE);
92 surface.Area(151,41+r*20,174,59+r*20);
93 surface.SetBackground(((r+scoreScroll)%2) ? ORANGE : PURPLE);
94 surface.Area(176,41+r*20,199,59+r*20);
97 surface.SetForeground(white);
98 surface.CenterTextf(12,40+r*20,"%d",(r+scoreScroll)+1);
101 surface.CenterTextf(37,40+r*20,"%c",ruff.game.players[shuffle].name[0]);
104 if(r + scoreScroll < ruff.game.round ||
105 (r + scoreScroll == ruff.game.round && !ruff.game.betting && ruff.game.gameStarted))
107 int x = (round->bet.player%2) ? 188 : 162;
109 if(round->bet.howMuch == RUFF)
111 surface.SetForeground(Color{ 0,0,192 });
112 surface.CenterTextf(x, y, "R");
116 surface.SetForeground(white);
117 if(round->bet.howMuch==100)
118 surface.CenterTextf(x, y, "C");
120 surface.CenterTextf(x, y, "%d",round->bet.howMuch);
126 for(r=0; r<scoreScroll; r++)
128 Round * round = &ruff.game.rounds[r];
129 scores[0] += round->scores[0];
130 scores[1] += round->scores[1];
132 for(r=scoreScroll; r<ruff.game.round+1; r++)
134 Round * round = &ruff.game.rounds[r];
135 scores[0] += round->scores[0];
136 scores[1] += round->scores[1];
138 if(r < ruff.game.round ||
139 (r == ruff.game.round && !ruff.game.betting && ruff.game.gameStarted))
142 if(r < ruff.game.round)
144 surface.SetBackground(RED);
145 if((scores[0] >= 500 || scores[1] >= 500) && scores[0] != scores[1])
147 if(scores[0] > scores[1])
148 surface.Area(51,41+(r-scoreScroll)*20,149,59+(r-scoreScroll)*20);
150 surface.Area(201,41+(r-scoreScroll)*20,299,59+(r-scoreScroll)*20);
155 ShowScore(surface, 75, 40 + (r-scoreScroll) * 20, round->scores[0], r);
156 ShowScore(surface, 225, 40 + (r-scoreScroll) * 20, round->scores[1], r);
159 if(r<ruff.game.round)
162 ShowScore(surface, 125, 40 + (r-scoreScroll) * 20, scores[0], r);
163 ShowScore(surface, 275, 40 + (r-scoreScroll) * 20, scores[1], r);
169 void OnVScroll(ScrollBarAction action, int position, Key key)