From e91499affa4a27ed9477eb3cd396871e4fd3e318 Mon Sep 17 00:00:00 2001 From: Samual Lenks Date: Wed, 18 Dec 2013 03:22:10 -0500 Subject: [PATCH] Begin adding HUD tab to game settings --- qcsrc/menu/xonotic/dialog_settings_game.c | 2 +- qcsrc/menu/xonotic/dialog_settings_game_hud.c | 44 +++++++++---------- qcsrc/menu/xonotic/mainwindow.c | 5 --- 3 files changed, 22 insertions(+), 29 deletions(-) diff --git a/qcsrc/menu/xonotic/dialog_settings_game.c b/qcsrc/menu/xonotic/dialog_settings_game.c index 9891a1136..6ba8aa163 100644 --- a/qcsrc/menu/xonotic/dialog_settings_game.c +++ b/qcsrc/menu/xonotic/dialog_settings_game.c @@ -28,7 +28,7 @@ void XonoticGameSettingsTab_fill(entity me) //me.TD(me, 1, 1, mc.makeTabButton(mc, _("General"), makeXonoticGameCrosshairSettingsTab())); me.TD(me, 1, 1, mc.makeTabButton(mc, _("View"), makeXonoticGameViewSettingsTab())); me.TD(me, 1, 1, mc.makeTabButton(mc, _("Crosshair"), makeXonoticGameCrosshairSettingsTab())); - me.TD(me, 1, 1, mc.makeTabButton(mc, _("HUD"), makeXonoticGameCrosshairSettingsTab())); + me.TD(me, 1, 1, mc.makeTabButton(mc, _("HUD"), makeXonoticGameHUDSettingsTab())); me.TD(me, 1, 1, mc.makeTabButton(mc, _("Messages"), makeXonoticGameCrosshairSettingsTab())); me.TD(me, 1, 1, mc.makeTabButton(mc, _("Weapons"), makeXonoticGameWeaponsSettingsTab())); me.TD(me, 1, 1, mc.makeTabButton(mc, _("Playermodels"), makeXonoticGameCrosshairSettingsTab())); diff --git a/qcsrc/menu/xonotic/dialog_settings_game_hud.c b/qcsrc/menu/xonotic/dialog_settings_game_hud.c index 8d969fd7a..5444d7c36 100644 --- a/qcsrc/menu/xonotic/dialog_settings_game_hud.c +++ b/qcsrc/menu/xonotic/dialog_settings_game_hud.c @@ -1,14 +1,14 @@ #ifdef INTERFACE -CLASS(XonoticHUDDialog) EXTENDS(XonoticDialog) - METHOD(XonoticHUDDialog, toString, string(entity)) - METHOD(XonoticHUDDialog, fill, void(entity)) - METHOD(XonoticHUDDialog, showNotify, void(entity)) - ATTRIB(XonoticHUDDialog, title, string, _("HUD settings")) - ATTRIB(XonoticHUDDialog, color, vector, SKINCOLOR_DIALOG_HUD) - ATTRIB(XonoticHUDDialog, intendedWidth, float, 0.5) - ATTRIB(XonoticHUDDialog, rows, float, 18) - ATTRIB(XonoticHUDDialog, columns, float, 3) -ENDCLASS(XonoticHUDDialog) +CLASS(XonoticGameHUDSettingsTab) EXTENDS(XonoticTab) + //METHOD(XonoticGameHUDSettingsTab, toString, string(entity)) + METHOD(XonoticGameHUDSettingsTab, fill, void(entity)) + METHOD(XonoticGameHUDSettingsTab, showNotify, void(entity)) + ATTRIB(XonoticGameHUDSettingsTab, title, string, _("HUD")) + ATTRIB(XonoticGameHUDSettingsTab, intendedWidth, float, 0.9) + ATTRIB(XonoticGameHUDSettingsTab, rows, float, 14) + ATTRIB(XonoticGameHUDSettingsTab, columns, float, 6.2) +ENDCLASS(XonoticGameHUDSettingsTab) +entity makeXonoticGameHUDSettingsTab(); void HUDSetup_Start(entity me, entity btn); #endif @@ -24,15 +24,19 @@ void HUDSetup_Check_Gamestatus(entity me, entity btn) HUDSetup_Start(me, btn); } } -void XonoticHUDDialog_showNotify(entity me) +void XonoticGameHUDSettingsTab_showNotify(entity me) { loadAllCvars(me); } -string XonoticHUDDialog_toString(entity me) +entity makeXonoticGameHUDSettingsTab() { - return "hi"; // TODO: show hud config name with text here + entity me; + me = spawnXonoticGameHUDSettingsTab(); + me.configureDialog(me); + return me; } -void XonoticHUDDialog_fill(entity me) + +void XonoticGameHUDSettingsTab_fill(entity me) { entity e; @@ -60,7 +64,7 @@ void XonoticHUDDialog_fill(entity me) me.TD(me, 1, 3, e = makeXonoticCheckBox(1, "cl_hidewaypoints", _("Waypoints"))); me.TR(me); me.TDempty(me, 0.2); - me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Scale:"))); + me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Scale:"))); // TODO: use fontsize? setDependent(e, "cl_hidewaypoints", 0, 0); me.TD(me, 1, 2, e = makeXonoticSlider(0.5, 1.5, 0.05, "g_waypointsprite_scale")); setDependent(e, "cl_hidewaypoints", 0, 0); @@ -77,10 +81,9 @@ void XonoticHUDDialog_fill(entity me) me.TD(me, 1, 2, e = makeXonoticSlider(0, 0.3, 0.01, "g_waypointsprite_edgeoffset_bottom")); makeMulti(e, "g_waypointsprite_edgeoffset_top g_waypointsprite_edgeoffset_left g_waypointsprite_edgeoffset_right"); setDependent(e, "cl_hidewaypoints", 0, 0); - me.TR(me); - me.TR(me); - me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "hud_shownames", _("Show names above players"))); + me.gotoRC(me, 0, 3.2); me.setFirstColumn(me, me.currentColumn); + me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "hud_shownames", _("Show names above players"))); // TODO: select fontsize for shownames me.TR(me); me.TDempty(me, 0.2); me.TD(me, 1, 2.8, e = makeXonoticCheckBoxEx(25, 0, "hud_shownames_crosshairdistance", _("Only when near crosshair"))); @@ -94,10 +97,5 @@ void XonoticHUDDialog_fill(entity me) e.onClick = HUDSetup_Check_Gamestatus; e.onClickEntity = me; // TODO: show hud config name with text here - - me.gotoRC(me, me.rows - 1, 0); - me.TD(me, 1, me.columns, e = makeXonoticButton(_("OK"), '0 0 0')); - e.onClick = Dialog_Close; - e.onClickEntity = me; } #endif diff --git a/qcsrc/menu/xonotic/mainwindow.c b/qcsrc/menu/xonotic/mainwindow.c index 41ab98622..213dabf02 100644 --- a/qcsrc/menu/xonotic/mainwindow.c +++ b/qcsrc/menu/xonotic/mainwindow.c @@ -13,7 +13,6 @@ CLASS(MainWindow) EXTENDS(ModalController) ATTRIB(MainWindow, screenshotViewerDialog, entity, NULL) ATTRIB(MainWindow, viewDialog, entity, NULL) ATTRIB(MainWindow, modelDialog, entity, NULL) - ATTRIB(MainWindow, hudDialog, entity, NULL) ATTRIB(MainWindow, hudconfirmDialog, entity, NULL) ATTRIB(MainWindow, mainNexposee, entity, NULL) ATTRIB(MainWindow, fadedAlpha, float, SKINALPHA_BEHIND) @@ -167,10 +166,6 @@ void MainWindow_configureMainWindow(entity me) me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z); // dialogs used by multiplayer/player setup - me.hudDialog = i = spawnXonoticHUDDialog(); - i.configureDialog(i); - me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z); - me.hudconfirmDialog = i = spawnXonoticHUDConfirmDialog(); i.configureDialog(i); me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z); -- 2.39.2