r2865 - in trunk/data/qcsrc/menu-div0test: . item nexuiz
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Mon Oct 29 23:35:16 EDT 2007
Author: div0
Date: 2007-10-29 23:35:15 -0400 (Mon, 29 Oct 2007)
New Revision: 2865
Added:
trunk/data/qcsrc/menu-div0test/item/tab.c
trunk/data/qcsrc/menu-div0test/nexuiz/checkbox.c
trunk/data/qcsrc/menu-div0test/nexuiz/dialog_settings.c
trunk/data/qcsrc/menu-div0test/nexuiz/dialog_settings_effects.c
trunk/data/qcsrc/menu-div0test/nexuiz/dialog_settings_video.c
trunk/data/qcsrc/menu-div0test/nexuiz/slider.c
trunk/data/qcsrc/menu-div0test/nexuiz/slider_resolution.c
trunk/data/qcsrc/menu-div0test/nexuiz/tab.c
trunk/data/qcsrc/menu-div0test/nexuiz/tabcontroller.c
trunk/data/qcsrc/menu-div0test/nexuiz/textlabel.c
Modified:
trunk/data/qcsrc/menu-div0test/classes.c
trunk/data/qcsrc/menu-div0test/draw.qc
trunk/data/qcsrc/menu-div0test/item/borderimage.c
trunk/data/qcsrc/menu-div0test/item/container.c
trunk/data/qcsrc/menu-div0test/item/dialog.c
trunk/data/qcsrc/menu-div0test/item/slider.c
trunk/data/qcsrc/menu-div0test/menu.qh
trunk/data/qcsrc/menu-div0test/nexuiz/dialog.c
trunk/data/qcsrc/menu-div0test/nexuiz/mainwindow.c
trunk/data/qcsrc/menu-div0test/skin.qh
trunk/data/qcsrc/menu-div0test/todo
Log:
tabbed dialog
Modified: trunk/data/qcsrc/menu-div0test/classes.c
===================================================================
--- trunk/data/qcsrc/menu-div0test/classes.c 2007-10-29 11:30:13 UTC (rev 2864)
+++ trunk/data/qcsrc/menu-div0test/classes.c 2007-10-30 03:35:15 UTC (rev 2865)
@@ -11,8 +11,18 @@
#include "item/borderimage.c"
#include "item/slider.c"
#include "item/dialog.c"
+#include "item/tab.c"
#include "nexuiz/dialog.c"
+#include "nexuiz/tab.c"
#include "nexuiz/mainwindow.c"
#include "nexuiz/button.c"
#include "nexuiz/commandbutton.c"
#include "nexuiz/dialog_teamselect.c"
+#include "nexuiz/dialog_settings.c"
+#include "nexuiz/dialog_settings_video.c"
+#include "nexuiz/dialog_settings_effects.c"
+#include "nexuiz/tabcontroller.c"
+#include "nexuiz/textlabel.c"
+#include "nexuiz/slider.c"
+#include "nexuiz/slider_resolution.c"
+#include "nexuiz/checkbox.c"
Modified: trunk/data/qcsrc/menu-div0test/draw.qc
===================================================================
--- trunk/data/qcsrc/menu-div0test/draw.qc 2007-10-29 11:30:13 UTC (rev 2864)
+++ trunk/data/qcsrc/menu-div0test/draw.qc 2007-10-30 03:35:15 UTC (rev 2865)
@@ -51,8 +51,7 @@
void draw_Picture(vector theOrigin, string pic, vector theSize, vector theColor, float theAlpha)
{
- //drawpic(boxToGlobal(theOrigin, draw_shift, draw_scale), pic, boxToGlobalSize(theSize, draw_scale), theColor, theAlpha * draw_alpha, 0);
- drawsubpic(boxToGlobal(theOrigin, draw_shift, draw_scale), boxToGlobalSize(theSize, draw_scale), pic, '0 0 0', '1 1 1', theColor, theAlpha * draw_alpha, 0);
+ drawpic(boxToGlobal(theOrigin, draw_shift, draw_scale), pic, boxToGlobalSize(theSize, draw_scale), theColor, theAlpha * draw_alpha, 0);
}
// a button picture is a texture containing three parts:
Modified: trunk/data/qcsrc/menu-div0test/item/borderimage.c
===================================================================
--- trunk/data/qcsrc/menu-div0test/item/borderimage.c 2007-10-29 11:30:13 UTC (rev 2864)
+++ trunk/data/qcsrc/menu-div0test/item/borderimage.c 2007-10-30 03:35:15 UTC (rev 2865)
@@ -15,15 +15,14 @@
void resizeNotifyBorderImage(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
{
resizeNotifyLabel(me, relOrigin, relSize, absOrigin, absSize);
- me.borderVec = me.borderHeight * me.realFontSize_y * (eY + eX * (absSize_y / absSize_x));
- me.realOrigin_y = 0.5 * me.realFontSize_y * (me.borderHeight - 1);
+ me.borderVec = me.borderHeight / absSize_y * (eY + eX * (absSize_y / absSize_x));
+ me.realOrigin_y = 0.5 * (me.borderVec_y - me.realFontSize_y);
if(me.closeButton)
{
// move the close button to the right place
me.closeButton.Container_origin = '1 0 0' * (1 - me.borderVec_x);
me.closeButton.Container_size = me.borderVec;
me.closeButton.color = me.color;
- print("a: ", vtos(absSize), "\n");
}
}
void configureBorderImageBorderImage(entity me, string theTitle, float sz, vector theColor, string path, float theBorderHeight)
@@ -35,7 +34,10 @@
}
void drawBorderImage(entity me)
{
- draw_BorderPicture('0 0 0', me.src, '1 1 0', me.color, 1, me.borderVec);
- drawLabel(me);
+ //print(vtos(me.borderVec), "\n");
+ if(me.src != "")
+ draw_BorderPicture('0 0 0', me.src, '1 1 0', me.color, 1, me.borderVec);
+ if(me.fontSize > 0)
+ drawLabel(me);
};
#endif
Modified: trunk/data/qcsrc/menu-div0test/item/container.c
===================================================================
--- trunk/data/qcsrc/menu-div0test/item/container.c 2007-10-29 11:30:13 UTC (rev 2864)
+++ trunk/data/qcsrc/menu-div0test/item/container.c 2007-10-30 03:35:15 UTC (rev 2865)
@@ -11,6 +11,7 @@
METHOD(Container, resizeNotify, void(entity, vector, vector, vector, vector))
METHOD(Container, resizeNotifyLie, void(entity, vector, vector, vector, vector, .vector, .vector))
METHOD(Container, addItem, void(entity, entity, vector, vector, float))
+ METHOD(Container, addItemCentered, void(entity, entity, vector, float))
METHOD(Container, moveItemAfter, void(entity, entity, entity))
METHOD(Container, removeItem, void(entity, entity))
METHOD(Container, setFocus, void(entity, entity))
@@ -155,6 +156,11 @@
return 0;
}
+void addItemCenteredContainer(entity me, entity other, vector theSize, float theAlpha)
+{
+ me.addItem(me, other, '0.5 0.5 0' - 0.5 * theSize, theSize, theAlpha);
+}
+
void addItemContainer(entity me, entity other, vector theOrigin, vector theSize, float theAlpha)
{
if(other.parent)
Modified: trunk/data/qcsrc/menu-div0test/item/dialog.c
===================================================================
--- trunk/data/qcsrc/menu-div0test/item/dialog.c 2007-10-29 11:30:13 UTC (rev 2864)
+++ trunk/data/qcsrc/menu-div0test/item/dialog.c 2007-10-30 03:35:15 UTC (rev 2865)
@@ -6,7 +6,7 @@
// - title is ""
// - marginTop is
// - intendedHeight ends up to be the tab's actual height, or at least close
-// - titleFontSize is sensible, and so is titleHeight
+// - titleFontSize is 0
// - marginTop cancels out as much of titleHeight as needed (that is, it should be actualMarginTop - titleHeight)
// To ensure the latter, you best create all tabs FIRST and insert the tabbed
// control to your dialog THEN - with the right height
@@ -52,7 +52,7 @@
ATTRIB(Dialog, rowSpacing, float, 0) // pixels
ATTRIB(Dialog, rowHeight, float, 0) // pixels
ATTRIB(Dialog, titleHeight, float, 0) // pixels
- ATTRIB(Dialog, titleFontSize, float, 0) // pixels
+ ATTRIB(Dialog, titleFontSize, float, 0) // pixels; if 0, title causes no margin
ATTRIB(Dialog, backgroundImage, string, "")
ATTRIB(Dialog, closeButtonImage, string, "")
@@ -71,7 +71,7 @@
void addItemSimpleDialog(entity me, float row, float col, float rowspan, float colspan, entity e)
{
- print(vtos(me.itemSpacing), " ", vtos(me.itemSize), "\n");
+ //print(vtos(me.itemSpacing), " ", vtos(me.itemSize), "\n");
me.addItem(me, e,
me.itemOrigin + eX * ( col * me.itemSpacing_x) + eY * ( row * me.itemSpacing_y),
me.itemSize + eX * ((colspan - 1) * me.itemSpacing_x) + eY * ((rowspan - 1) * me.itemSpacing_y),
@@ -107,9 +107,12 @@
float absWidth, absHeight;
frame = spawnBorderImage();
- frame.configureBorderImage(frame, me.title, me.titleFontSize, me.color, me.backgroundImage, me.titleHeight / me.titleFontSize);
+ frame.configureBorderImage(frame, me.title, me.titleFontSize, me.color, me.backgroundImage, me.titleHeight);
me.addItem(me, frame, '0 0 0', '1 1 0', 1);
+ if(!me.titleFontSize)
+ me.titleHeight = 0; // no title bar
+
absWidth = me.intendedWidth * cvar("vid_conwidth");
absHeight = me.titleHeight + me.marginTop + me.rows * me.rowHeight + (me.rows - 1) * me.rowSpacing + me.marginBottom;
me.itemOrigin = eX * (me.marginLeft / absWidth)
Modified: trunk/data/qcsrc/menu-div0test/item/slider.c
===================================================================
--- trunk/data/qcsrc/menu-div0test/item/slider.c 2007-10-29 11:30:13 UTC (rev 2864)
+++ trunk/data/qcsrc/menu-div0test/item/slider.c 2007-10-30 03:35:15 UTC (rev 2865)
@@ -1,13 +1,14 @@
#ifdef INTERFACE
CLASS(Slider) EXTENDS(Label)
METHOD(Slider, resizeNotify, void(entity, vector, vector, vector, vector))
- METHOD(Slider, configureSliderVisuals, void(entity, string, string, float, float, string))
+ METHOD(Slider, configureSliderVisuals, void(entity, float, float, string))
METHOD(Slider, configureSliderValues, void(entity, float, float, float, float, float, float))
METHOD(Slider, draw, void(entity))
METHOD(Slider, keyDown, float(entity, float, float, float))
METHOD(Slider, mousePress, float(entity, vector))
METHOD(Slider, mouseDrag, float(entity, vector))
METHOD(Slider, mouseRelease, float(entity, vector))
+ METHOD(Slider, valueToText, string(entity, float))
ATTRIB(Slider, src, string, "")
ATTRIB(Slider, focusable, float, 1)
ATTRIB(Slider, value, float, 0)
@@ -20,8 +21,6 @@
ATTRIB(Slider, controlWidth, float, 0)
ATTRIB(Slider, pressed, float, 0)
ATTRIB(Slider, pressOffset, float, 0)
- ATTRIB(Slider, prefix, string, "")
- ATTRIB(Slider, suffix, string, "")
ATTRIB(Slider, previousValue, float, 0)
ENDCLASS(Slider)
#endif
@@ -32,11 +31,13 @@
resizeNotifyLabel(me, relOrigin, relSize, absOrigin, absSize);
me.controlWidth = absSize_y / absSize_x;
}
-void configureSliderVisualsSlider(entity me, string thePrefix, string theSuffix, float sz, float theValueSpace, string gfx)
+string valueToTextSlider(entity me, float val)
{
+ return ftos(val);
+}
+void configureSliderVisualsSlider(entity me, float sz, float theValueSpace, string gfx)
+{
configureLabelLabel(me, "", sz, 1);
- me.prefix = thePrefix;
- me.suffix = theSuffix;
me.valueSpace = theValueSpace;
me.src = gfx;
}
@@ -135,7 +136,7 @@
draw_Picture(eX * controlLeft, strcat(me.src, "_f"), eX * me.controlWidth + eY, '1 1 1', 1);
else
draw_Picture(eX * controlLeft, strcat(me.src, "_n"), eX * me.controlWidth + eY, '1 1 1', 1);
- me.setText(me, strcat(me.prefix, ftos(me.value), me.suffix));
+ me.setText(me, me.valueToText(me, me.value));
drawLabel(me);
me.text = ""; // TEMPSTRING!
}
Added: trunk/data/qcsrc/menu-div0test/item/tab.c
===================================================================
--- trunk/data/qcsrc/menu-div0test/item/tab.c (rev 0)
+++ trunk/data/qcsrc/menu-div0test/item/tab.c 2007-10-30 03:35:15 UTC (rev 2865)
@@ -0,0 +1,28 @@
+#ifdef INTERFACE
+CLASS(Tab) EXTENDS(Dialog)
+ ATTRIB(Tab, isTabRoot, float, 0)
+ ATTRIB(Tab, closable, float, 0)
+ ATTRIB(Tab, rootDialog, float, 0)
+ ATTRIB(Tab, title, string, "")
+ ATTRIB(Tab, titleFontSize, float, 0) // pixels
+
+ // still to be customized
+ ATTRIB(Tab, intendedWidth, float, 0)
+ ATTRIB(Tab, rows, float, 3)
+ ATTRIB(Tab, columns, float, 2)
+
+ ATTRIB(Tab, marginTop, float, 0) // pixels
+ ATTRIB(Tab, marginBottom, float, 0) // pixels
+ ATTRIB(Tab, marginLeft, float, 0) // pixels
+ ATTRIB(Tab, marginRight, float, 0) // pixels
+ ATTRIB(Tab, columnSpacing, float, 0) // pixels
+ ATTRIB(Tab, rowSpacing, float, 0) // pixels
+ ATTRIB(Tab, rowHeight, float, 0) // pixels
+ ATTRIB(Tab, titleHeight, float, 0) // pixels
+
+ ATTRIB(Tab, backgroundImage, string, "")
+ENDCLASS(Tab)
+#endif
+
+#ifdef IMPLEMENTATION
+#endif
Modified: trunk/data/qcsrc/menu-div0test/menu.qh
===================================================================
--- trunk/data/qcsrc/menu-div0test/menu.qh 2007-10-29 11:30:13 UTC (rev 2864)
+++ trunk/data/qcsrc/menu-div0test/menu.qh 2007-10-30 03:35:15 UTC (rev 2865)
@@ -4,6 +4,7 @@
// constants
+const string string_null;
const vector eX = '1 0 0';
const vector eY = '0 1 0';
const vector eZ = '0 0 1';
Added: trunk/data/qcsrc/menu-div0test/nexuiz/checkbox.c
===================================================================
--- trunk/data/qcsrc/menu-div0test/nexuiz/checkbox.c (rev 0)
+++ trunk/data/qcsrc/menu-div0test/nexuiz/checkbox.c 2007-10-30 03:35:15 UTC (rev 2865)
@@ -0,0 +1,42 @@
+#ifdef INTERFACE
+CLASS(NexuizCheckBox) EXTENDS(CheckBox)
+ METHOD(NexuizCheckBox, configureNexuizCheckBox, void(entity, float, string, string))
+ ATTRIB(NexuizCheckBox, fontSize, float, SKINFONTSIZE_NORMAL)
+ ATTRIB(NexuizCheckBox, image, string, SKINGFX_CHECKBOX)
+ ATTRIB(NexuizCheckBox, inverted, float, 0)
+
+ ATTRIB(NexuizCheckBox, cvarName, string, string_null)
+ METHOD(NexuizCheckBox, loadCvars, void(entity))
+ METHOD(NexuizCheckBox, saveCvars, void(entity))
+ENDCLASS(NexuizCheckBox)
+entity makeNexuizCheckBox(float, string, string);
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeNexuizCheckBox(float isInverted, string theCvar, string theText)
+{
+ entity me;
+ me = spawnNexuizCheckBox();
+ me.configureNexuizCheckBox(me, isInverted, theCvar, theText);
+ return me;
+}
+void configureNexuizCheckBoxNexuizCheckBox(entity me, float isInverted, string theCvar, string theText)
+{
+ me.inverted = isInverted;
+ me.checked = 0;
+ if(theCvar != "")
+ {
+ me.cvarName = theCvar;
+ me.loadCvars(me);
+ }
+ me.configureCheckBox(me, theText, me.fontSize, me.image);
+}
+void loadCvarsNexuizCheckBox(entity me)
+{
+ me.checked = me.inverted - !!cvar(me.cvarName);
+}
+void saveCvarsNexuizCheckBox(entity me)
+{
+ cvar_set(me.cvarName, ftos(me.inverted - me.value));
+}
+#endif
Modified: trunk/data/qcsrc/menu-div0test/nexuiz/dialog.c
===================================================================
--- trunk/data/qcsrc/menu-div0test/nexuiz/dialog.c 2007-10-29 11:30:13 UTC (rev 2864)
+++ trunk/data/qcsrc/menu-div0test/nexuiz/dialog.c 2007-10-30 03:35:15 UTC (rev 2865)
@@ -3,7 +3,7 @@
// still to be customized by user
/*
ATTRIB(NexuizDialog, closable, float, 1)
- ATTRIB(NexuizDialog, rootNexuizDialog, float, 1)
+ ATTRIB(NexuizDialog, rootDialog, float, 1)
ATTRIB(NexuizDialog, title, string, "Form1") // ;)
ATTRIB(NexuizDialog, color, vector, '1 0.5 1')
ATTRIB(NexuizDialog, intendedWidth, float, 0)
Added: trunk/data/qcsrc/menu-div0test/nexuiz/dialog_settings.c
===================================================================
--- trunk/data/qcsrc/menu-div0test/nexuiz/dialog_settings.c (rev 0)
+++ trunk/data/qcsrc/menu-div0test/nexuiz/dialog_settings.c 2007-10-30 03:35:15 UTC (rev 2865)
@@ -0,0 +1,26 @@
+#ifdef INTERFACE
+CLASS(NexuizSettingsDialog) EXTENDS(NexuizDialog)
+ METHOD(NexuizSettingsDialog, fill, void(entity))
+ ATTRIB(NexuizSettingsDialog, rootDialog, float, 0)
+ ATTRIB(NexuizSettingsDialog, title, string, "Settings")
+ ATTRIB(NexuizSettingsDialog, color, vector, '0.5 0.5 1')
+ ATTRIB(NexuizSettingsDialog, intendedWidth, float, 0.96)
+ ATTRIB(NexuizSettingsDialog, rows, float, 16)
+ ATTRIB(NexuizSettingsDialog, columns, float, 6)
+ENDCLASS(NexuizSettingsDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void fillNexuizSettingsDialog(entity me)
+{
+ entity mc;
+ mc = makeNexuizTabController(me.rows - 1);
+ me.TR(me);
+ me.TD(me, 1, 1, mc.makeTabButton(mc, "Input", makeNexuizVideoSettingsTab()));
+ me.TD(me, 1, 1, mc.makeTabButton(mc, "Video", makeNexuizVideoSettingsTab()));
+ me.TD(me, 1, 1, mc.makeTabButton(mc, "Effects", makeNexuizEffectsSettingsTab()));
+ me.TD(me, 1, 1, mc.makeTabButton(mc, "Audio", makeNexuizVideoSettingsTab()));
+ me.TR(me);
+ me.TD(me, me.rows - 1, me.columns, mc);
+}
+#endif
Added: trunk/data/qcsrc/menu-div0test/nexuiz/dialog_settings_effects.c
===================================================================
--- trunk/data/qcsrc/menu-div0test/nexuiz/dialog_settings_effects.c (rev 0)
+++ trunk/data/qcsrc/menu-div0test/nexuiz/dialog_settings_effects.c 2007-10-30 03:35:15 UTC (rev 2865)
@@ -0,0 +1,23 @@
+#ifdef INTERFACE
+CLASS(NexuizEffectsSettingsTab) EXTENDS(NexuizTab)
+ METHOD(NexuizEffectsSettingsTab, fill, void(entity))
+ ATTRIB(NexuizEffectsSettingsTab, title, string, "Settings")
+ ATTRIB(NexuizEffectsSettingsTab, intendedWidth, float, 0.9)
+ ATTRIB(NexuizEffectsSettingsTab, rows, float, 15)
+ ATTRIB(NexuizEffectsSettingsTab, columns, float, 1)
+ENDCLASS(NexuizEffectsSettingsTab)
+entity makeNexuizEffectsSettingsTab();
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeNexuizEffectsSettingsTab()
+{
+ entity me;
+ me = spawnNexuizEffectsSettingsTab();
+ me.configureDialog(me);
+ return me;
+}
+void fillNexuizEffectsSettingsTab(entity me)
+{
+}
+#endif
Added: trunk/data/qcsrc/menu-div0test/nexuiz/dialog_settings_video.c
===================================================================
--- trunk/data/qcsrc/menu-div0test/nexuiz/dialog_settings_video.c (rev 0)
+++ trunk/data/qcsrc/menu-div0test/nexuiz/dialog_settings_video.c 2007-10-30 03:35:15 UTC (rev 2865)
@@ -0,0 +1,33 @@
+#ifdef INTERFACE
+CLASS(NexuizVideoSettingsTab) EXTENDS(NexuizTab)
+ METHOD(NexuizVideoSettingsTab, fill, void(entity))
+ ATTRIB(NexuizVideoSettingsTab, title, string, "Settings")
+ ATTRIB(NexuizVideoSettingsTab, intendedWidth, float, 0.9)
+ ATTRIB(NexuizVideoSettingsTab, rows, float, 15)
+ ATTRIB(NexuizVideoSettingsTab, columns, float, 7)
+ENDCLASS(NexuizVideoSettingsTab)
+entity makeNexuizVideoSettingsTab();
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeNexuizVideoSettingsTab()
+{
+ entity me;
+ me = spawnNexuizVideoSettingsTab();
+ me.configureDialog(me);
+ return me;
+}
+void fillNexuizVideoSettingsTab(entity me)
+{
+ me.TR(me);
+ me.TD(me, 1, 1, makeNexuizTextLabel(0, "Resolution:"));
+ me.TD(me, 1, 2, makeNexuizResolutionSlider());
+ me.TR(me);
+ me.TD(me, 1, 3, makeNexuizCheckBox(0, "vid_fullscreen", "Full screen"));
+ me.TR(me);
+ me.TD(me, 1, 3, makeNexuizCheckBox(0, "vid_vsync", "Vertical synchronization"));
+
+ me.gotoXY(me, me.rows - 1, 0);
+ me.TD(me, 1, me.columns, makeNexuizCommandButton("Apply now", '0 0 0', "vid_restart", 0));
+}
+#endif
Modified: trunk/data/qcsrc/menu-div0test/nexuiz/mainwindow.c
===================================================================
--- trunk/data/qcsrc/menu-div0test/nexuiz/mainwindow.c 2007-10-29 11:30:13 UTC (rev 2864)
+++ trunk/data/qcsrc/menu-div0test/nexuiz/mainwindow.c 2007-10-30 03:35:15 UTC (rev 2865)
@@ -28,7 +28,7 @@
cb.srcMulti = 0;
i = spawnBorderImage();
- i.configureBorderImage(i, "I told you...", 18, '0.5 0.5 1', "qcsrc/menu-div0test/baseborder", 1.5);
+ i.configureBorderImage(i, "I told you...", 18, '0.5 0.5 1', "qcsrc/menu-div0test/baseborder", 18 * 1.5);
i.closeButton = cb;
dlg.addItem(dlg, i, '0 0 0', '1 1 0', 1);
@@ -45,7 +45,7 @@
dlg.addItem(dlg, i, '0.5 0.4 0', '0.8 0.1 0', 1);
i = spawnSlider();
- i.configureSliderVisuals(i, "", " fps", 12, 0.2, "qcsrc/menu-div0test/baseslider");
+ i.configureSliderVisuals(i, 12, 0.2, "qcsrc/menu-div0test/baseslider");
i.configureSliderValues(i, 1, 50, 200, 1, 1, 20);
dlg.addItem(dlg, i, '0.1 0.5 0', '0.8 0.1 0', 1);
@@ -64,7 +64,7 @@
i = spawnNexuizTeamSelectDialog();
i.configureDialog(i);
- me.addItem(me, i, ('1 1 0' - i.intendedWidth * eX - i.intendedHeight * eY) * 0.5, i.intendedWidth * eX + i.intendedHeight * eY, 1);
+ me.addItemCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, 1);
i = spawnImage();
i.configureImage(i, "gfx/0.tga");
@@ -109,9 +109,9 @@
n.addItem(n, c, '0.03 0.06 0', '0.9 0.9 0', 0.5);
n.setNexposee(n, c, '0.1 0.2 0', 0.2, 0.5);
- i = spawnImage();
- i.configureImage(i, "gfx/2.tga");
- n.addItem(n, i, '0.04 0.01 0', '0.9 0.9 0', 1);
+ i = spawnNexuizSettingsDialog();
+ i.configureDialog(i);
+ n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, 1);
n.setNexposee(n, i, '0.95 0.8 0', 0.2, 0.5);
i = spawnImage();
Added: trunk/data/qcsrc/menu-div0test/nexuiz/slider.c
===================================================================
--- trunk/data/qcsrc/menu-div0test/nexuiz/slider.c (rev 0)
+++ trunk/data/qcsrc/menu-div0test/nexuiz/slider.c 2007-10-30 03:35:15 UTC (rev 2865)
@@ -0,0 +1,47 @@
+#ifdef INTERFACE
+CLASS(NexuizSlider) EXTENDS(Slider)
+ METHOD(NexuizSlider, configureNexuizSlider, void(entity, float, float, float, string))
+ ATTRIB(NexuizSlider, fontSize, float, SKINFONTSIZE_NORMAL)
+ ATTRIB(NexuizSlider, valueSpace, float, SKINWIDTH_SLIDERTEXT)
+ ATTRIB(NexuizSlider, image, string, SKINGFX_SLIDER)
+
+ ATTRIB(NexuizSlider, cvarName, string, string_null)
+ METHOD(NexuizSlider, loadCvars, void(entity))
+ METHOD(NexuizSlider, saveCvars, void(entity))
+ENDCLASS(NexuizSlider)
+entity makeNexuizSlider(float, float, float, string);
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeNexuizSlider(float theValueMin, float theValueMax, float theValueStep, string theCvar)
+{
+ entity me;
+ me = spawnNexuizSlider();
+ me.configureNexuizSlider(me, theValueMin, theValueMax, theValueStep, theCvar);
+ return me;
+}
+void configureNexuizSliderNexuizSlider(entity me, float theValueMin, float theValueMax, float theValueStep, string theCvar)
+{
+ float v, vk, vp;
+ v = theValueMin;
+ if(theCvar != "")
+ {
+ me.cvarName = theCvar;
+ me.loadCvars(me);
+ }
+ vk = theValueStep;
+ vp = theValueStep * 10;
+ while(vp < (theValueMax - theValueMin) / 40)
+ vp *= 10;
+ me.configureSliderVisuals(me, me.fontSize, me.valueSpace, me.image);
+ me.configureSliderValues(me, theValueMin, v, theValueMax, theValueStep, vk, vp);
+}
+void loadCvarsNexuizSlider(entity me)
+{
+ me.value = cvar(me.cvarName);
+}
+void saveCvarsNexuizSlider(entity me)
+{
+ cvar_set(me.cvarName, ftos(me.value));
+}
+#endif
Added: trunk/data/qcsrc/menu-div0test/nexuiz/slider_resolution.c
===================================================================
--- trunk/data/qcsrc/menu-div0test/nexuiz/slider_resolution.c (rev 0)
+++ trunk/data/qcsrc/menu-div0test/nexuiz/slider_resolution.c 2007-10-30 03:35:15 UTC (rev 2865)
@@ -0,0 +1,46 @@
+#ifdef INTERFACE
+CLASS(NexuizResolutionSlider) EXTENDS(NexuizSlider)
+ METHOD(NexuizResolutionSlider, valueToText, string(entity, float))
+ METHOD(NexuizResolutionSlider, configureNexuizResolutionSlider, void(entity))
+ ATTRIB(NexuizResolutionSlider, resolutions, string,
+ " 640 480 "
+ " 800 600 "
+ " 960 600 "
+ "1024 768 "
+ "1152 864 "
+ "1280 800 "
+ "1280 960 "
+ "1280 1024 "
+ "1440 900 "
+ "1600 900 "
+ "1600 1200 "
+ "1680 1050 "
+ "1920 1200 "
+ "2048 1536 "
+ )
+ENDCLASS(NexuizResolutionSlider)
+entity makeNexuizResolutionSlider();
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeNexuizResolutionSlider()
+{
+ entity me;
+ me = spawnNexuizResolutionSlider();
+ me.configureNexuizResolutionSlider(me);
+ return me;
+}
+string valueToTextNexuizResolutionSlider(entity me, float theValue)
+{
+ string r;
+ float w, h;
+ r = substring(me.resolutions, (theValue - 1) * 10, 10);
+ w = stof(substring(r, 0, 5));
+ h = stof(substring(r, 5, 10));
+ return strcat(ftos(w), "x", ftos(h));
+}
+void configureNexuizResolutionSliderNexuizResolutionSlider(entity me)
+{
+ me.configureNexuizSlider(me, 1, strlen(me.resolutions) / 10, 1, "vid_width");
+}
+#endif
Added: trunk/data/qcsrc/menu-div0test/nexuiz/tab.c
===================================================================
--- trunk/data/qcsrc/menu-div0test/nexuiz/tab.c (rev 0)
+++ trunk/data/qcsrc/menu-div0test/nexuiz/tab.c 2007-10-30 03:35:15 UTC (rev 2865)
@@ -0,0 +1,24 @@
+#ifdef INTERFACE
+CLASS(NexuizTab) EXTENDS(Tab)
+ // still to be customized by user
+ /*
+ ATTRIB(NexuizTab, intendedWidth, float, 0)
+ ATTRIB(NexuizTab, rows, float, 3)
+ ATTRIB(NexuizTab, columns, float, 2)
+ */
+
+ ATTRIB(NexuizTab, marginTop, float, 0) // pixels
+ ATTRIB(NexuizTab, marginBottom, float, 0) // pixels
+ ATTRIB(NexuizTab, marginLeft, float, 0) // pixels
+ ATTRIB(NexuizTab, marginRight, float, 0) // pixels
+ ATTRIB(NexuizTab, columnSpacing, float, SKINMARGIN_COLUMNS) // pixels
+ ATTRIB(NexuizTab, rowSpacing, float, SKINMARGIN_ROWS) // pixels
+ ATTRIB(NexuizTab, rowHeight, float, SKINFONTSIZE_NORMAL * SKINHEIGHT_NORMAL) // pixels
+ ATTRIB(NexuizTab, titleHeight, float, SKINFONTSIZE_TITLE * SKINHEIGHT_TITLE) // pixels
+
+ ATTRIB(NexuizTab, backgroundImage, string, "")
+ENDCLASS(NexuizTab)
+#endif
+
+#ifdef IMPLEMENTATION
+#endif
Added: trunk/data/qcsrc/menu-div0test/nexuiz/tabcontroller.c
===================================================================
--- trunk/data/qcsrc/menu-div0test/nexuiz/tabcontroller.c (rev 0)
+++ trunk/data/qcsrc/menu-div0test/nexuiz/tabcontroller.c 2007-10-30 03:35:15 UTC (rev 2865)
@@ -0,0 +1,34 @@
+#ifdef INTERFACE
+CLASS(NexuizTabController) EXTENDS(ModalController)
+ METHOD(NexuizTabController, configureNexuizTabController, void(entity, float))
+ METHOD(NexuizTabController, makeTabButton, entity(entity, string, entity))
+ ATTRIB(NexuizTabController, rows, float, 0)
+ ATTRIB(NexuizTabController, fontSize, float, SKINFONTSIZE_NORMAL)
+ ATTRIB(NexuizTabController, image, string, SKINGFX_BUTTON)
+ENDCLASS(NexuizTabController)
+entity makeNexuizTabController(float theRows);
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeNexuizTabController(float theRows)
+{
+ entity me;
+ me = spawnNexuizTabController();
+ me.configureNexuizTabController(me, theRows);
+ return me;
+}
+void configureNexuizTabControllerNexuizTabController(entity me, float theRows)
+{
+ me.rows = theRows;
+}
+entity makeTabButtonNexuizTabController(entity me, string theTitle, entity tab)
+{
+ entity b;
+ if(me.rows != tab.rows)
+ error("Tab dialog height mismatch!");
+ b = spawnButton();
+ b.configureButton(b, theTitle, me.fontSize, me.image);
+ me.addTab(me, tab, b);
+ return b;
+}
+#endif
Added: trunk/data/qcsrc/menu-div0test/nexuiz/textlabel.c
===================================================================
--- trunk/data/qcsrc/menu-div0test/nexuiz/textlabel.c (rev 0)
+++ trunk/data/qcsrc/menu-div0test/nexuiz/textlabel.c 2007-10-30 03:35:15 UTC (rev 2865)
@@ -0,0 +1,21 @@
+#ifdef INTERFACE
+CLASS(NexuizTextLabel) EXTENDS(Label)
+ METHOD(NexuizTextLabel, configureNexuizTextLabel, void(entity, float, string))
+ ATTRIB(NexuizTextLabel, fontSize, float, SKINFONTSIZE_NORMAL)
+ENDCLASS(NexuizTextLabel)
+entity makeNexuizTextLabel(float theAlign, string theText);
+#endif
+
+#ifdef IMPLEMENTATION
+entity makeNexuizTextLabel(float theAlign, string theText)
+{
+ entity me;
+ me = spawnNexuizTextLabel();
+ me.configureNexuizTextLabel(me, theAlign, theText);
+ return me;
+}
+void configureNexuizTextLabelNexuizTextLabel(entity me, float theAlign, string theText)
+{
+ me.configureLabel(me, theText, me.fontSize, theAlign);
+}
+#endif
Modified: trunk/data/qcsrc/menu-div0test/skin.qh
===================================================================
--- trunk/data/qcsrc/menu-div0test/skin.qh 2007-10-29 11:30:13 UTC (rev 2864)
+++ trunk/data/qcsrc/menu-div0test/skin.qh 2007-10-30 03:35:15 UTC (rev 2865)
@@ -4,6 +4,8 @@
const string SKINGFX_CLOSEBUTTON = "qcsrc/menu-div0test/baseclosebutton";
const string SKINGFX_BUTTON = "qcsrc/menu-div0test/basebutton";
const string SKINGFX_BUTTON_GRAY = "qcsrc/menu-div0test/basebuttongray";
+const string SKINGFX_SLIDER = "qcsrc/menu-div0test/baseslider";
+const string SKINGFX_CHECKBOX = "qcsrc/menu-div0test/basecheckbox";
const float SKINMARGIN_TOP = 8;
const float SKINMARGIN_LEFT = 8;
@@ -13,3 +15,5 @@
const float SKINFONTSIZE_NORMAL = 12;
const float SKINHEIGHT_NORMAL = 1.5;
const float SKINHEIGHT_NORMAL_WITHSPACING = 2;
+
+const float SKINWIDTH_SLIDERTEXT = 0.333333333333;
Modified: trunk/data/qcsrc/menu-div0test/todo
===================================================================
--- trunk/data/qcsrc/menu-div0test/todo 2007-10-29 11:30:13 UTC (rev 2864)
+++ trunk/data/qcsrc/menu-div0test/todo 2007-10-30 03:35:15 UTC (rev 2865)
@@ -26,3 +26,7 @@
TODO create game
TODO demo viewer
TODO quit dialog
+
+short term:
+TODO make video resolution slider work
+TODO make cvar controls save their values on change
More information about the nexuiz-commits
mailing list