]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/menu/xonotic/dialog_firstrun.c
before I do a language selector: a first-run dialog that asks for player name
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / dialog_firstrun.c
1 #ifdef INTERFACE
2 CLASS(XonoticFirstRunDialog) EXTENDS(XonoticRootDialog)
3         METHOD(XonoticFirstRunDialog, fill, void(entity)) // to be overridden by user to fill the dialog with controls
4         ATTRIB(XonoticFirstRunDialog, title, string, _("Welcome"))
5         ATTRIB(XonoticFirstRunDialog, color, vector, SKINCOLOR_DIALOG_FIRSTRUN)
6         ATTRIB(XonoticFirstRunDialog, intendedWidth, float, 0.6)
7         ATTRIB(XonoticFirstRunDialog, rows, float, 11)
8         ATTRIB(XonoticFirstRunDialog, columns, float, 3)
9         ATTRIB(XonoticFirstRunDialog, name, string, "FirstRun")
10         ATTRIB(XonoticFirstRunDialog, playerNameLabel, entity, NULL)
11         ATTRIB(XonoticFirstRunDialog, playerNameLabelAlpha, float, 0)
12
13         ATTRIB(XonoticFirstRunDialog, closable, float, 0)
14 ENDCLASS(XonoticFirstRunDialog)
15 #endif
16
17 #ifdef IMPLEMENTATION
18 void XonoticFirstRunDialog_fill(entity me)
19 {
20         entity e;
21         entity label, box;
22         me.TR(me);
23                 me.TD(me, 2, 3, e = makeXonoticTextLabel(0, _("Please answer a few initial questions to enhance the game experience.")));
24                 e.allowWrap = 1;
25         me.TR(me);
26         me.TR(me);
27                 me.TD(me, 1, 0.5, me.playerNameLabel = makeXonoticTextLabel(0, _("Name:")));
28                         me.playerNameLabelAlpha = me.playerNameLabel.alpha;
29                 me.TD(me, 1, 2.5, label = makeXonoticTextLabel(0, string_null));
30                         label.allowCut = 1;
31                         label.allowColors = 1;
32                         label.alpha = 1;
33         me.TR(me);
34                 me.TD(me, 1, 3.0, box = makeXonoticInputBox(1, "_cl_name"));
35                         box.forbiddenCharacters = "\r\n\\\"$"; // don't care, isn't getting saved
36                         box.maxLength = -127; // negative means encoded length in bytes
37                         label.textEntity = box;
38         me.TR(me);
39                 me.TD(me, 5, 1, e = makeXonoticColorpicker(box));
40                 me.TD(me, 5, 2, e = makeXonoticCharmap(box));
41         me.TR(me);
42         me.TR(me);
43         me.TR(me);
44         me.TR(me);
45         me.TR(me);
46         me.TR(me);
47
48         // because of the language selector, this is a menu_restart!
49         me.gotoRC(me, me.rows - 1, 0);
50                 me.TD(me, 1, me.columns, e = makeXonoticCommandButton(_("Save settings"), '0 0 0', "saveconfig; menu_restart; togglemenu", COMMANDBUTTON_APPLY));
51                 setDependentStringNotEqual(e, "_cl_name", "Player");
52 }
53 #endif