r3153 - in trunk/data/qcsrc/menu-div0test: . item nexuiz
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Wed Jan 16 13:14:48 EST 2008
Author: div0
Date: 2008-01-16 13:14:47 -0500 (Wed, 16 Jan 2008)
New Revision: 3153
Modified:
trunk/data/qcsrc/menu-div0test/item/dialog.c
trunk/data/qcsrc/menu-div0test/menu.qc
trunk/data/qcsrc/menu-div0test/menu.qh
trunk/data/qcsrc/menu-div0test/nexuiz/mainwindow.c
Log:
better support odd resolutions (like widescreen)
Modified: trunk/data/qcsrc/menu-div0test/item/dialog.c
===================================================================
--- trunk/data/qcsrc/menu-div0test/item/dialog.c 2008-01-16 17:53:53 UTC (rev 3152)
+++ trunk/data/qcsrc/menu-div0test/item/dialog.c 2008-01-16 18:14:47 UTC (rev 3153)
@@ -132,7 +132,7 @@
if not(me.titleFontSize)
me.titleHeight = 0; // no title bar
- absWidth = me.intendedWidth * cvar("vid_conwidth");
+ absWidth = me.intendedWidth * conwidth;
absHeight = me.titleHeight + me.marginTop + me.rows * me.rowHeight + (me.rows - 1) * me.rowSpacing + me.marginBottom;
me.itemOrigin = eX * (me.marginLeft / absWidth)
+ eY * ((me.titleHeight + me.marginTop) / absHeight);
@@ -141,7 +141,7 @@
me.itemSpacing = me.itemSize
+ eX * (me.columnSpacing / absWidth)
+ eY * (me.rowSpacing / absHeight);
- me.intendedHeight = absHeight / cvar("vid_conheight");
+ me.intendedHeight = absHeight / conheight;
me.currentRow = -1;
me.currentColumn = -1;
Modified: trunk/data/qcsrc/menu-div0test/menu.qc
===================================================================
--- trunk/data/qcsrc/menu-div0test/menu.qc 2008-01-16 17:53:53 UTC (rev 3152)
+++ trunk/data/qcsrc/menu-div0test/menu.qc 2008-01-16 18:14:47 UTC (rev 3153)
@@ -22,6 +22,32 @@
dprint_load();
}
+void UpdateConWidthHeight()
+{
+ var float conwidth_s = conwidth;
+ var float conheight_s = conheight;
+ conwidth = cvar("vid_conwidth");
+ conheight = cvar("vid_conheight");
+ if(conwidth < 800)
+ {
+ conheight *= 800 / conwidth;
+ conwidth = 800;
+ }
+ if(conheight < 600)
+ {
+ conwidth *= 600 / conheight;
+ conheight = 600;
+ }
+ if(main)
+ {
+ if(conwidth_s != conwidth || conheight_s != conheight)
+ {
+ draw_reset();
+ main.resizeNotify(main, '0 0 0', eX * conwidth + eY * conheight, '0 0 0', eX * conwidth + eY * conheight);
+ }
+ }
+}
+
void() m_init_delayed =
{
float fh;
@@ -56,9 +82,11 @@
draw_setMousePointer("cursor", SKINSIZE_CURSOR, SKINOFFSET_CURSOR);
+ conwidth = conheight = -1;
+ draw_reset();
+ UpdateConWidthHeight();
main = spawnMainWindow(); main.configureMainWindow(main);
- draw_reset();
- main.resizeNotify(main, draw_shift, draw_scale, draw_shift, draw_scale);
+ main.resizeNotify(main, '0 0 0', eX * conwidth + eY * conheight, '0 0 0', eX * conwidth + eY * conheight);
main.focused = 1;
menuShiftState = 0;
menuMousePos = '0.5 0.5 0';
@@ -134,6 +162,9 @@
float t;
float realFrametime;
+ if(main)
+ UpdateConWidthHeight();
+
if(!menuNotTheFirstFrame)
{
menuNotTheFirstFrame = 1;
@@ -150,6 +181,7 @@
m_init_delayed();
return;
}
+
t = gettime();
realFrametime = frametime = min(0.2, t - menuPrevTime);
menuPrevTime = t;
Modified: trunk/data/qcsrc/menu-div0test/menu.qh
===================================================================
--- trunk/data/qcsrc/menu-div0test/menu.qh 2008-01-16 17:53:53 UTC (rev 3152)
+++ trunk/data/qcsrc/menu-div0test/menu.qh 2008-01-16 18:14:47 UTC (rev 3153)
@@ -39,4 +39,6 @@
entity keyGrabber;
.void(entity me, float key, float ascii) keyGrabbed;
+float conwidth, conheight; // "virtual" conwidth/height values for other stuff to assume for scaling
+
void SUB_Null();
Modified: trunk/data/qcsrc/menu-div0test/nexuiz/mainwindow.c
===================================================================
--- trunk/data/qcsrc/menu-div0test/nexuiz/mainwindow.c 2008-01-16 17:53:53 UTC (rev 3152)
+++ trunk/data/qcsrc/menu-div0test/nexuiz/mainwindow.c 2008-01-16 18:14:47 UTC (rev 3153)
@@ -61,7 +61,7 @@
i.configureDialog(i);
n.addItemCentered(n, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
n.setNexposee(n, i, '0.9 1.2 0', SKINALPHAS_MAINMENU_x, SKINALPHAS_MAINMENU_y);
- n.pullNexposee(n, i, eY * (SKINHEIGHT_TITLE * SKINFONTSIZE_TITLE / cvar("vid_conheight")));
+ n.pullNexposee(n, i, eY * (SKINHEIGHT_TITLE * SKINFONTSIZE_TITLE / conheight));
me.addItem(me, n, '0 0 0', '1 1 0', SKINALPHAS_MAINMENU_z);
me.moveItemAfter(me, n, NULL);
More information about the nexuiz-commits
mailing list