r493 - trunk/code/q3_ui
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Sun Jan 15 21:23:03 EST 2006
Author: tma
Date: 2006-01-15 21:23:03 -0500 (Sun, 15 Jan 2006)
New Revision: 493
Modified:
trunk/code/q3_ui/ui_atoms.c
trunk/code/q3_ui/ui_local.h
Log:
* Patch from Tilman Sauerbeck that fixes some UI code that does not take
account of non-4:3 aspect ratios
Modified: trunk/code/q3_ui/ui_atoms.c
===================================================================
--- trunk/code/q3_ui/ui_atoms.c 2006-01-15 21:55:43 UTC (rev 492)
+++ trunk/code/q3_ui/ui_atoms.c 2006-01-16 02:23:03 UTC (rev 493)
@@ -353,15 +353,15 @@
// draw the colored text
trap_R_SetColor( color );
- ax = x * uis.scale + uis.bias;
- ay = y * uis.scale;
+ ax = x * uis.xscale + uis.bias;
+ ay = y * uis.yscale;
s = str;
while ( *s )
{
ch = *s & 127;
if ( ch == ' ' ) {
- ax += ((float)PROPB_SPACE_WIDTH + (float)PROPB_GAP_WIDTH)* uis.scale;
+ ax += ((float)PROPB_SPACE_WIDTH + (float)PROPB_GAP_WIDTH)* uis.xscale;
}
else if ( ch >= 'A' && ch <= 'Z' ) {
ch -= 'A';
@@ -369,10 +369,10 @@
frow = (float)propMapB[ch][1] / 256.0f;
fwidth = (float)propMapB[ch][2] / 256.0f;
fheight = (float)PROPB_HEIGHT / 256.0f;
- aw = (float)propMapB[ch][2] * uis.scale;
- ah = (float)PROPB_HEIGHT * uis.scale;
+ aw = (float)propMapB[ch][2] * uis.xscale;
+ ah = (float)PROPB_HEIGHT * uis.yscale;
trap_R_DrawStretchPic( ax, ay, aw, ah, fcol, frow, fcol+fwidth, frow+fheight, uis.charsetPropB );
- ax += (aw + (float)PROPB_GAP_WIDTH * uis.scale);
+ ax += (aw + (float)PROPB_GAP_WIDTH * uis.xscale);
}
s++;
}
@@ -463,27 +463,27 @@
// draw the colored text
trap_R_SetColor( color );
- ax = x * uis.scale + uis.bias;
- ay = y * uis.scale;
+ ax = x * uis.xscale + uis.bias;
+ ay = y * uis.yscale;
s = str;
while ( *s )
{
ch = *s & 127;
if ( ch == ' ' ) {
- aw = (float)PROP_SPACE_WIDTH * uis.scale * sizeScale;
+ aw = (float)PROP_SPACE_WIDTH * uis.xscale * sizeScale;
}
else if ( propMap[ch][2] != -1 ) {
fcol = (float)propMap[ch][0] / 256.0f;
frow = (float)propMap[ch][1] / 256.0f;
fwidth = (float)propMap[ch][2] / 256.0f;
fheight = (float)PROP_HEIGHT / 256.0f;
- aw = (float)propMap[ch][2] * uis.scale * sizeScale;
- ah = (float)PROP_HEIGHT * uis.scale * sizeScale;
+ aw = (float)propMap[ch][2] * uis.xscale * sizeScale;
+ ah = (float)PROP_HEIGHT * uis.yscale * sizeScale;
trap_R_DrawStretchPic( ax, ay, aw, ah, fcol, frow, fcol+fwidth, frow+fheight, charset );
}
- ax += (aw + (float)PROP_GAP_WIDTH * uis.scale * sizeScale);
+ ax += (aw + (float)PROP_GAP_WIDTH * uis.xscale * sizeScale);
s++;
}
@@ -654,10 +654,10 @@
// draw the colored text
trap_R_SetColor( color );
- ax = x * uis.scale + uis.bias;
- ay = y * uis.scale;
- aw = charw * uis.scale;
- ah = charh * uis.scale;
+ ax = x * uis.xscale + uis.bias;
+ ay = y * uis.yscale;
+ aw = charw * uis.xscale;
+ ah = charh * uis.yscale;
s = str;
while ( *s )
@@ -1068,7 +1068,8 @@
trap_GetGlconfig( &uis.glconfig );
// for 640x480 virtualized screen
- uis.scale = uis.glconfig.vidHeight * (1.0/480.0);
+ uis.xscale = uis.glconfig.vidWidth * (1.0/640.0);
+ uis.yscale = uis.glconfig.vidHeight * (1.0/480.0);
if ( uis.glconfig.vidWidth * 480 > uis.glconfig.vidHeight * 640 ) {
// wide screen
uis.bias = 0.5 * ( uis.glconfig.vidWidth - ( uis.glconfig.vidHeight * (640.0/480.0) ) );
@@ -1094,10 +1095,10 @@
*/
void UI_AdjustFrom640( float *x, float *y, float *w, float *h ) {
// expect valid pointers
- *x = *x * uis.scale + uis.bias;
- *y *= uis.scale;
- *w *= uis.scale;
- *h *= uis.scale;
+ *x = *x * uis.xscale + uis.bias;
+ *y *= uis.yscale;
+ *w *= uis.xscale;
+ *h *= uis.yscale;
}
void UI_DrawNamedPic( float x, float y, float width, float height, const char *picname ) {
Modified: trunk/code/q3_ui/ui_local.h
===================================================================
--- trunk/code/q3_ui/ui_local.h 2006-01-15 21:55:43 UTC (rev 492)
+++ trunk/code/q3_ui/ui_local.h 2006-01-16 02:23:03 UTC (rev 493)
@@ -547,7 +547,8 @@
qhandle_t cursor;
qhandle_t rb_on;
qhandle_t rb_off;
- float scale;
+ float xscale;
+ float yscale;
float bias;
qboolean demoversion;
qboolean firstdraw;
More information about the quake3-commits
mailing list