5 const char * OnGetString(char * string, void * fieldData, bool * needClass)
9 case clubs: strcpy(string, "clubs"); break;
10 case diamonds: strcpy(string, "diamonds"); break;
11 case hearts: strcpy(string, "hearts"); break;
12 case spades: strcpy(string, "spades"); break;
13 default: strcpy(string, "None");
18 void OnDisplay(Surface surface, int x, int y, int width, TrumpDialog trumpDialog, Alignment alignment, DataDisplayFlags flags)
20 Bitmap icon = (this != none) ? trumpDialog.icons[this].bitmap : null;
23 int xStart = icon ? (icon.width + 8) : ((trumpDialog.icons[0].bitmap ? trumpDialog.icons[0].bitmap.width : 0) + 8);
26 OnGetString(name, trumpDialog, null);
29 surface.TextExtent(name, len, &w, &h);
30 surface.WriteText(xStart, y, name, len);
32 // Draw the current row stipple
35 surface.Area(xStart - 3, y, xStart - 3, y + h - 1);
36 surface.Area(xStart + w - 1, y, xStart + w + 1, y + h - 1);
38 if(flags.current && flags.active)
40 surface.LineStipple(0x5555);
42 surface.SetForeground(Color { 255, 255, 128 });
44 surface.SetForeground(black);
45 surface.Rectangle(xStart - 3, y, xStart + w + 1, y + h - 1);
46 surface.LineStipple(0);
51 surface.SetForeground(white);
52 surface.Blit(icon, x,y,0,0, icon.width, icon.height);
57 class TrumpDialog : Window
59 background = activeBorder;
63 size = Size { 200, 94 };
64 anchor = Anchor { vert = -28 };
66 BitmapResource icons[Kind];
68 DataField field { "Trump", userData = this };
71 this, text = "OK", isDefault = true, anchor = Anchor { top = 40 }, size = Size { 80 }, hotKey = altO;
73 bool NotifyClicked(Button button, int x, int y, Modifiers mods)
75 Kind trump = (Kind)trumpDrop.GetTag(null);
76 //Kind trump = trumpDrop.GetData(null);
83 this, noHighlight = true, size = Size { 140 }, anchor = Anchor { top = 10 }
90 trumpDrop.AddField(field);
91 row = trumpDrop.AddRow(); row.tag = Kind::none; row.SetData(null, none);
92 row = trumpDrop.AddRow(); row.tag = Kind::clubs; row.SetData(null, clubs);
93 row = trumpDrop.AddRow(); row.tag = Kind::diamonds; row.SetData(null, diamonds);
94 row = trumpDrop.AddRow(); row.tag = Kind::hearts; row.SetData(null, hearts);
95 row = trumpDrop.AddRow(); row.tag = Kind::spades; row.SetData(null, spades);
97 AddResource(icons[clubs] = BitmapResource { ":clubs.png" });
98 AddResource(icons[diamonds] = BitmapResource { ":diamonds.png" });
99 AddResource(icons[hearts] = BitmapResource { ":hearts.png" });
100 AddResource(icons[spades] = BitmapResource { ":spades.png" });
105 RuffGame * game = &((Ruff)master).game;
107 trumpDrop.Activate();
108 AI_ComputeBet(&game->players[game->turn]);
110 trumpDrop.currentRow = trumpDrop.FindRow(game->players[game->turn].trump);