--- /dev/null
+#ifdef INTERFACE
+CLASS(XonoticFirstRunDialog) EXTENDS(XonoticRootDialog)
+ METHOD(XonoticFirstRunDialog, fill, void(entity)) // to be overridden by user to fill the dialog with controls
+ ATTRIB(XonoticFirstRunDialog, title, string, _("Welcome"))
+ ATTRIB(XonoticFirstRunDialog, color, vector, SKINCOLOR_DIALOG_FIRSTRUN)
+ ATTRIB(XonoticFirstRunDialog, intendedWidth, float, 0.6)
+ ATTRIB(XonoticFirstRunDialog, rows, float, 11)
+ ATTRIB(XonoticFirstRunDialog, columns, float, 3)
+ ATTRIB(XonoticFirstRunDialog, name, string, "FirstRun")
+ ATTRIB(XonoticFirstRunDialog, playerNameLabel, entity, NULL)
+ ATTRIB(XonoticFirstRunDialog, playerNameLabelAlpha, float, 0)
+
+ ATTRIB(XonoticFirstRunDialog, closable, float, 0)
+ENDCLASS(XonoticFirstRunDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticFirstRunDialog_fill(entity me)
+{
+ entity e;
+ entity label, box;
+ me.TR(me);
+ me.TD(me, 2, 3, e = makeXonoticTextLabel(0, _("Please answer a few initial questions to enhance the game experience.")));
+ e.allowWrap = 1;
+ me.TR(me);
+ me.TR(me);
+ me.TD(me, 1, 0.5, me.playerNameLabel = makeXonoticTextLabel(0, _("Name:")));
+ me.playerNameLabelAlpha = me.playerNameLabel.alpha;
+ me.TD(me, 1, 2.5, label = makeXonoticTextLabel(0, string_null));
+ label.allowCut = 1;
+ label.allowColors = 1;
+ label.alpha = 1;
+ me.TR(me);
+ me.TD(me, 1, 3.0, box = makeXonoticInputBox(1, "_cl_name"));
+ box.forbiddenCharacters = "\r\n\\\"$"; // don't care, isn't getting saved
+ box.maxLength = -127; // negative means encoded length in bytes
+ label.textEntity = box;
+ me.TR(me);
+ me.TD(me, 5, 1, e = makeXonoticColorpicker(box));
+ me.TD(me, 5, 2, e = makeXonoticCharmap(box));
+ me.TR(me);
+ me.TR(me);
+ me.TR(me);
+ me.TR(me);
+ me.TR(me);
+ me.TR(me);
+
+ // because of the language selector, this is a menu_restart!
+ me.gotoRC(me, me.rows - 1, 0);
+ me.TD(me, 1, me.columns, e = makeXonoticCommandButton(_("Save settings"), '0 0 0', "saveconfig; menu_restart; togglemenu", COMMANDBUTTON_APPLY));
+ setDependentStringNotEqual(e, "_cl_name", "Player");
+}
+#endif
#ifdef INTERFACE
CLASS(MainWindow) EXTENDS(ModalController)
METHOD(MainWindow, configureMainWindow, void(entity))
+ METHOD(MainWindow, draw, void(entity))
+ ATTRIB(MainWindow, firstRunDialog, entity, NULL)
ATTRIB(MainWindow, advancedDialog, entity, NULL)
ATTRIB(MainWindow, mutatorsDialog, entity, NULL)
ATTRIB(MainWindow, weaponsDialog, entity, NULL)
ATTRIB(MainWindow, cvarsDialog, entity, NULL)
ATTRIB(MainWindow, mainNexposee, entity, NULL)
ATTRIB(MainWindow, fadedAlpha, float, SKINALPHA_BEHIND)
+ ATTRIB(MainWindow, dialogToShow, entity, NULL)
ENDCLASS(MainWindow)
#endif
#ifdef IMPLEMENTATION
+void MainWindow_draw(entity me)
+{
+ SUPER(MainWindow).draw(me);
+
+ if(me.dialogToShow)
+ {
+ DialogOpenButton_Click_withCoords(world, me.dialogToShow, '0 0 0', eX * conwidth + eY * conheight);
+ me.dialogToShow = NULL;
+ }
+}
void DemoButton_Click(entity me, entity other)
{
{
entity n, i;
+ me.firstRunDialog = i = spawnXonoticFirstRunDialog();
+ i.configureDialog(i);
+ me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
i = spawnXonoticTeamSelectDialog();
i.configureDialog(i);
me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
me.moveItemAfter(me, n, NULL);
me.initializeDialog(me, n);
+
+ if(cvar_string("_cl_name") == "Player")
+ me.dialogToShow = me.firstRunDialog;
}
#endif