mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-04-28 21:57:57 +03:00
Automatically scale UI elements for high resolutions
This fixes UI elements being tiny on high resolutions like 4K. Now most UI elements will scale automatically with resolutions above 1920x1080.
This commit is contained in:
parent
47983481c9
commit
6fe1e86b31
37 changed files with 504 additions and 334 deletions
|
@ -191,8 +191,8 @@ void CG_DrawDisconnect(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
handle = cgi.R_RegisterShader("gfx/2d/net.tga");
|
handle = cgi.R_RegisterShader("gfx/2d/net.tga");
|
||||||
w = cgi.R_GetShaderWidth(handle);
|
w = cgi.R_GetShaderWidth(handle) * cgs.uiHiResScale[0];
|
||||||
h = cgi.R_GetShaderHeight(handle);
|
h = cgi.R_GetShaderHeight(handle) * cgs.uiHiResScale[1];
|
||||||
x = ((float)cgs.glconfig.vidWidth - w) * 0.5;
|
x = ((float)cgs.glconfig.vidWidth - w) * 0.5;
|
||||||
y = (float)cgs.glconfig.vidHeight - h;
|
y = (float)cgs.glconfig.vidHeight - h;
|
||||||
|
|
||||||
|
@ -331,7 +331,7 @@ static void CG_DrawPauseIcon()
|
||||||
x = (cgs.glconfig.vidWidth - w) / 2.f;
|
x = (cgs.glconfig.vidWidth - w) / 2.f;
|
||||||
|
|
||||||
cgi.R_SetColor(colorWhite);
|
cgi.R_SetColor(colorWhite);
|
||||||
cgi.R_DrawStretchPic(x, y, w, h, 0, 0, 1, 1, handle);
|
cgi.R_DrawStretchPic(x, y, w * cgs.uiHiResScale[0], h * cgs.uiHiResScale[1], 0, 0, 1, 1, handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CG_DrawServerLag()
|
static void CG_DrawServerLag()
|
||||||
|
@ -362,8 +362,8 @@ static void CG_DrawServerLag()
|
||||||
}
|
}
|
||||||
|
|
||||||
handle = cgi.R_RegisterShader("gfx/2d/slowserver");
|
handle = cgi.R_RegisterShader("gfx/2d/slowserver");
|
||||||
w = (float)cgi.R_GetShaderWidth(handle) / 4;
|
w = (float)cgi.R_GetShaderWidth(handle) * cgs.uiHiResScale[0] / 4;
|
||||||
h = (float)cgi.R_GetShaderHeight(handle) / 4;
|
h = (float)cgi.R_GetShaderHeight(handle) * cgs.uiHiResScale[1] / 4;
|
||||||
x = ((float)cgs.glconfig.vidWidth - w) / 2;
|
x = ((float)cgs.glconfig.vidWidth - w) / 2;
|
||||||
y = (float)cgs.glconfig.vidHeight - h;
|
y = (float)cgs.glconfig.vidHeight - h;
|
||||||
cgi.R_DrawStretchPic(x, y, w, h, 0.0, 0.0, 1.0, 1.0, handle);
|
cgi.R_DrawStretchPic(x, y, w, h, 0.0, 0.0, 1.0, 1.0, handle);
|
||||||
|
@ -580,11 +580,15 @@ void CG_HudDrawElements()
|
||||||
int i;
|
int i;
|
||||||
float fX, fY;
|
float fX, fY;
|
||||||
float fWidth, fHeight;
|
float fWidth, fHeight;
|
||||||
|
vec2_t virtualScale;
|
||||||
|
|
||||||
if (!cg_huddraw_force->integer && !cg_hud->integer) {
|
if (!cg_huddraw_force->integer && !cg_hud->integer) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtualScale[0] = cgs.glconfig.vidWidth / 640.0;
|
||||||
|
virtualScale[1] = cgs.glconfig.vidWidth / 480.0;
|
||||||
|
|
||||||
for (i = 0; i < MAX_HUDDRAW_ELEMENTS; i++) {
|
for (i = 0; i < MAX_HUDDRAW_ELEMENTS; i++) {
|
||||||
if ((!cgi.HudDrawElements[i].hShader && !cgi.HudDrawElements[i].string[0])
|
if ((!cgi.HudDrawElements[i].hShader && !cgi.HudDrawElements[i].string[0])
|
||||||
|| !cgi.HudDrawElements[i].vColor[3]) {
|
|| !cgi.HudDrawElements[i].vColor[3]) {
|
||||||
|
@ -634,7 +638,7 @@ void CG_HudDrawElements()
|
||||||
fX,
|
fX,
|
||||||
fY,
|
fY,
|
||||||
-1,
|
-1,
|
||||||
cgi.HudDrawElements[i].bVirtualScreen
|
cgi.HudDrawElements[i].bVirtualScreen ? virtualScale : cgs.uiHiResScale
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
cgi.R_DrawString(
|
cgi.R_DrawString(
|
||||||
|
@ -643,7 +647,7 @@ void CG_HudDrawElements()
|
||||||
fX,
|
fX,
|
||||||
fY,
|
fY,
|
||||||
-1,
|
-1,
|
||||||
cgi.HudDrawElements[i].bVirtualScreen
|
cgi.HudDrawElements[i].bVirtualScreen ? virtualScale : cgs.uiHiResScale
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -734,7 +738,7 @@ void CG_DrawObjectives()
|
||||||
vColor[0] = 0.2f;
|
vColor[0] = 0.2f;
|
||||||
vColor[3] = cg.ObjectivesCurrentAlpha * 0.75;
|
vColor[3] = cg.ObjectivesCurrentAlpha * 0.75;
|
||||||
cgi.R_SetColor(vColor);
|
cgi.R_SetColor(vColor);
|
||||||
cgi.R_DrawStretchPic(fX, fY, 450.0, fWidth, 0.0, 0.0, 1.0, 1.0, cgs.media.objectivesBackShader);
|
cgi.R_DrawStretchPic(fX, fY, 450.0 * cgs.uiHiResScale[0], fWidth * cgs.uiHiResScale[1], 0.0, 0.0, 1.0, 1.0, cgs.media.objectivesBackShader);
|
||||||
|
|
||||||
fX = 30.0;
|
fX = 30.0;
|
||||||
fY = fObjectivesTop + 10;
|
fY = fObjectivesTop + 10;
|
||||||
|
@ -743,11 +747,11 @@ void CG_DrawObjectives()
|
||||||
vColor[2] = 1.0;
|
vColor[2] = 1.0;
|
||||||
vColor[3] = cg.ObjectivesCurrentAlpha;
|
vColor[3] = cg.ObjectivesCurrentAlpha;
|
||||||
cgi.R_SetColor(vColor);
|
cgi.R_SetColor(vColor);
|
||||||
cgi.R_DrawString(cgs.media.objectiveFont, cgi.LV_ConvertString("Mission Objectives:"), fX, fY, -1, 0);
|
cgi.R_DrawString(cgs.media.objectiveFont, cgi.LV_ConvertString("Mission Objectives:"), fX, fY / cgs.uiHiResScale[1], -1, cgs.uiHiResScale);
|
||||||
fY = fY + 5.0;
|
fY = fY + 5.0;
|
||||||
|
|
||||||
cgi.R_DrawString(cgs.media.objectiveFont, "_______________________________________________________", fX, fY, -1, 0);
|
cgi.R_DrawString(cgs.media.objectiveFont, "_______________________________________________________", fX, fY / cgs.uiHiResScale[1], -1, cgs.uiHiResScale);
|
||||||
fHeight = fObjectivesTop + 35;
|
fHeight = fObjectivesTop + 35 * cgs.uiHiResScale[1];
|
||||||
|
|
||||||
for (i = 0; i < MAX_OBJECTIVES; ++i) {
|
for (i = 0; i < MAX_OBJECTIVES; ++i) {
|
||||||
qhandle_t hBoxShader;
|
qhandle_t hBoxShader;
|
||||||
|
@ -785,7 +789,14 @@ void CG_DrawObjectives()
|
||||||
cgi.R_SetColor(vColor);
|
cgi.R_SetColor(vColor);
|
||||||
fX = 55.0;
|
fX = 55.0;
|
||||||
fY = fHeight;
|
fY = fHeight;
|
||||||
cgi.R_DrawString(cgs.media.objectiveFont, cgi.LV_ConvertString(cg.Objectives[i].text), 55.0, fHeight, -1, 0);
|
cgi.R_DrawString(
|
||||||
|
cgs.media.objectiveFont,
|
||||||
|
cgi.LV_ConvertString(cg.Objectives[i].text),
|
||||||
|
55.0,
|
||||||
|
fY / cgs.uiHiResScale[1],
|
||||||
|
-1,
|
||||||
|
cgs.uiHiResScale
|
||||||
|
);
|
||||||
|
|
||||||
fX = 30.0;
|
fX = 30.0;
|
||||||
fY = fHeight;
|
fY = fHeight;
|
||||||
|
@ -794,9 +805,19 @@ void CG_DrawObjectives()
|
||||||
vColor[2] = 1.0;
|
vColor[2] = 1.0;
|
||||||
vColor[3] = cg.ObjectivesCurrentAlpha;
|
vColor[3] = cg.ObjectivesCurrentAlpha;
|
||||||
cgi.R_SetColor(vColor);
|
cgi.R_SetColor(vColor);
|
||||||
cgi.R_DrawStretchPic(fX, fY, 16.0, 16.0, 0.0, 0.0, 1.0, 1.0, hBoxShader);
|
cgi.R_DrawStretchPic(
|
||||||
|
fX * cgs.uiHiResScale[0],
|
||||||
|
fY,
|
||||||
|
16.0 * cgs.uiHiResScale[0],
|
||||||
|
16.0 * cgs.uiHiResScale[1],
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
1.0,
|
||||||
|
1.0,
|
||||||
|
hBoxShader
|
||||||
|
);
|
||||||
|
|
||||||
fHeight += iNumLines[i] * 12 + 25;
|
fHeight += iNumLines[i] * 12 + 25 * cgs.uiHiResScale[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -820,7 +841,17 @@ void CG_DrawPlayerTeam()
|
||||||
|
|
||||||
if (handle) {
|
if (handle) {
|
||||||
cgi.R_SetColor(NULL);
|
cgi.R_SetColor(NULL);
|
||||||
cgi.R_DrawStretchPic(96.0, cgs.glconfig.vidHeight - 46, 24.0, 24.0, 0.0, 0.0, 1.0, 1.0, handle);
|
cgi.R_DrawStretchPic(
|
||||||
|
96.0 * cgs.uiHiResScale[0],
|
||||||
|
cgs.glconfig.vidHeight - 46 * cgs.uiHiResScale[1],
|
||||||
|
24.0 * cgs.uiHiResScale[0],
|
||||||
|
24.0 * cgs.uiHiResScale[1],
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
1.0,
|
||||||
|
1.0,
|
||||||
|
handle
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -862,13 +893,12 @@ void CG_DrawPlayerEntInfo()
|
||||||
|
|
||||||
if (handle) {
|
if (handle) {
|
||||||
cgi.R_SetColor(0);
|
cgi.R_SetColor(0);
|
||||||
cgi.R_DrawStretchPic(56.0, fY, 16.0, 16.0, 0.0, 0.0, 1.0, 1.0, handle);
|
cgi.R_DrawStretchPic(fX, fY, 16.0 * cgs.uiHiResScale[0], 16.0 * cgs.uiHiResScale[1], 0.0, 0.0, 1.0, 1.0, handle);
|
||||||
fX = 56.0 + 24.0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cgi.R_SetColor(color);
|
cgi.R_SetColor(color);
|
||||||
cgi.R_DrawString(cgs.media.hudDrawFont, (char *)pszName, fX, fY, -1, 0);
|
cgi.R_DrawString(cgs.media.hudDrawFont, (char *)pszName, fX / cgs.uiHiResScale[0] + 24.0, fY / cgs.uiHiResScale[1], -1, cgs.uiHiResScale);
|
||||||
cgi.R_DrawString(cgs.media.hudDrawFont, va("%i", cg.snap->ps.stats[STAT_INFOCLIENT_HEALTH]), fX, fY + 20.0, -1, 0);
|
cgi.R_DrawString(cgs.media.hudDrawFont, va("%i", cg.snap->ps.stats[STAT_INFOCLIENT_HEALTH]), fX / cgs.uiHiResScale[0] + 24.0, fY / cgs.uiHiResScale[1] + 20.0, -1, cgs.uiHiResScale);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CG_UpdateAttackerDisplay()
|
void CG_UpdateAttackerDisplay()
|
||||||
|
@ -907,7 +937,17 @@ void CG_UpdateAttackerDisplay()
|
||||||
|
|
||||||
if (handle) {
|
if (handle) {
|
||||||
cgi.R_SetColor(0);
|
cgi.R_SetColor(0);
|
||||||
cgi.R_DrawStretchPic(56.0, fY, 24.0, 24.0, 0.0, 0.0, 1.0, 1.0, handle);
|
cgi.R_DrawStretchPic(
|
||||||
|
56.0 * cgs.uiHiResScale[0],
|
||||||
|
fY,
|
||||||
|
24.0 * cgs.uiHiResScale[0],
|
||||||
|
24.0 * cgs.uiHiResScale[1],
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
1.0,
|
||||||
|
1.0,
|
||||||
|
handle
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((cg.snap->ps.stats[STAT_TEAM] == TEAM_ALLIES || cg.snap->ps.stats[STAT_TEAM] == TEAM_AXIS)
|
if ((cg.snap->ps.stats[STAT_TEAM] == TEAM_ALLIES || cg.snap->ps.stats[STAT_TEAM] == TEAM_AXIS)
|
||||||
|
@ -921,7 +961,7 @@ void CG_UpdateAttackerDisplay()
|
||||||
color[2] = 0.5;
|
color[2] = 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
fX = 56.0 + 32.0;
|
fX = 56.0;
|
||||||
} else {
|
} else {
|
||||||
color[0] = 1.0;
|
color[0] = 1.0;
|
||||||
color[1] = 0.5;
|
color[1] = 0.5;
|
||||||
|
@ -929,7 +969,7 @@ void CG_UpdateAttackerDisplay()
|
||||||
}
|
}
|
||||||
|
|
||||||
cgi.R_SetColor(color);
|
cgi.R_SetColor(color);
|
||||||
cgi.R_DrawString(cgs.media.attackerFont, pszName, fX, fY, -1, 0);
|
cgi.R_DrawString(cgs.media.attackerFont, pszName, fX / cgs.uiHiResScale[0] + 32.0, fY / cgs.uiHiResScale[1], -1, cgs.uiHiResScale);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CG_UpdateCountdown()
|
void CG_UpdateCountdown()
|
||||||
|
@ -1043,7 +1083,7 @@ void CG_DrawInstantMessageMenu()
|
||||||
x = 8.0;
|
x = 8.0;
|
||||||
y = ((float)cgs.glconfig.vidHeight - h) * 0.5;
|
y = ((float)cgs.glconfig.vidHeight - h) * 0.5;
|
||||||
cgi.R_SetColor(0);
|
cgi.R_SetColor(0);
|
||||||
cgi.R_DrawStretchPic(x, y, w, h, 0.0, 0.0, 1.0, 1.0, handle);
|
cgi.R_DrawStretchPic(x * cgs.uiHiResScale[0], y, w * cgs.uiHiResScale[0], h * cgs.uiHiResScale[1], 0.0, 0.0, 1.0, 1.0, handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CG_DrawSpectatorView_ver_15()
|
void CG_DrawSpectatorView_ver_15()
|
||||||
|
@ -1069,7 +1109,7 @@ void CG_DrawSpectatorView_ver_15()
|
||||||
fX = (float)(cgs.glconfig.vidWidth - cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1)) * 0.5;
|
fX = (float)(cgs.glconfig.vidWidth - cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1)) * 0.5;
|
||||||
fY = cgs.glconfig.vidHeight - 64.0;
|
fY = cgs.glconfig.vidHeight - 64.0;
|
||||||
cgi.R_SetColor(NULL);
|
cgi.R_SetColor(NULL);
|
||||||
cgi.R_DrawString(cgs.media.attackerFont, pszString, fX, fY, -1, qfalse);
|
cgi.R_DrawString(cgs.media.attackerFont, pszString, fX / cgs.uiHiResScale[0], fY / cgs.uiHiResScale[1], -1, cgs.uiHiResScale);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cg.predicted_player_state.pm_flags & PMF_CAMERA_VIEW) {
|
if (cg.predicted_player_state.pm_flags & PMF_CAMERA_VIEW) {
|
||||||
|
@ -1085,7 +1125,7 @@ void CG_DrawSpectatorView_ver_15()
|
||||||
fX = (float)(cgs.glconfig.vidWidth - cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1)) * 0.5;
|
fX = (float)(cgs.glconfig.vidWidth - cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1)) * 0.5;
|
||||||
fY = (float)cgs.glconfig.vidHeight - 40.0;
|
fY = (float)cgs.glconfig.vidHeight - 40.0;
|
||||||
cgi.R_SetColor(0);
|
cgi.R_SetColor(0);
|
||||||
cgi.R_DrawString(cgs.media.attackerFont, pszString, fX, fY, -1, 0);
|
cgi.R_DrawString(cgs.media.attackerFont, pszString, fX / cgs.uiHiResScale[0], fY / cgs.uiHiResScale[1], -1, cgs.uiHiResScale);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bOnTeam && (cg.predicted_player_state.pm_flags & PMF_CAMERA_VIEW)) {
|
if (!bOnTeam && (cg.predicted_player_state.pm_flags & PMF_CAMERA_VIEW)) {
|
||||||
|
@ -1096,7 +1136,7 @@ void CG_DrawSpectatorView_ver_15()
|
||||||
fX = (float)(cgs.glconfig.vidWidth - cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1)) * 0.5;
|
fX = (float)(cgs.glconfig.vidWidth - cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1)) * 0.5;
|
||||||
fY = (float)cgs.glconfig.vidHeight - 24.0;
|
fY = (float)cgs.glconfig.vidHeight - 24.0;
|
||||||
cgi.R_SetColor(0);
|
cgi.R_SetColor(0);
|
||||||
cgi.R_DrawString(cgs.media.attackerFont, pszString, fX, fY, -1, 0);
|
cgi.R_DrawString(cgs.media.attackerFont, pszString, fX / cgs.uiHiResScale[0], fY / cgs.uiHiResScale[1], -1, cgs.uiHiResScale);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(cg.predicted_player_state.pm_flags & PMF_CAMERA_VIEW)) {
|
if (!(cg.predicted_player_state.pm_flags & PMF_CAMERA_VIEW)) {
|
||||||
|
@ -1109,10 +1149,10 @@ void CG_DrawSpectatorView_ver_15()
|
||||||
fX = (float)(cgs.glconfig.vidWidth - cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1)) * 0.5;
|
fX = (float)(cgs.glconfig.vidWidth - cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1)) * 0.5;
|
||||||
fY = (float)cgs.glconfig.vidHeight - 24.0;
|
fY = (float)cgs.glconfig.vidHeight - 24.0;
|
||||||
cgi.R_SetColor(0);
|
cgi.R_SetColor(0);
|
||||||
cgi.R_DrawString(cgs.media.attackerFont, pszString, fX, fY, -1, 0);
|
cgi.R_DrawString(cgs.media.attackerFont, pszString, fX / cgs.uiHiResScale[0], fY / cgs.uiHiResScale[1], -1, cgs.uiHiResScale);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((cg.predicted_player_state.pm_flags & 0x80) != 0 && cg.snap && cg.snap->ps.stats[STAT_INFOCLIENT] != -1) {
|
if ((cg.predicted_player_state.pm_flags & PMF_CAMERA_VIEW) != 0 && cg.snap && cg.snap->ps.stats[STAT_INFOCLIENT] != -1) {
|
||||||
int iClientNum;
|
int iClientNum;
|
||||||
qhandle_t hShader;
|
qhandle_t hShader;
|
||||||
vec4_t color;
|
vec4_t color;
|
||||||
|
@ -1130,7 +1170,7 @@ void CG_DrawSpectatorView_ver_15()
|
||||||
fX = (float)(cgs.glconfig.vidWidth - cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1) - 16) * 0.5;
|
fX = (float)(cgs.glconfig.vidWidth - cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1) - 16) * 0.5;
|
||||||
fY = (float)cgs.glconfig.vidHeight - 80.0;
|
fY = (float)cgs.glconfig.vidHeight - 80.0;
|
||||||
cgi.R_SetColor(color);
|
cgi.R_SetColor(color);
|
||||||
cgi.R_DrawString(cgs.media.attackerFont, buf, fX, fY, -1, 0);
|
cgi.R_DrawString(cgs.media.attackerFont, buf, fX / cgs.uiHiResScale[0], fY / cgs.uiHiResScale[1], -1, cgs.uiHiResScale);
|
||||||
|
|
||||||
if (cg.clientinfo[iClientNum].team == TEAM_ALLIES) {
|
if (cg.clientinfo[iClientNum].team == TEAM_ALLIES) {
|
||||||
hShader = cgi.R_RegisterShader("textures/hud/allies");
|
hShader = cgi.R_RegisterShader("textures/hud/allies");
|
||||||
|
@ -1139,9 +1179,18 @@ void CG_DrawSpectatorView_ver_15()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hShader) {
|
if (hShader) {
|
||||||
fX -= 20.0;
|
|
||||||
cgi.R_SetColor(NULL);
|
cgi.R_SetColor(NULL);
|
||||||
cgi.R_DrawStretchPic(fX, fY, 16.0, 16.0, 0.0, 0.0, 1.0, 1.0, hShader);
|
cgi.R_DrawStretchPic(
|
||||||
|
fX - 20.0 * cgs.uiHiResScale[0],
|
||||||
|
fY,
|
||||||
|
16.0 * cgs.uiHiResScale[0],
|
||||||
|
16.0 * cgs.uiHiResScale[1],
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
1.0,
|
||||||
|
1.0,
|
||||||
|
hShader
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1176,7 +1225,7 @@ void CG_DrawSpectatorView_ver_6()
|
||||||
fX = (float)(cgs.glconfig.vidWidth - cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1)) * 0.5;
|
fX = (float)(cgs.glconfig.vidWidth - cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1)) * 0.5;
|
||||||
fY = (float)cgs.glconfig.vidHeight - 40.0;
|
fY = (float)cgs.glconfig.vidHeight - 40.0;
|
||||||
cgi.R_SetColor(0);
|
cgi.R_SetColor(0);
|
||||||
cgi.R_DrawString(cgs.media.attackerFont, pszString, fX, fY, -1, 0);
|
cgi.R_DrawString(cgs.media.attackerFont, pszString, fX / cgs.uiHiResScale[0], fY / cgs.uiHiResScale[1], -1, cgs.uiHiResScale);
|
||||||
|
|
||||||
if (!bOnTeam && (cg.predicted_player_state.pm_flags & PMF_CAMERA_VIEW)) {
|
if (!bOnTeam && (cg.predicted_player_state.pm_flags & PMF_CAMERA_VIEW)) {
|
||||||
cgi.Key_GetKeysForCommand("+moveup", &iKey1, &iKey2);
|
cgi.Key_GetKeysForCommand("+moveup", &iKey1, &iKey2);
|
||||||
|
@ -1190,7 +1239,7 @@ void CG_DrawSpectatorView_ver_6()
|
||||||
fX = (float)(cgs.glconfig.vidWidth - cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1)) * 0.5;
|
fX = (float)(cgs.glconfig.vidWidth - cgi.UI_FontStringWidth(cgs.media.attackerFont, pszString, -1)) * 0.5;
|
||||||
fY = (float)cgs.glconfig.vidHeight - 24.0;
|
fY = (float)cgs.glconfig.vidHeight - 24.0;
|
||||||
cgi.R_SetColor(0);
|
cgi.R_SetColor(0);
|
||||||
cgi.R_DrawString(cgs.media.attackerFont, pszString, fX, fY, -1, 0);
|
cgi.R_DrawString(cgs.media.attackerFont, pszString, fX / cgs.uiHiResScale[0], fY / cgs.uiHiResScale[1], -1, cgs.uiHiResScale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1287,7 +1336,17 @@ void CG_DrawCrosshair()
|
||||||
y = (cgs.glconfig.vidHeight - height) * 0.5f;
|
y = (cgs.glconfig.vidHeight - height) * 0.5f;
|
||||||
|
|
||||||
cgi.R_SetColor(NULL);
|
cgi.R_SetColor(NULL);
|
||||||
cgi.R_DrawStretchPic(x, y, width, height, 0, 0, 1, 1, shader);
|
cgi.R_DrawStretchPic(
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
width * cgs.uiHiResScale[0],
|
||||||
|
height * cgs.uiHiResScale[1],
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
shader
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1324,7 +1383,7 @@ void CG_DrawVote()
|
||||||
cgi.R_SetColor(NULL);
|
cgi.R_SetColor(NULL);
|
||||||
|
|
||||||
text = va("%s: %s", cgi.LV_ConvertString("Vote Running"), cgs.voteString);
|
text = va("%s: %s", cgi.LV_ConvertString("Vote Running"), cgs.voteString);
|
||||||
cgi.R_DrawString(cgs.media.attackerFont, text, x, y, -1, qfalse);
|
cgi.R_DrawString(cgs.media.attackerFont, text, x, y, -1, cgs.uiHiResScale);
|
||||||
|
|
||||||
y += 12;
|
y += 12;
|
||||||
|
|
||||||
|
@ -1338,7 +1397,7 @@ void CG_DrawVote()
|
||||||
percentNo,
|
percentNo,
|
||||||
cgi.LV_ConvertString("Undecided"),
|
cgi.LV_ConvertString("Undecided"),
|
||||||
percentUndecided);
|
percentUndecided);
|
||||||
cgi.R_DrawString(cgs.media.attackerFont, text, x, y, -1, qfalse);
|
cgi.R_DrawString(cgs.media.attackerFont, text, x, y, -1, cgs.uiHiResScale);
|
||||||
|
|
||||||
if (cg.snap && !cg.snap->ps.voted) {
|
if (cg.snap && !cg.snap->ps.voted) {
|
||||||
col[0] = 0.5;
|
col[0] = 0.5;
|
||||||
|
@ -1350,12 +1409,12 @@ void CG_DrawVote()
|
||||||
y += 12;
|
y += 12;
|
||||||
|
|
||||||
text = cgi.LV_ConvertString("Vote now, it's your patriotic duty!");
|
text = cgi.LV_ConvertString("Vote now, it's your patriotic duty!");
|
||||||
cgi.R_DrawString(cgs.media.attackerFont, text, x, y, -1, qfalse);
|
cgi.R_DrawString(cgs.media.attackerFont, text, x, y, -1, cgs.uiHiResScale);
|
||||||
|
|
||||||
y += 12;
|
y += 12;
|
||||||
|
|
||||||
text = cgi.LV_ConvertString("To vote Yes, press F1. To vote No, press F2.");
|
text = cgi.LV_ConvertString("To vote Yes, press F1. To vote No, press F2.");
|
||||||
cgi.R_DrawString(cgs.media.attackerFont, text, x, y, -1, qfalse);
|
cgi.R_DrawString(cgs.media.attackerFont, text, x, y, -1, cgs.uiHiResScale);
|
||||||
cgi.R_SetColor(NULL);
|
cgi.R_SetColor(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -380,6 +380,7 @@ extern "C" {
|
||||||
float screenXScale; // derived from glconfig
|
float screenXScale; // derived from glconfig
|
||||||
float screenYScale;
|
float screenYScale;
|
||||||
float screenXBias;
|
float screenXBias;
|
||||||
|
vec2_t uiHiResScale;
|
||||||
|
|
||||||
int serverCommandSequence; // reliable command stream counter
|
int serverCommandSequence; // reliable command stream counter
|
||||||
int processedSnapshotNum; // the number of snapshots cgame has requested
|
int processedSnapshotNum; // the number of snapshots cgame has requested
|
||||||
|
|
|
@ -570,6 +570,7 @@ void CG_GetRendererConfig(void)
|
||||||
cgi.GetGlconfig(&cgs.glconfig);
|
cgi.GetGlconfig(&cgs.glconfig);
|
||||||
cgs.screenXScale = cgs.glconfig.vidWidth / 640.0;
|
cgs.screenXScale = cgs.glconfig.vidWidth / 640.0;
|
||||||
cgs.screenYScale = cgs.glconfig.vidHeight / 480.0;
|
cgs.screenYScale = cgs.glconfig.vidHeight / 480.0;
|
||||||
|
cgi.UI_GetHighResolutionScale(&cgs.uiHiResScale);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -312,7 +312,7 @@ functions exported to the main executable
|
||||||
); // 0 = white
|
); // 0 = white
|
||||||
fontheader_t *(*R_LoadFont)(const char *name);
|
fontheader_t *(*R_LoadFont)(const char *name);
|
||||||
void (*R_DrawString)(
|
void (*R_DrawString)(
|
||||||
fontheader_t *font, const char *text, float x, float y, int maxLen, qboolean virtualScreen
|
fontheader_t *font, const char *text, float x, float y, int maxLen, const float *pvVirtualScreen
|
||||||
);
|
);
|
||||||
refEntity_t *(*R_GetRenderEntity)(int entityNumber);
|
refEntity_t *(*R_GetRenderEntity)(int entityNumber);
|
||||||
void (*R_ModelBounds)(clipHandle_t model, vec3_t mins, vec3_t maxs);
|
void (*R_ModelBounds)(clipHandle_t model, vec3_t mins, vec3_t maxs);
|
||||||
|
@ -363,6 +363,7 @@ functions exported to the main executable
|
||||||
int (*UI_FontStringWidth)(fontheader_t *font, const char *string, int maxLen);
|
int (*UI_FontStringWidth)(fontheader_t *font, const char *string, int maxLen);
|
||||||
// Added in 2.0
|
// Added in 2.0
|
||||||
float (*UI_GetObjectivesTop)(void);
|
float (*UI_GetObjectivesTop)(void);
|
||||||
|
void (*UI_GetHighResolutionScale)(vec2_t scale);
|
||||||
|
|
||||||
int (*Key_StringToKeynum)(const char *str);
|
int (*Key_StringToKeynum)(const char *str);
|
||||||
const char *(*Key_KeynumToBindString)(int keyNum);
|
const char *(*Key_KeynumToBindString)(int keyNum);
|
||||||
|
|
|
@ -774,6 +774,7 @@ void CL_InitCGameDLL( clientGameImport_t *cgi, clientGameExport_t **cge ) {
|
||||||
cgi->UI_HideMenu = UI_HideMenu;
|
cgi->UI_HideMenu = UI_HideMenu;
|
||||||
cgi->UI_FontStringWidth = CL_FontStringWidth;
|
cgi->UI_FontStringWidth = CL_FontStringWidth;
|
||||||
cgi->UI_GetObjectivesTop = UI_GetObjectivesTop;
|
cgi->UI_GetObjectivesTop = UI_GetObjectivesTop;
|
||||||
|
cgi->UI_GetHighResolutionScale = UI_GetHighResolutionScale;
|
||||||
cgi->Key_StringToKeynum = Key_StringToKeynum;
|
cgi->Key_StringToKeynum = Key_StringToKeynum;
|
||||||
cgi->Key_KeynumToBindString = Key_KeynumToBindString;
|
cgi->Key_KeynumToBindString = Key_KeynumToBindString;
|
||||||
cgi->Key_GetKeysForCommand = Key_GetKeysForCommand;
|
cgi->Key_GetKeysForCommand = Key_GetKeysForCommand;
|
||||||
|
|
|
@ -1009,7 +1009,7 @@ static UIRect2D getQuickMessageDMConsoleRectangle(void)
|
||||||
// Was 38.0 in 1.11 and below
|
// Was 38.0 in 1.11 and below
|
||||||
// This prevents characters to be seen from the DM console
|
// This prevents characters to be seen from the DM console
|
||||||
// in the quick message console
|
// in the quick message console
|
||||||
rect.size.height = 36.0;
|
rect.size.height = 36.0 * uid.scaleRes[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
return rect;
|
return rect;
|
||||||
|
@ -1196,7 +1196,7 @@ static UIRect2D getDefaultGMBoxRectangle(void)
|
||||||
height = y;
|
height = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
return UIRect2D(20.0f, height, uid.vidWidth - 20, 128.0f);
|
return UIRect2D(20.0f, height, (uid.vidWidth - 20) * uid.scaleRes[0], 128.0f * uid.scaleRes[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1206,9 +1206,9 @@ getDefaultDMBoxRectangle
|
||||||
*/
|
*/
|
||||||
static UIRect2D getDefaultDMBoxRectangle(void)
|
static UIRect2D getDefaultDMBoxRectangle(void)
|
||||||
{
|
{
|
||||||
float width = uid.vidWidth * ui_compass_scale->value * 0.2f;
|
float width = uid.vidWidth * uid.scaleRes[0] * ui_compass_scale->value * 0.2f;
|
||||||
|
|
||||||
return UIRect2D(width, 0, uid.vidWidth - (width + 192.0f), 120.0f);
|
return UIRect2D(width, 0, (uid.vidWidth - (width + 192.0f)) * uid.scaleRes[0], 120.0f * uid.scaleRes[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1221,6 +1221,21 @@ float UI_GetObjectivesTop(void)
|
||||||
return getDefaultGMBoxRectangle().pos.y;
|
return getDefaultGMBoxRectangle().pos.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
====================
|
||||||
|
UI_GetObjectivesTop
|
||||||
|
====================
|
||||||
|
*/
|
||||||
|
void UI_GetHighResolutionScale(vec2_t scale)
|
||||||
|
{
|
||||||
|
if (uid.bHighResScaling) {
|
||||||
|
scale[0] = uid.scaleRes[0];
|
||||||
|
scale[1] = uid.scaleRes[1];
|
||||||
|
} else {
|
||||||
|
scale[0] = scale[1] = 1.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
====================
|
====================
|
||||||
UI_ShowHudList
|
UI_ShowHudList
|
||||||
|
@ -3831,6 +3846,8 @@ UI_ResolutionChange
|
||||||
void UI_ResolutionChange(void)
|
void UI_ResolutionChange(void)
|
||||||
{
|
{
|
||||||
UIRect2D frame;
|
UIRect2D frame;
|
||||||
|
const float maxWidthRes = 1920;
|
||||||
|
const float maxHeightRes = 1080;
|
||||||
|
|
||||||
if (com_target_game->integer >= TG_MOHTA) {
|
if (com_target_game->integer >= TG_MOHTA) {
|
||||||
ui_compass_scale = Cvar_Get("ui_compass_scale", "0.75", CVAR_ARCHIVE | CVAR_LATCH);
|
ui_compass_scale = Cvar_Get("ui_compass_scale", "0.75", CVAR_ARCHIVE | CVAR_LATCH);
|
||||||
|
@ -3842,6 +3859,22 @@ void UI_ResolutionChange(void)
|
||||||
CL_FillUIImports();
|
CL_FillUIImports();
|
||||||
CL_FillUIDef();
|
CL_FillUIDef();
|
||||||
|
|
||||||
|
// Added in OPM
|
||||||
|
// Scaling for high resolutions
|
||||||
|
if (uid.vidWidth > maxWidthRes && uid.vidHeight > maxHeightRes) {
|
||||||
|
const float vidRatio = (float)uid.vidWidth / (float)uid.vidHeight;
|
||||||
|
|
||||||
|
uid.scaleRes[0] = (float)uid.vidWidth / (maxHeightRes * vidRatio);
|
||||||
|
uid.scaleRes[1] = (float)uid.vidHeight / maxHeightRes;
|
||||||
|
//uid.scaleRes[0] = (float)uid.vidWidth / maxWidthRes;
|
||||||
|
//uid.scaleRes[1] = (float)uid.vidHeight / maxHeightRes;
|
||||||
|
uid.bHighResScaling = qtrue;
|
||||||
|
} else {
|
||||||
|
uid.scaleRes[0] = 1;
|
||||||
|
uid.scaleRes[1] = 1;
|
||||||
|
uid.bHighResScaling = qfalse;
|
||||||
|
}
|
||||||
|
|
||||||
if (!uie.ResolutionChange) {
|
if (!uie.ResolutionChange) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -4409,7 +4442,7 @@ void ScoreboardListItem::DrawListItem(int iColumn, const UIRect2D& drawRect, boo
|
||||||
{
|
{
|
||||||
DrawBox(drawRect, backColor, 1.0);
|
DrawBox(drawRect, backColor, 1.0);
|
||||||
pFont->setColor(textColor);
|
pFont->setColor(textColor);
|
||||||
pFont->Print(drawRect.pos.x + 1, drawRect.pos.y, Sys_LV_CL_ConvertString(getListItemString(iColumn)), -1, qfalse);
|
pFont->Print((drawRect.pos.x + 1) / uid.scaleRes[0], drawRect.pos.y / uid.scaleRes[1], Sys_LV_CL_ConvertString(getListItemString(iColumn)), -1, uid.scaleRes);
|
||||||
|
|
||||||
if (bTitleItem) {
|
if (bTitleItem) {
|
||||||
UIRect2D lineRect;
|
UIRect2D lineRect;
|
||||||
|
|
|
@ -57,6 +57,7 @@ void UI_ClearState(void);
|
||||||
void CL_BeginRegistration(void);
|
void CL_BeginRegistration(void);
|
||||||
void CL_EndRegistration(void);
|
void CL_EndRegistration(void);
|
||||||
float UI_GetObjectivesTop(void);
|
float UI_GetObjectivesTop(void);
|
||||||
|
void UI_GetHighResolutionScale(vec2_t scale);
|
||||||
|
|
||||||
//
|
//
|
||||||
// menu
|
// menu
|
||||||
|
|
|
@ -266,15 +266,15 @@ float UIDMBox::PrintWrap( UIFont *font, float x, float y, str text )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
font->Print(x, fY, p1, p2 - p1, qfalse);
|
font->Print(x, fY, p1, p2 - p1, getHighResScale());
|
||||||
p1 = p2 + 1;
|
p1 = p2 + 1;
|
||||||
l -= n;
|
l -= n;
|
||||||
fY += font->getHeight(qfalse);
|
fY += font->getHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
font->Print(x, fY, p1, l, qfalse);
|
font->Print(x, fY, p1, l, getHighResScale());
|
||||||
|
|
||||||
return font->getHeight(qfalse) + (fY - y);
|
return font->getHeight() + (fY - y);
|
||||||
}
|
}
|
||||||
|
|
||||||
float UIDMBox::DrawItem( item_t *in, float x, float y, float alpha )
|
float UIDMBox::DrawItem( item_t *in, float x, float y, float alpha )
|
||||||
|
|
|
@ -260,15 +260,15 @@ float UIGMBox::PrintWrap( UIFont *font, float x, float y, str text )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
font->Print(x, fY, p1, p2 - p1, qfalse);
|
font->Print(x, fY, p1, p2 - p1, getHighResScale());
|
||||||
p1 = p2 + 1;
|
p1 = p2 + 1;
|
||||||
l -= n;
|
l -= n;
|
||||||
fY += font->getHeight(qfalse);
|
fY += font->getHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
font->Print(x, fY, p1, l, qfalse);
|
font->Print(x, fY, p1, l, getHighResScale());
|
||||||
|
|
||||||
return font->getHeight(qfalse) + (fY - y);
|
return font->getHeight() + (fY - y);
|
||||||
}
|
}
|
||||||
|
|
||||||
float UIGMBox::DrawItem( item_t *in, float x, float y, float alpha )
|
float UIGMBox::DrawItem( item_t *in, float x, float y, float alpha )
|
||||||
|
|
|
@ -112,7 +112,7 @@ void FakkMiniconsole::PostMoveinEvent(void)
|
||||||
|
|
||||||
void FakkMiniconsole::OnSizeChanged(Event *ev)
|
void FakkMiniconsole::OnSizeChanged(Event *ev)
|
||||||
{
|
{
|
||||||
m_maxlines = m_frame.size.height / m_font->getHeight(false);
|
m_maxlines = m_frame.size.height / m_font->getHeight(getHighResScale());
|
||||||
}
|
}
|
||||||
|
|
||||||
void FakkMiniconsole::MoveInEvent(Event *ev)
|
void FakkMiniconsole::MoveInEvent(Event *ev)
|
||||||
|
@ -163,14 +163,14 @@ void FakkMiniconsole::Draw(void)
|
||||||
HandleBoxMoving();
|
HandleBoxMoving();
|
||||||
|
|
||||||
m_font->setColor(m_foreground_color);
|
m_font->setColor(m_foreground_color);
|
||||||
aty = m_frame.size.height - m_font->getHeight(false);
|
aty = m_frame.size.height - m_font->getHeight(getHighResScale());
|
||||||
for (i = m_lines.NumObjects(); i > 0; i--) {
|
for (i = m_lines.NumObjects(); i > 0; i--) {
|
||||||
if (-m_font->getHeight(false) >= aty) {
|
if (-m_font->getHeight(getHighResScale()) >= aty) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_font->Print(0, aty, m_lines.ObjectAt(i), -1, false);
|
m_font->Print(0, aty / getHighResScale()[1], m_lines.ObjectAt(i), -1, getHighResScale());
|
||||||
aty -= m_font->getHeight(false);
|
aty -= m_font->getHeight(getHighResScale());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -177,6 +177,9 @@ void FAKKServerListItem::DrawListItem(int iColumn, const UIRect2D& drawRect, boo
|
||||||
newRect.size.height *= uid.vidHeight / 768;
|
newRect.size.height *= uid.vidHeight / 768;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
virtualScale[0] = m_parent->getHighResScale()[0];
|
||||||
|
virtualScale[1] = m_parent->getHighResScale()[1];
|
||||||
|
|
||||||
if (!pColoringType->integer) {
|
if (!pColoringType->integer) {
|
||||||
if (IfQueryFailed() || (IsDifferentVersion() && IsQueried())) {
|
if (IfQueryFailed() || (IsDifferentVersion() && IsQueried())) {
|
||||||
|
@ -210,7 +213,7 @@ void FAKKServerListItem::DrawListItem(int iColumn, const UIRect2D& drawRect, boo
|
||||||
newRect.pos.y / virtualScale[1],
|
newRect.pos.y / virtualScale[1],
|
||||||
getListItemString(iColumn).c_str(),
|
getListItemString(iColumn).c_str(),
|
||||||
-1,
|
-1,
|
||||||
false //m_parent->isVirtual()
|
virtualScale
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
if (IsDifferentVersion()) {
|
if (IsDifferentVersion()) {
|
||||||
|
@ -266,7 +269,7 @@ void FAKKServerListItem::DrawListItem(int iColumn, const UIRect2D& drawRect, boo
|
||||||
newRect.pos.y / virtualScale[1],
|
newRect.pos.y / virtualScale[1],
|
||||||
getListItemString(iColumn).c_str(),
|
getListItemString(iColumn).c_str(),
|
||||||
-1,
|
-1,
|
||||||
false //m_parent->isVirtual()
|
virtualScale
|
||||||
);
|
);
|
||||||
|
|
||||||
if (IsDifferentVersion()) {
|
if (IsDifferentVersion()) {
|
||||||
|
|
|
@ -443,6 +443,7 @@ void UIFakkLabel::DrawStatbar(float frac)
|
||||||
float alpha;
|
float alpha;
|
||||||
qhandle_t hMat;
|
qhandle_t hMat;
|
||||||
float w, h;
|
float w, h;
|
||||||
|
float fvWidth, fvHeight;
|
||||||
|
|
||||||
col[0] = col[1] = col[2] = col[3] = 1.0;
|
col[0] = col[1] = col[2] = col[3] = 1.0;
|
||||||
|
|
||||||
|
@ -488,11 +489,20 @@ void UIFakkLabel::DrawStatbar(float frac)
|
||||||
{
|
{
|
||||||
float width = frac * m_frame.size.width;
|
float width = frac * m_frame.size.width;
|
||||||
|
|
||||||
re.DrawTilePic(0.0, 0.0, width, m_frame.size.height, m_statbar_material->GetMaterial());
|
fvWidth = m_frame.size.width / m_vVirtualScale[0] / uii.Rend_GetShaderWidth(m_statbar_material->GetMaterial());
|
||||||
|
fvHeight = m_frame.size.height / m_vVirtualScale[1] / uii.Rend_GetShaderHeight(m_statbar_material->GetMaterial());
|
||||||
|
|
||||||
|
re.DrawStretchPic(0.0, 0.0, width, m_frame.size.height, 0, 0, fvWidth, fvHeight, m_statbar_material->GetMaterial());
|
||||||
|
//re.DrawTilePic(0.0, 0.0, width, m_frame.size.height, m_statbar_material->GetMaterial());
|
||||||
|
|
||||||
if (alpha != 0.0 && m_statbar_material_flash) {
|
if (alpha != 0.0 && m_statbar_material_flash) {
|
||||||
re.SetColor(col);
|
re.SetColor(col);
|
||||||
re.DrawTilePic(0.0, 0.0, width, m_frame.size.height, m_statbar_material_flash->GetMaterial());
|
|
||||||
|
fvWidth = m_frame.size.width / m_vVirtualScale[0] / uii.Rend_GetShaderWidth(m_statbar_material_flash->GetMaterial());
|
||||||
|
fvHeight = m_frame.size.height / m_vVirtualScale[1] / uii.Rend_GetShaderHeight(m_statbar_material_flash->GetMaterial());
|
||||||
|
|
||||||
|
re.DrawStretchPic(0.0, 0.0, width, m_frame.size.height, 0, 0, fvWidth, fvHeight, m_statbar_material_flash->GetMaterial());
|
||||||
|
//re.DrawTilePic(0.0, 0.0, width, m_frame.size.height, m_statbar_material_flash->GetMaterial());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_statbar_material_marker) {
|
if (m_statbar_material_marker) {
|
||||||
|
@ -521,13 +531,22 @@ void UIFakkLabel::DrawStatbar(float frac)
|
||||||
{
|
{
|
||||||
float y = m_frame.size.height * (1.0 - frac);
|
float y = m_frame.size.height * (1.0 - frac);
|
||||||
|
|
||||||
re.DrawTilePic(0.0, y, m_frame.size.width, m_frame.size.height, m_statbar_material->GetMaterial());
|
fvWidth = m_frame.size.width / m_vVirtualScale[0] / uii.Rend_GetShaderWidth(m_statbar_material->GetMaterial());
|
||||||
|
fvHeight = m_frame.size.height / m_vVirtualScale[1] / uii.Rend_GetShaderHeight(m_statbar_material->GetMaterial());
|
||||||
|
|
||||||
|
re.DrawStretchPic(0.0, y, m_frame.size.width, m_frame.size.height, 0, 0, fvWidth, fvHeight, m_statbar_material->GetMaterial());
|
||||||
|
//re.DrawTilePic(0.0, y, m_frame.size.width, m_frame.size.height, m_statbar_material->GetMaterial());
|
||||||
|
|
||||||
if (alpha != 0.0 && m_statbar_material_flash) {
|
if (alpha != 0.0 && m_statbar_material_flash) {
|
||||||
re.SetColor(col);
|
re.SetColor(col);
|
||||||
re.DrawTilePic(
|
|
||||||
0.0, y, m_frame.size.width, m_frame.size.height, m_statbar_material_flash->GetMaterial()
|
fvWidth = m_frame.size.width / m_vVirtualScale[0] / uii.Rend_GetShaderWidth(m_statbar_material_flash->GetMaterial());
|
||||||
);
|
fvHeight = m_frame.size.height / m_vVirtualScale[1] / uii.Rend_GetShaderHeight(m_statbar_material_flash->GetMaterial());
|
||||||
|
|
||||||
|
re.DrawStretchPic(0.0, y, m_frame.size.width, m_frame.size.height, 0, 0, fvWidth, fvHeight, m_statbar_material_flash->GetMaterial());
|
||||||
|
//re.DrawTilePic(
|
||||||
|
// 0.0, y, m_frame.size.width, m_frame.size.height, m_statbar_material_flash->GetMaterial()
|
||||||
|
//);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_statbar_material_marker) {
|
if (m_statbar_material_marker) {
|
||||||
|
@ -961,8 +980,8 @@ void UIFakkLabel::DrawStatRotator(float frac)
|
||||||
vNeedleDir[0] = fSinVal;
|
vNeedleDir[0] = fSinVal;
|
||||||
vNeedleDir[1] = -fCosVal;
|
vNeedleDir[1] = -fCosVal;
|
||||||
|
|
||||||
vSize[0] = (m_frame.size.width + m_frame.size.height) / m_frame.size.width * m_angles[2] * m_vVirtualScale[0];
|
vSize[0] = (m_frame.size.width + m_frame.size.height) / m_frame.size.width * m_angles[2] * getVirtualScale()[0];
|
||||||
vSize[1] = (m_frame.size.width + m_frame.size.height) / m_frame.size.height * m_scale * m_vVirtualScale[1];
|
vSize[1] = (m_frame.size.width + m_frame.size.height) / m_frame.size.height * m_scale * getVirtualScale()[1];
|
||||||
|
|
||||||
vCenter[0] = (m_frame.size.width * 0.5f - vSize[0]) * vNeedleDir[0] + m_frame.size.width * 0.5f;
|
vCenter[0] = (m_frame.size.width * 0.5f - vSize[0]) * vNeedleDir[0] + m_frame.size.width * 0.5f;
|
||||||
vCenter[1] = (m_frame.size.height * 0.5f - vSize[1]) * vNeedleDir[1] + m_frame.size.height * 0.5f;
|
vCenter[1] = (m_frame.size.height * 0.5f - vSize[1]) * vNeedleDir[1] + m_frame.size.height * 0.5f;
|
||||||
|
@ -1357,7 +1376,7 @@ void UIFakkLabel::Draw(void)
|
||||||
m_iFontAlignmentVertical,
|
m_iFontAlignmentVertical,
|
||||||
Sys_LV_CL_ConvertString(va("%s", CL_ConfigString(cl.snap.ps.stats[m_stat_configstring]))),
|
Sys_LV_CL_ConvertString(va("%s", CL_ConfigString(cl.snap.ps.stats[m_stat_configstring]))),
|
||||||
UBlack,
|
UBlack,
|
||||||
m_bVirtual ? m_vVirtualScale : NULL
|
getVirtualScale()
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
m_font->PrintJustified(
|
m_font->PrintJustified(
|
||||||
|
@ -1365,7 +1384,7 @@ void UIFakkLabel::Draw(void)
|
||||||
m_iFontAlignmentHorizontal,
|
m_iFontAlignmentHorizontal,
|
||||||
m_iFontAlignmentVertical,
|
m_iFontAlignmentVertical,
|
||||||
Sys_LV_CL_ConvertString(va("%s", CL_ConfigString(cl.snap.ps.stats[m_stat_configstring]))),
|
Sys_LV_CL_ConvertString(va("%s", CL_ConfigString(cl.snap.ps.stats[m_stat_configstring]))),
|
||||||
m_bVirtual ? m_vVirtualScale : NULL
|
getVirtualScale()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -1384,7 +1403,7 @@ void UIFakkLabel::Draw(void)
|
||||||
m_iFontAlignmentVertical,
|
m_iFontAlignmentVertical,
|
||||||
va("%d", delta),
|
va("%d", delta),
|
||||||
UBlack,
|
UBlack,
|
||||||
m_bVirtual ? m_vVirtualScale : NULL
|
getVirtualScale()
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
m_font->PrintJustified(
|
m_font->PrintJustified(
|
||||||
|
@ -1392,7 +1411,7 @@ void UIFakkLabel::Draw(void)
|
||||||
m_iFontAlignmentHorizontal,
|
m_iFontAlignmentHorizontal,
|
||||||
m_iFontAlignmentVertical,
|
m_iFontAlignmentVertical,
|
||||||
va("%d", delta),
|
va("%d", delta),
|
||||||
m_bVirtual ? m_vVirtualScale : NULL
|
getVirtualScale()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -1478,7 +1497,7 @@ void UIFakkLabel::Draw(void)
|
||||||
m_iFontAlignmentVertical,
|
m_iFontAlignmentVertical,
|
||||||
Sys_LV_CL_ConvertString(va("%s", CL_ConfigString(CS_WEAPONS + cl.snap.ps.activeItems[m_itemindex]))),
|
Sys_LV_CL_ConvertString(va("%s", CL_ConfigString(CS_WEAPONS + cl.snap.ps.activeItems[m_itemindex]))),
|
||||||
UBlack,
|
UBlack,
|
||||||
m_bVirtual ? m_vVirtualScale : NULL
|
getVirtualScale()
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
m_font->PrintJustified(
|
m_font->PrintJustified(
|
||||||
|
@ -1486,7 +1505,7 @@ void UIFakkLabel::Draw(void)
|
||||||
m_iFontAlignmentHorizontal,
|
m_iFontAlignmentHorizontal,
|
||||||
m_iFontAlignmentVertical,
|
m_iFontAlignmentVertical,
|
||||||
Sys_LV_CL_ConvertString(va("%s", CL_ConfigString(CS_WEAPONS + cl.snap.ps.activeItems[m_itemindex]))),
|
Sys_LV_CL_ConvertString(va("%s", CL_ConfigString(CS_WEAPONS + cl.snap.ps.activeItems[m_itemindex]))),
|
||||||
m_bVirtual ? m_vVirtualScale : NULL
|
getVirtualScale()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -124,9 +124,9 @@ void View3D::DrawFPS(void)
|
||||||
re.SetColor(UBlack);
|
re.SetColor(UBlack);
|
||||||
re.DrawBox(
|
re.DrawBox(
|
||||||
0.0,
|
0.0,
|
||||||
m_frame.pos.y + m_frame.size.height - m_font->getHeight(qfalse) * 4.0,
|
m_frame.pos.y + m_frame.size.height - m_font->getHeight() * 4.0,
|
||||||
m_frame.pos.x + m_frame.size.width,
|
m_frame.pos.x + m_frame.size.width,
|
||||||
m_font->getHeight(qfalse) * 4.0
|
m_font->getHeight() * 4.0
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,11 +145,11 @@ void View3D::DrawFPS(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
m_font->Print(
|
m_font->Print(
|
||||||
m_font->getHeight(qfalse) * 10.0,
|
m_font->getHeight(getHighResScale()) * 10.0 / getHighResScale()[0],
|
||||||
m_frame.pos.y + m_frame.size.height - m_font->getHeight(qfalse) * 3.0,
|
(m_frame.pos.y + m_frame.size.height - m_font->getHeight(getHighResScale()) * 3.0) / getHighResScale()[1],
|
||||||
string,
|
string,
|
||||||
-1,
|
-1,
|
||||||
qfalse
|
getHighResScale()
|
||||||
);
|
);
|
||||||
|
|
||||||
// Draw elements count
|
// Draw elements count
|
||||||
|
@ -162,11 +162,11 @@ void View3D::DrawFPS(void)
|
||||||
Com_sprintf(string, sizeof(string), "wt%5d wv%5d cl%d", cls.world_tris, cls.world_verts, cls.character_lights);
|
Com_sprintf(string, sizeof(string), "wt%5d wv%5d cl%d", cls.world_tris, cls.world_verts, cls.character_lights);
|
||||||
|
|
||||||
m_font->Print(
|
m_font->Print(
|
||||||
m_font->getHeight(qfalse) * 10.0,
|
(m_font->getHeight(getHighResScale()) * 10.0) / getHighResScale()[0],
|
||||||
m_frame.pos.y + m_frame.size.height - m_font->getHeight(qfalse) * 2.0,
|
(m_frame.pos.y + m_frame.size.height - m_font->getHeight(getHighResScale()) * 2.0) / getHighResScale()[1],
|
||||||
string,
|
string,
|
||||||
-1,
|
-1,
|
||||||
qfalse
|
getHighResScale()
|
||||||
);
|
);
|
||||||
|
|
||||||
Com_sprintf(
|
Com_sprintf(
|
||||||
|
@ -179,11 +179,11 @@ void View3D::DrawFPS(void)
|
||||||
);
|
);
|
||||||
|
|
||||||
m_font->Print(
|
m_font->Print(
|
||||||
m_font->getHeight(qfalse) * 10.0,
|
(m_font->getHeight(getHighResScale()) * 10.0) / getHighResScale()[0],
|
||||||
m_frame.pos.y + m_frame.size.height - m_font->getHeight(qfalse),
|
(m_frame.pos.y + m_frame.size.height - m_font->getHeight(getHighResScale())) / getHighResScale()[1],
|
||||||
string,
|
string,
|
||||||
-1,
|
-1,
|
||||||
qfalse
|
getHighResScale()
|
||||||
);
|
);
|
||||||
|
|
||||||
m_font->setColor(UBlack);
|
m_font->setColor(UBlack);
|
||||||
|
@ -208,32 +208,32 @@ void View3D::PrintSound(int channel, const char *name, float vol, int rvol, floa
|
||||||
float xStep;
|
float xStep;
|
||||||
float height;
|
float height;
|
||||||
|
|
||||||
height = m_font->getHeight(false);
|
height = m_font->getHeight(getHighResScale());
|
||||||
xStep = height;
|
xStep = height;
|
||||||
|
|
||||||
x = 0;
|
x = 0;
|
||||||
Com_sprintf(buf, sizeof(buf), "%d", channel);
|
Com_sprintf(buf, sizeof(buf), "%d", channel);
|
||||||
m_font->Print(x, height * line + m_frame.pos.y, buf, -1, false);
|
m_font->Print(x, height * line + m_frame.pos.y, buf, -1, getHighResScale());
|
||||||
|
|
||||||
x += xStep + xStep;
|
x += xStep + xStep;
|
||||||
Com_sprintf(buf, sizeof(buf), "%s", name);
|
Com_sprintf(buf, sizeof(buf), "%s", name);
|
||||||
m_font->Print(x, height * line + m_frame.pos.y, buf, -1, false);
|
m_font->Print(x, height * line + m_frame.pos.y, buf, -1, getHighResScale());
|
||||||
|
|
||||||
x += xStep * 30.0;
|
x += xStep * 30.0;
|
||||||
Com_sprintf(buf, sizeof(buf), "vol:%.2f", vol);
|
Com_sprintf(buf, sizeof(buf), "vol:%.2f", vol);
|
||||||
m_font->Print(x, height * line + m_frame.pos.y, buf, -1, false);
|
m_font->Print(x, height * line + m_frame.pos.y, buf, -1, getHighResScale());
|
||||||
|
|
||||||
x += xStep * 8;
|
x += xStep * 8;
|
||||||
Com_sprintf(buf, sizeof(buf), "rvol:%.2f", (float)(rvol / 128.f));
|
Com_sprintf(buf, sizeof(buf), "rvol:%.2f", (float)(rvol / 128.f));
|
||||||
m_font->Print(x, height * line + m_frame.pos.y, buf, -1, false);
|
m_font->Print(x, height * line + m_frame.pos.y, buf, -1, getHighResScale());
|
||||||
|
|
||||||
x += xStep * 5;
|
x += xStep * 5;
|
||||||
Com_sprintf(buf, sizeof(buf), "pit:%.2f", pitch);
|
Com_sprintf(buf, sizeof(buf), "pit:%.2f", pitch);
|
||||||
m_font->Print(x, height * line + m_frame.pos.y, buf, -1, false);
|
m_font->Print(x, height * line + m_frame.pos.y, buf, -1, getHighResScale());
|
||||||
|
|
||||||
x += xStep * 5;
|
x += xStep * 5;
|
||||||
Com_sprintf(buf, sizeof(buf), "base:%d", (int)base);
|
Com_sprintf(buf, sizeof(buf), "base:%d", (int)base);
|
||||||
m_font->Print(x, height * line + m_frame.pos.y, buf, -1, false);
|
m_font->Print(x, height * line + m_frame.pos.y, buf, -1, getHighResScale());
|
||||||
|
|
||||||
line++;
|
line++;
|
||||||
}
|
}
|
||||||
|
@ -264,8 +264,7 @@ void DisplayServerNetProfileInfo(UIFont *font, float y, netprofclient_t *netprof
|
||||||
(unsigned int)((float)(netprofile->outPackets.numFragmented + netprofile->inPackets.numFragmented)
|
(unsigned int)((float)(netprofile->outPackets.numFragmented + netprofile->inPackets.numFragmented)
|
||||||
/ (float)(netprofile->inPackets.totalProcessed + netprofile->outPackets.totalProcessed)
|
/ (float)(netprofile->inPackets.totalProcessed + netprofile->outPackets.totalProcessed)
|
||||||
)),
|
)),
|
||||||
-1,
|
-1
|
||||||
qfalse
|
|
||||||
);
|
);
|
||||||
font->Print(334, y, va("%i", netprofile->inPackets.percentDropped));
|
font->Print(334, y, va("%i", netprofile->inPackets.percentDropped));
|
||||||
font->Print(364, y, va("%i", netprofile->outPackets.percentDropped));
|
font->Print(364, y, va("%i", netprofile->outPackets.percentDropped));
|
||||||
|
@ -276,8 +275,7 @@ void DisplayServerNetProfileInfo(UIFont *font, float y, netprofclient_t *netprof
|
||||||
(unsigned int)((float)(netprofile->outPackets.numDropped + netprofile->inPackets.numDropped)
|
(unsigned int)((float)(netprofile->outPackets.numDropped + netprofile->inPackets.numDropped)
|
||||||
/ (float)(netprofile->inPackets.totalProcessed + netprofile->outPackets.totalProcessed)
|
/ (float)(netprofile->inPackets.totalProcessed + netprofile->outPackets.totalProcessed)
|
||||||
)),
|
)),
|
||||||
-1,
|
-1
|
||||||
qfalse
|
|
||||||
);
|
);
|
||||||
font->Print(434, y, va("%i", netprofile->inPackets.percentDropped));
|
font->Print(434, y, va("%i", netprofile->inPackets.percentDropped));
|
||||||
font->Print(464, y, va("%i", netprofile->outPackets.percentDropped));
|
font->Print(464, y, va("%i", netprofile->outPackets.percentDropped));
|
||||||
|
@ -288,8 +286,7 @@ void DisplayServerNetProfileInfo(UIFont *font, float y, netprofclient_t *netprof
|
||||||
(unsigned int)((float)(netprofile->outPackets.totalLengthConnectionLess
|
(unsigned int)((float)(netprofile->outPackets.totalLengthConnectionLess
|
||||||
+ netprofile->inPackets.totalLengthConnectionLess)
|
+ netprofile->inPackets.totalLengthConnectionLess)
|
||||||
/ (float)(netprofile->outPackets.totalSize + netprofile->inPackets.totalSize))),
|
/ (float)(netprofile->outPackets.totalSize + netprofile->inPackets.totalSize))),
|
||||||
-1,
|
-1
|
||||||
qfalse
|
|
||||||
);
|
);
|
||||||
font->Print(534, y, va("%i", netprofile->inPackets.bytesPerSec));
|
font->Print(534, y, va("%i", netprofile->inPackets.bytesPerSec));
|
||||||
font->Print(594, y, va("%i", netprofile->outPackets.bytesPerSec));
|
font->Print(594, y, va("%i", netprofile->outPackets.bytesPerSec));
|
||||||
|
@ -303,7 +300,7 @@ void DisplayClientNetProfile(UIFont *font, float x, float y, netprofclient_t *ne
|
||||||
float fontHeight;
|
float fontHeight;
|
||||||
float columnHeight;
|
float columnHeight;
|
||||||
|
|
||||||
fontHeight = font->getHeight(qfalse);
|
fontHeight = font->getHeight();
|
||||||
columns[0] = x + 120;
|
columns[0] = x + 120;
|
||||||
columns[1] = x + 230;
|
columns[1] = x + 230;
|
||||||
columns[2] = x + 330;
|
columns[2] = x + 330;
|
||||||
|
@ -402,13 +399,13 @@ void View3D::DrawNetProfile(void)
|
||||||
setFont("verdana-14");
|
setFont("verdana-14");
|
||||||
m_font->setColor(UWhite);
|
m_font->setColor(UWhite);
|
||||||
|
|
||||||
fontHeight = m_font->getHeight(qfalse);
|
fontHeight = m_font->getHeight();
|
||||||
yOffset = sv_netprofileoverlay->integer + 8;
|
yOffset = sv_netprofileoverlay->integer + 8;
|
||||||
|
|
||||||
if (svs.netprofile.rate) {
|
if (svs.netprofile.rate) {
|
||||||
m_font->Print(8, yOffset, va("Server Net Profile Max Rate: %i", svs.netprofile.rate), -1, qfalse);
|
m_font->Print(8, yOffset, va("Server Net Profile Max Rate: %i", svs.netprofile.rate), -1);
|
||||||
} else {
|
} else {
|
||||||
m_font->Print(8, yOffset, "Server Net Profile Max Rate: none", -1, qfalse);
|
m_font->Print(8, yOffset, "Server Net Profile Max Rate: none", -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
columnHeight = fontHeight + fontHeight + yOffset;
|
columnHeight = fontHeight + fontHeight + yOffset;
|
||||||
|
@ -487,10 +484,10 @@ void View3D::DrawNetProfile(void)
|
||||||
setFont("verdana-14");
|
setFont("verdana-14");
|
||||||
m_font->setColor(UWhite);
|
m_font->setColor(UWhite);
|
||||||
|
|
||||||
fontHeight = m_font->getHeight(qfalse);
|
fontHeight = m_font->getHeight();
|
||||||
yOffset = cl_netprofileoverlay->integer + 16;
|
yOffset = cl_netprofileoverlay->integer + 16;
|
||||||
|
|
||||||
m_font->Print(16, yOffset, "Client Net Profile", -1, qfalse);
|
m_font->Print(16, yOffset, "Client Net Profile", -1);
|
||||||
|
|
||||||
NetProfileCalcStats(&cls.netprofile.outPackets, 500);
|
NetProfileCalcStats(&cls.netprofile.outPackets, 500);
|
||||||
NetProfileCalcStats(&cls.netprofile.inPackets, 500);
|
NetProfileCalcStats(&cls.netprofile.inPackets, 500);
|
||||||
|
@ -567,7 +564,7 @@ void View3D::CenterPrint(void)
|
||||||
m_iFontAlignmentHorizontal,
|
m_iFontAlignmentHorizontal,
|
||||||
m_iFontAlignmentVertical,
|
m_iFontAlignmentVertical,
|
||||||
p,
|
p,
|
||||||
m_bVirtual ? m_vVirtualScale : NULL
|
getVirtualScale()
|
||||||
);
|
);
|
||||||
|
|
||||||
m_font->setColor(UColor(1, 1, 1, alpha));
|
m_font->setColor(UColor(1, 1, 1, alpha));
|
||||||
|
@ -575,7 +572,7 @@ void View3D::CenterPrint(void)
|
||||||
frame = getClientFrame();
|
frame = getClientFrame();
|
||||||
|
|
||||||
m_font->PrintJustified(
|
m_font->PrintJustified(
|
||||||
frame, m_iFontAlignmentHorizontal, m_iFontAlignmentVertical, p, m_bVirtual ? m_vVirtualScale : NULL
|
frame, m_iFontAlignmentHorizontal, m_iFontAlignmentVertical, p, getVirtualScale()
|
||||||
);
|
);
|
||||||
|
|
||||||
m_font->setColor(UBlack);
|
m_font->setColor(UBlack);
|
||||||
|
@ -628,7 +625,7 @@ void View3D::LocationPrint(void)
|
||||||
alpha = Q_clamp_float(alpha, 0, 1);
|
alpha = Q_clamp_float(alpha, 0, 1);
|
||||||
|
|
||||||
x = m_x_coord / 640.f * m_screenframe.size.width;
|
x = m_x_coord / 640.f * m_screenframe.size.width;
|
||||||
y = (480 - m_font->getHeight(false) - m_y_coord) / 480.f * m_screenframe.size.height;
|
y = (480 - m_font->getHeight(getHighResScale()) - m_y_coord) / 480.f * m_screenframe.size.height;
|
||||||
|
|
||||||
if (m_x_coord == -1) {
|
if (m_x_coord == -1) {
|
||||||
horiz = FONT_JUSTHORZ_CENTER;
|
horiz = FONT_JUSTHORZ_CENTER;
|
||||||
|
@ -647,7 +644,7 @@ void View3D::LocationPrint(void)
|
||||||
horiz,
|
horiz,
|
||||||
vert,
|
vert,
|
||||||
p,
|
p,
|
||||||
m_bVirtual ? m_vVirtualScale : NULL
|
getVirtualScale()
|
||||||
);
|
);
|
||||||
|
|
||||||
m_font->setColor(UColor(1, 1, 1, alpha));
|
m_font->setColor(UColor(1, 1, 1, alpha));
|
||||||
|
@ -658,7 +655,7 @@ void View3D::LocationPrint(void)
|
||||||
horiz,
|
horiz,
|
||||||
vert,
|
vert,
|
||||||
p,
|
p,
|
||||||
m_bVirtual ? m_vVirtualScale : NULL
|
getVirtualScale()
|
||||||
);
|
);
|
||||||
|
|
||||||
m_font->setColor(UBlack);
|
m_font->setColor(UBlack);
|
||||||
|
@ -746,7 +743,7 @@ void View3D::DrawSubtitleOverlay(void)
|
||||||
{
|
{
|
||||||
cvar_t *subAlpha;
|
cvar_t *subAlpha;
|
||||||
int i;
|
int i;
|
||||||
float minX, maxY;
|
float minX, maxX;
|
||||||
int line;
|
int line;
|
||||||
|
|
||||||
subAlpha = Cvar_Get("subAlpha", "0.5", 0);
|
subAlpha = Cvar_Get("subAlpha", "0.5", 0);
|
||||||
|
@ -781,8 +778,8 @@ void View3D::DrawSubtitleOverlay(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
minX = m_screenframe.size.height - m_font->getHeight(false) * 10;
|
minX = m_screenframe.size.height - m_font->getHeight(getHighResScale()) * 10;
|
||||||
maxY = (m_frame.pos.x + m_frame.size.width) - (m_frame.pos.x + m_frame.size.width) * 0.2f;
|
maxX = ((m_frame.pos.x + m_frame.size.width) - (m_frame.pos.x + m_frame.size.width) * 0.2f) / getHighResScale()[0];
|
||||||
line = 0;
|
line = 0;
|
||||||
|
|
||||||
for (i = 0; i < MAX_SUBTITLES; i++) {
|
for (i = 0; i < MAX_SUBTITLES; i++) {
|
||||||
|
@ -790,7 +787,7 @@ void View3D::DrawSubtitleOverlay(void)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_font->getWidth(subs[i]->string, sizeof(oldStrings[i])) > maxY) {
|
if (m_font->getWidth(subs[i]->string, sizeof(oldStrings[i])) > maxX) {
|
||||||
char buf[2048];
|
char buf[2048];
|
||||||
char *c;
|
char *c;
|
||||||
char *end;
|
char *end;
|
||||||
|
@ -813,12 +810,12 @@ void View3D::DrawSubtitleOverlay(void)
|
||||||
|
|
||||||
width = m_font->getWidth(c, blockcount);
|
width = m_font->getWidth(c, blockcount);
|
||||||
|
|
||||||
if (total + width > maxY) {
|
if (total + width > maxX) {
|
||||||
m_font->setColor(UColor(0, 0, 0, alpha[i] * subAlpha->value));
|
m_font->setColor(UColor(0, 0, 0, alpha[i] * subAlpha->value));
|
||||||
m_font->Print(18, m_font->getHeight(false) * line + minX + 1.f, buf, -1, false);
|
m_font->Print(18, (m_font->getHeight(getHighResScale()) * line + minX + 1.f) / getHighResScale()[1], buf, -1, getHighResScale());
|
||||||
|
|
||||||
m_font->setColor(UColor(1, 1, 1, alpha[i] * subAlpha->value));
|
m_font->setColor(UColor(1, 1, 1, alpha[i] * subAlpha->value));
|
||||||
m_font->Print(20, m_font->getHeight(false) * line + minX, buf, -1, false);
|
m_font->Print(20, (m_font->getHeight(getHighResScale()) * line + minX) / getHighResScale()[1], buf, -1, getHighResScale());
|
||||||
|
|
||||||
line++;
|
line++;
|
||||||
|
|
||||||
|
@ -841,17 +838,17 @@ void View3D::DrawSubtitleOverlay(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
m_font->setColor(UColor(0, 0, 0, alpha[i] * subAlpha->value));
|
m_font->setColor(UColor(0, 0, 0, alpha[i] * subAlpha->value));
|
||||||
m_font->Print(18, m_font->getHeight(false) * line + minX + 1.f, buf, -1, qfalse);
|
m_font->Print(18, (m_font->getHeight(getHighResScale()) * line + minX + 1.f) / getHighResScale()[1], buf, -1, getHighResScale());
|
||||||
|
|
||||||
m_font->setColor(UColor(1, 1, 1, alpha[i] * subAlpha->value));
|
m_font->setColor(UColor(1, 1, 1, alpha[i] * subAlpha->value));
|
||||||
m_font->Print(20, m_font->getHeight(false) * line + minX, buf, -1, qfalse);
|
m_font->Print(20, (m_font->getHeight(getHighResScale()) * line + minX) / getHighResScale()[1], buf, -1, getHighResScale());
|
||||||
line++;
|
line++;
|
||||||
} else {
|
} else {
|
||||||
m_font->setColor(UColor(0, 0, 0, alpha[i] * subAlpha->value));
|
m_font->setColor(UColor(0, 0, 0, alpha[i] * subAlpha->value));
|
||||||
m_font->Print(18, m_font->getHeight(false) * line + minX + 1.f, subs[i]->string, -1, qfalse);
|
m_font->Print(18, (m_font->getHeight(getHighResScale()) * line + minX + 1.f) / getHighResScale()[1], subs[i]->string, -1, getHighResScale());
|
||||||
|
|
||||||
m_font->setColor(UColor(1, 1, 1, alpha[i] * subAlpha->value));
|
m_font->setColor(UColor(1, 1, 1, alpha[i] * subAlpha->value));
|
||||||
m_font->Print(20, m_font->getHeight(false) * line + minX, subs[i]->string, -1, qfalse);
|
m_font->Print(20, (m_font->getHeight(getHighResScale()) * line + minX) / getHighResScale()[1], subs[i]->string, -1, getHighResScale());
|
||||||
|
|
||||||
line++;
|
line++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -525,7 +525,7 @@ void R_LoadFontShader(fontheader_sgl_t* font)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_DrawString_sgl(fontheader_sgl_t* font, const char* text, float x, float y, int maxlen, qboolean bVirtualScreen) {
|
void R_DrawString_sgl(fontheader_sgl_t* font, const char* text, float x, float y, int maxlen, const float *pvVirtualScreen) {
|
||||||
float charHeight;
|
float charHeight;
|
||||||
float startx, starty;
|
float startx, starty;
|
||||||
int i;
|
int i;
|
||||||
|
@ -534,8 +534,19 @@ void R_DrawString_sgl(fontheader_sgl_t* font, const char* text, float x, float y
|
||||||
i = 0;
|
i = 0;
|
||||||
startx = x;
|
startx = x;
|
||||||
starty = y;
|
starty = y;
|
||||||
fWidthScale = (double)glConfig.vidWidth / 640.0;
|
if (pvVirtualScreen) {
|
||||||
fHeightScale = (double)glConfig.vidHeight / 480.0;
|
if (pvVirtualScreen[0]) {
|
||||||
|
fWidthScale = pvVirtualScreen[0];
|
||||||
|
} else {
|
||||||
|
fWidthScale = (double)glConfig.vidWidth / 640.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pvVirtualScreen[1]) {
|
||||||
|
fHeightScale = pvVirtualScreen[1];
|
||||||
|
} else {
|
||||||
|
fHeightScale = (double)glConfig.vidHeight / 480.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!font) {
|
if (!font) {
|
||||||
return;
|
return;
|
||||||
|
@ -636,7 +647,7 @@ void R_DrawString_sgl(fontheader_sgl_t* font, const char* text, float x, float y
|
||||||
tess.indexes[tess.numIndexes + 4] = tess.numVertexes + 3;
|
tess.indexes[tess.numIndexes + 4] = tess.numVertexes + 3;
|
||||||
tess.indexes[tess.numIndexes + 5] = tess.numVertexes + 2;
|
tess.indexes[tess.numIndexes + 5] = tess.numVertexes + 2;
|
||||||
|
|
||||||
if (bVirtualScreen)
|
if (pvVirtualScreen)
|
||||||
{
|
{
|
||||||
// scale the string properly if virtual screen
|
// scale the string properly if virtual screen
|
||||||
tess.xyz[tess.numVertexes][0] *= fWidthScale;
|
tess.xyz[tess.numVertexes][0] *= fWidthScale;
|
||||||
|
@ -659,7 +670,7 @@ void R_DrawString_sgl(fontheader_sgl_t* font, const char* text, float x, float y
|
||||||
RB_EndSurface();
|
RB_EndSurface();
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_DrawString(fontheader_t* font, const char* text, float x, float y, int maxlen, qboolean bVirtualScreen) {
|
void R_DrawString(fontheader_t* font, const char* text, float x, float y, int maxlen, const float *pvVirtualScreen) {
|
||||||
int i;
|
int i;
|
||||||
int code;
|
int code;
|
||||||
unsigned short uch;
|
unsigned short uch;
|
||||||
|
@ -671,7 +682,7 @@ void R_DrawString(fontheader_t* font, const char* text, float x, float y, int ma
|
||||||
|
|
||||||
if (!font->numPages) {
|
if (!font->numPages) {
|
||||||
if (font->sgl[0]) {
|
if (font->sgl[0]) {
|
||||||
R_DrawString_sgl(font->sgl[0], text, x, y, maxlen, bVirtualScreen);
|
R_DrawString_sgl(font->sgl[0], text, x, y, maxlen, pvVirtualScreen);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -704,7 +715,7 @@ void R_DrawString(fontheader_t* font, const char* text, float x, float y, int ma
|
||||||
|
|
||||||
if (uch == '\n' || uch == '\r') {
|
if (uch == '\n' || uch == '\r') {
|
||||||
buffer[buflen] = 0;
|
buffer[buflen] = 0;
|
||||||
R_DrawString_sgl(font->sgl[cursgl], buffer, curX, curY, maxlen, bVirtualScreen);
|
R_DrawString_sgl(font->sgl[cursgl], buffer, curX, curY, maxlen, pvVirtualScreen);
|
||||||
|
|
||||||
curX = x;
|
curX = x;
|
||||||
curHeight = 0.f;
|
curHeight = 0.f;
|
||||||
|
@ -728,7 +739,7 @@ void R_DrawString(fontheader_t* font, const char* text, float x, float y, int ma
|
||||||
ct = &font->charTable[code];
|
ct = &font->charTable[code];
|
||||||
if (cursgl != ct->index || buflen >= ARRAY_LEN(buffer) - 2) {
|
if (cursgl != ct->index || buflen >= ARRAY_LEN(buffer) - 2) {
|
||||||
buffer[buflen] = 0;
|
buffer[buflen] = 0;
|
||||||
R_DrawString_sgl(font->sgl[cursgl], buffer, curX, curY, maxlen, bVirtualScreen);
|
R_DrawString_sgl(font->sgl[cursgl], buffer, curX, curY, maxlen, pvVirtualScreen);
|
||||||
|
|
||||||
curX += curHeight;
|
curX += curHeight;
|
||||||
curHeight = 0.f;
|
curHeight = 0.f;
|
||||||
|
@ -744,7 +755,7 @@ void R_DrawString(fontheader_t* font, const char* text, float x, float y, int ma
|
||||||
if (buflen)
|
if (buflen)
|
||||||
{
|
{
|
||||||
buffer[buflen] = 0;
|
buffer[buflen] = 0;
|
||||||
R_DrawString_sgl(font->sgl[cursgl], buffer, curX, y, buflen, bVirtualScreen);
|
R_DrawString_sgl(font->sgl[cursgl], buffer, curX, y, buflen, pvVirtualScreen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2084,7 +2084,7 @@ FONT
|
||||||
*/
|
*/
|
||||||
fontheader_t* R_LoadFont(const char* name);
|
fontheader_t* R_LoadFont(const char* name);
|
||||||
void R_LoadFontShader(fontheader_sgl_t* font);
|
void R_LoadFontShader(fontheader_sgl_t* font);
|
||||||
void R_DrawString(fontheader_t* font, const char* text, float x, float y, int maxlen, qboolean bVirtualScreen);
|
void R_DrawString(fontheader_t* font, const char* text, float x, float y, int maxlen, const float *pvVirtualScreen);
|
||||||
void R_DrawFloatingString(fontheader_t* font, const char* text, const vec3_t org, const vec4_t color, float scale, int maxlen);
|
void R_DrawFloatingString(fontheader_t* font, const char* text, const vec3_t org, const vec4_t color, float scale, int maxlen);
|
||||||
float R_GetFontHeight(const fontheader_t* font);
|
float R_GetFontHeight(const fontheader_t* font);
|
||||||
float R_GetFontStringWidth(const fontheader_t* font, const char* s);
|
float R_GetFontStringWidth(const fontheader_t* font, const char* s);
|
||||||
|
|
|
@ -152,7 +152,7 @@ typedef struct {
|
||||||
float (*ModelRadius)(qhandle_t handle);
|
float (*ModelRadius)(qhandle_t handle);
|
||||||
|
|
||||||
dtiki_t* (*R_Model_GetHandle)(qhandle_t handle);
|
dtiki_t* (*R_Model_GetHandle)(qhandle_t handle);
|
||||||
void (*DrawString)(fontheader_t* font, const char* text, float x, float y, int maxLen, qboolean virtualScreen);
|
void (*DrawString)(fontheader_t* font, const char* text, float x, float y, int maxLen, const float *pvVirtualScreen);
|
||||||
float (*GetFontHeight)(const fontheader_t* font);
|
float (*GetFontHeight)(const fontheader_t* font);
|
||||||
float (*GetFontStringWidth)(const fontheader_t* font, const char* string);
|
float (*GetFontStringWidth)(const fontheader_t* font, const char* string);
|
||||||
fontheader_t* (*LoadFont)(const char* name);
|
fontheader_t* (*LoadFont)(const char* name);
|
||||||
|
|
|
@ -80,7 +80,7 @@ typedef struct uiimport_s {
|
||||||
void( *Rend_DrawPicStretched2 )( float x, float y, float w, float h, float s1, float t1, float s2, float t2, float sx, float sy, qhandle_t hShader );
|
void( *Rend_DrawPicStretched2 )( float x, float y, float w, float h, float s1, float t1, float s2, float t2, float sx, float sy, qhandle_t hShader );
|
||||||
void( *Rend_DrawPicTiled )( float x, float y, float w, float h, qhandle_t hShader );
|
void( *Rend_DrawPicTiled )( float x, float y, float w, float h, qhandle_t hShader );
|
||||||
fontheader_t *( *Rend_LoadFont )( const char *name );
|
fontheader_t *( *Rend_LoadFont )( const char *name );
|
||||||
void( *Rend_DrawString )( fontheader_t *font, const char *text, float x, float y, int maxlen, qboolean bVirtualScreen );
|
void( *Rend_DrawString )( fontheader_t *font, const char *text, float x, float y, int maxlen, const float *pvVirtualScreen );
|
||||||
void( *Rend_DrawBox )( float x, float y, float w, float h );
|
void( *Rend_DrawBox )( float x, float y, float w, float h );
|
||||||
int( *Rend_GetShaderWidth )( qhandle_t hShader );
|
int( *Rend_GetShaderWidth )( qhandle_t hShader );
|
||||||
int( *Rend_GetShaderHeight )( qhandle_t hShader );
|
int( *Rend_GetShaderHeight )( qhandle_t hShader );
|
||||||
|
@ -162,7 +162,9 @@ typedef struct uidef_s {
|
||||||
int mouseX;
|
int mouseX;
|
||||||
int mouseY;
|
int mouseY;
|
||||||
unsigned int mouseFlags;
|
unsigned int mouseFlags;
|
||||||
int uiHasMouse;
|
qboolean uiHasMouse;
|
||||||
|
qboolean bHighResScaling;
|
||||||
|
vec2_t scaleRes;
|
||||||
} uidef_t;
|
} uidef_t;
|
||||||
|
|
||||||
extern uidef_t uid;
|
extern uidef_t uid;
|
||||||
|
|
|
@ -258,7 +258,7 @@ void UIButton::DrawPressed
|
||||||
m_iFontAlignmentHorizontal,
|
m_iFontAlignmentHorizontal,
|
||||||
m_iFontAlignmentVertical,
|
m_iFontAlignmentVertical,
|
||||||
Sys_LV_CL_ConvertString(m_title.c_str()),
|
Sys_LV_CL_ConvertString(m_title.c_str()),
|
||||||
m_bVirtual ? m_vVirtualScale : NULL
|
getVirtualScale()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,7 +278,7 @@ void UIButton::DrawUnpressed
|
||||||
m_iFontAlignmentHorizontal,
|
m_iFontAlignmentHorizontal,
|
||||||
m_iFontAlignmentVertical,
|
m_iFontAlignmentVertical,
|
||||||
Sys_LV_CL_ConvertString(m_title.c_str()),
|
Sys_LV_CL_ConvertString(m_title.c_str()),
|
||||||
m_bVirtual ? m_vVirtualScale : NULL
|
getVirtualScale()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -155,13 +155,15 @@ void UIConsole::DrawBottomLine
|
||||||
int promptwidth;
|
int promptwidth;
|
||||||
static str prompt = ">";
|
static str prompt = ">";
|
||||||
int top;
|
int top;
|
||||||
|
float topScaled;
|
||||||
int iXPos;
|
int iXPos;
|
||||||
int iMaxStringWidth;
|
int iMaxStringWidth;
|
||||||
int widthbeforecaret;
|
int widthbeforecaret;
|
||||||
|
|
||||||
promptwidth = m_font->getWidth(prompt.c_str(), -1);
|
promptwidth = m_font->getWidth(prompt.c_str(), -1);
|
||||||
top = m_frame.size.height - m_font->getHeight(qfalse);
|
top = m_frame.size.height - m_font->getHeight(getHighResScale());
|
||||||
m_font->Print(0.0, top, prompt.c_str(), -1, qfalse);
|
topScaled = top / getHighResScale()[1];
|
||||||
|
m_font->Print(0.0, topScaled, prompt.c_str(), -1, getHighResScale());
|
||||||
|
|
||||||
iXPos = promptwidth + 1;
|
iXPos = promptwidth + 1;
|
||||||
iMaxStringWidth = m_frame.size.width - iXPos - m_scroll->getSize().width;
|
iMaxStringWidth = m_frame.size.width - iXPos - m_scroll->getSize().width;
|
||||||
|
@ -187,12 +189,12 @@ void UIConsole::DrawBottomLine
|
||||||
|
|
||||||
if (widthbeforecaret < iMaxStringWidth)
|
if (widthbeforecaret < iMaxStringWidth)
|
||||||
{
|
{
|
||||||
m_font->Print(iXPos, top, m_currentline.c_str(), -1, qfalse);
|
m_font->Print(iXPos, topScaled, m_currentline.c_str(), -1, getHighResScale());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
indicatorwidth = m_font->getWidth(indicator.c_str(), -1);
|
indicatorwidth = m_font->getWidth(indicator.c_str(), -1);
|
||||||
m_font->Print(iXPos, top, indicator.c_str(), -1, 0);
|
m_font->Print(iXPos, topScaled, indicator.c_str(), -1, getHighResScale());
|
||||||
|
|
||||||
iXPos += indicatorwidth;
|
iXPos += indicatorwidth;
|
||||||
iMaxStringWidth -= indicatorwidth;
|
iMaxStringWidth -= indicatorwidth;
|
||||||
|
@ -207,7 +209,7 @@ void UIConsole::DrawBottomLine
|
||||||
iCharLength = m_font->getCharWidth(pString[iChar - 1]);
|
iCharLength = m_font->getCharWidth(pString[iChar - 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_font->Print(iXPos, top, pString + 1, -1, qfalse);
|
m_font->Print(iXPos, topScaled, pString + 1, -1, getHighResScale());
|
||||||
widthbeforecaret = iXPos + m_font->getWidth(pString + 1, m_caret - iChar);
|
widthbeforecaret = iXPos + m_font->getWidth(pString + 1, m_caret - iChar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -218,19 +220,19 @@ void UIConsole::DrawBottomLine
|
||||||
|
|
||||||
completewidth = m_font->getWidth(m_completionbuffer.c_str(), -1);
|
completewidth = m_font->getWidth(m_completionbuffer.c_str(), -1);
|
||||||
linewidth = m_font->getWidth(&m_currentline[m_completionbuffer.length()], -1);
|
linewidth = m_font->getWidth(&m_currentline[m_completionbuffer.length()], -1);
|
||||||
m_font->Print(iXPos, top, m_completionbuffer.c_str(), -1, qfalse);
|
m_font->Print(iXPos, topScaled, m_completionbuffer.c_str(), -1, getHighResScale());
|
||||||
|
|
||||||
iXPos += completewidth;
|
iXPos += completewidth;
|
||||||
m_font->Print(iXPos, top, &m_currentline[m_completionbuffer.length()], -1, 0);
|
m_font->Print(iXPos, topScaled, &m_currentline[m_completionbuffer.length()], -1, getHighResScale());
|
||||||
|
|
||||||
DrawBoxWithSolidBorder(UIRect2D(iXPos, top, linewidth, m_font->getHeight(qfalse)), UBlack, URed, 1, 2, 1.0);
|
DrawBoxWithSolidBorder(UIRect2D(iXPos * getHighResScale()[0], top, linewidth * getHighResScale()[0], m_font->getHeight(getHighResScale())), UBlack, URed, 1, 2, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Make the caret blink
|
// Make the caret blink
|
||||||
//
|
//
|
||||||
if ((uid.time % 750) > 375 && IsActive()) {
|
if ((uid.time % 750) > 375 && IsActive()) {
|
||||||
DrawBox(UIRect2D(widthbeforecaret, top, 1.0, m_font->getHeight(qfalse)), m_foreground_color, 1.0);
|
DrawBox(UIRect2D(widthbeforecaret * getHighResScale()[0], top, 1.0, m_font->getHeight(getHighResScale())), m_foreground_color, 1.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -503,7 +505,7 @@ void UIConsole::Draw
|
||||||
int lines_drawn, at_line;
|
int lines_drawn, at_line;
|
||||||
int topitem;
|
int topitem;
|
||||||
|
|
||||||
top = (int)(m_frame.size.height - m_font->getHeight(false) * (m_scroll->getPageHeight() + 2));
|
top = (int)(m_frame.size.height - m_font->getHeight(getHighResScale()) * (m_scroll->getPageHeight() + 2));
|
||||||
item = m_firstitem;
|
item = m_firstitem;
|
||||||
topitem = m_scroll->getTopItem() - 1;
|
topitem = m_scroll->getTopItem() - 1;
|
||||||
|
|
||||||
|
@ -553,10 +555,10 @@ void UIConsole::Draw
|
||||||
}
|
}
|
||||||
|
|
||||||
m_font->setAlpha(m_alpha);
|
m_font->setAlpha(m_alpha);
|
||||||
m_font->Print(0.0, top, &theItem->string.c_str()[theItem->begins[at_line]], theItem->breaks[at_line], 0);
|
m_font->Print(0.0, top / getHighResScale()[1], &theItem->string.c_str()[theItem->begins[at_line]], theItem->breaks[at_line], getHighResScale());
|
||||||
}
|
}
|
||||||
|
|
||||||
top += m_font->getHeight(false);
|
top += m_font->getHeight(getHighResScale());
|
||||||
lines_drawn++;
|
lines_drawn++;
|
||||||
at_line++;
|
at_line++;
|
||||||
}
|
}
|
||||||
|
@ -813,7 +815,7 @@ void UIConsole::OnSizeChanged
|
||||||
attop = false;
|
attop = false;
|
||||||
atbottom = false;
|
atbottom = false;
|
||||||
|
|
||||||
linesperpage = (m_frame.size.height / (float)m_font->getHeight(qfalse));
|
linesperpage = (m_frame.size.height / (float)m_font->getHeight(getHighResScale()));
|
||||||
m_scroll->InitFrameAlignRight(this, 0, 0);
|
m_scroll->InitFrameAlignRight(this, 0, 0);
|
||||||
|
|
||||||
if (ev)
|
if (ev)
|
||||||
|
@ -906,13 +908,13 @@ void UIFloatingConsole::FrameInitialized
|
||||||
// call the parent initialisation
|
// call the parent initialisation
|
||||||
UIFloatingWindow::FrameInitialized();
|
UIFloatingWindow::FrameInitialized();
|
||||||
|
|
||||||
m_status = new UIStatusBar(alignment_t::WND_ALIGN_BOTTOM, 20.0);
|
m_status = new UIStatusBar(alignment_t::WND_ALIGN_BOTTOM, 20.0 * getHighResScale()[1]);
|
||||||
m_status->InitFrame(getChildSpace(), UIRect2D(0, 0, 20.0, 20.0), 0, "verdana-12");
|
m_status->InitFrame(getChildSpace(), UIRect2D(0, 0, 20.0 * getHighResScale()[0], 20.0 * getHighResScale()[1]), 0, "verdana-12");
|
||||||
m_status->EnableSizeBox(this);
|
m_status->EnableSizeBox(this);
|
||||||
m_status->setTitle(str());
|
m_status->setTitle(str());
|
||||||
|
|
||||||
m_console = new UIConsole();
|
m_console = new UIConsole();
|
||||||
m_console->InitFrame(getChildSpace(), UIRect2D(0, 0, 20.0, 20.0), 0, "verdana-14");
|
m_console->InitFrame(getChildSpace(), UIRect2D(0, 0, 20.0 * getHighResScale()[0], 20.0 * getHighResScale()[1]), 0, "verdana-14");
|
||||||
setConsoleColor(m_consoleColor);
|
setConsoleColor(m_consoleColor);
|
||||||
setConsoleBackground(m_consoleBackground, m_consoleAlpha);
|
setConsoleBackground(m_consoleBackground, m_consoleAlpha);
|
||||||
m_console->setConsoleHandler(m_handler);
|
m_console->setConsoleHandler(m_handler);
|
||||||
|
@ -1423,7 +1425,7 @@ void UIFloatingDMConsole::FrameInitialized
|
||||||
UIFloatingWindow::FrameInitialized();
|
UIFloatingWindow::FrameInitialized();
|
||||||
|
|
||||||
m_console = new UIDMConsole();
|
m_console = new UIDMConsole();
|
||||||
m_console->InitFrame(getChildSpace(), UIRect2D(0, 0, 20.0, 20.0), 0, "facfont-20");
|
m_console->InitFrame(getChildSpace(), UIRect2D(0, 0, 20.0 * getHighResScale()[0], 20.0 * getHighResScale()[1]), 0, "facfont-20");
|
||||||
|
|
||||||
m_console->Connect(this, W_Deactivated, W_Deactivated);
|
m_console->Connect(this, W_Deactivated, W_Deactivated);
|
||||||
setConsoleColor(m_consoleColor);
|
setConsoleColor(m_consoleColor);
|
||||||
|
@ -1456,7 +1458,6 @@ void UIFloatingDMConsole::OnChildSizeChanged
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
m_console->setFrame(UIRect2D(UIPoint2D(0, 0), childSpaceSize));
|
m_console->setFrame(UIRect2D(UIPoint2D(0, 0), childSpaceSize));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ void UIField::Draw(void)
|
||||||
UpdateData();
|
UpdateData();
|
||||||
|
|
||||||
// the width of the widget that can be filled with valid text
|
// the width of the widget that can be filled with valid text
|
||||||
float fVirtualWidth = m_frame.size.width / m_vVirtualScale[0] - m_font->getWidth(" ..", -1);
|
float fVirtualWidth = m_frame.size.width / getVirtualScale()[0] - m_font->getWidth(" ..", -1);
|
||||||
float indentLength = m_indent;
|
float indentLength = m_indent;
|
||||||
float cursorSize = m_font->getCharWidth('_');
|
float cursorSize = m_font->getCharWidth('_');
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ void UIField::Draw(void)
|
||||||
cursorPos = Q_min(cursorPos, fVirtualWidth);
|
cursorPos = Q_min(cursorPos, fVirtualWidth);
|
||||||
|
|
||||||
// Calculate text height
|
// Calculate text height
|
||||||
float y = m_frame.size.height / m_vVirtualScale[1] - m_font->getHeight(qfalse);
|
float y = m_frame.size.height / getVirtualScale()[1] - m_font->getHeight();
|
||||||
if (m_bottomindent * 2 <= y) // upper and lower margin
|
if (m_bottomindent * 2 <= y) // upper and lower margin
|
||||||
{
|
{
|
||||||
y -= m_bottomindent;
|
y -= m_bottomindent;
|
||||||
|
@ -135,27 +135,27 @@ void UIField::Draw(void)
|
||||||
|
|
||||||
// Show text
|
// Show text
|
||||||
m_font->setColor(m_foreground_color);
|
m_font->setColor(m_foreground_color);
|
||||||
m_font->Print(m_indent, y, temptext, -1, m_bVirtual);
|
m_font->Print(m_indent, y, temptext, -1, getVirtualScale());
|
||||||
|
|
||||||
// Display blinking cursor if field is in focus
|
// Display blinking cursor if field is in focus
|
||||||
if (IsActive()) {
|
if (IsActive()) {
|
||||||
const char *cursorChar = (uid.time / 250) & 1 ? "|" : "_";
|
const char *cursorChar = (uid.time / 250) & 1 ? "|" : "_";
|
||||||
m_font->Print(cursorPos, y, cursorChar, -1, m_bVirtual);
|
m_font->Print(cursorPos, y, cursorChar, -1, getVirtualScale());
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_strncpyz(temptext, "..", EDITFIELD_BUFSIZE);
|
Q_strncpyz(temptext, "..", EDITFIELD_BUFSIZE);
|
||||||
|
|
||||||
if (m_iPreStep) {
|
if (m_iPreStep) {
|
||||||
// Display leading dots if not starting from the beginning
|
// Display leading dots if not starting from the beginning
|
||||||
m_font->Print(2.0f, y, temptext, -1, m_bVirtual);
|
m_font->Print(2.0f, y, temptext, -1, getVirtualScale());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Added in OPM
|
// Added in OPM
|
||||||
// new iLastChar < EDITFIELD_BUFSIZE check for extra safety
|
// new iLastChar < EDITFIELD_BUFSIZE check for extra safety
|
||||||
if (iLastChar < EDITFIELD_BUFSIZE && m_edit.m_buffer[iLastChar]) {
|
if (iLastChar < EDITFIELD_BUFSIZE && m_edit.m_buffer[iLastChar]) {
|
||||||
// Display trailing dots if not ending at the end
|
// Display trailing dots if not ending at the end
|
||||||
fVirtualWidth = m_frame.size.width / m_vVirtualScale[0] - m_font->getWidth(temptext, -1) - 2.0f;
|
fVirtualWidth = m_frame.size.width / getVirtualScale()[0] - m_font->getWidth(temptext, -1) - 2.0f;
|
||||||
m_font->Print(fVirtualWidth, y, temptext, -1, m_bVirtual);
|
m_font->Print(fVirtualWidth, y, temptext, -1, getVirtualScale());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,7 +306,7 @@ void UIField::UpdateData(void)
|
||||||
void UIField::Pressed(Event *ev)
|
void UIField::Pressed(Event *ev)
|
||||||
{
|
{
|
||||||
float xpos = ev->GetFloat(1);
|
float xpos = ev->GetFloat(1);
|
||||||
float point = (xpos - m_frame.pos.x) / m_vVirtualScale[0];
|
float point = (xpos - m_frame.pos.x) / getVirtualScale()[0];
|
||||||
point = Q_max(point, 0.0f); // added in 2.15
|
point = Q_max(point, 0.0f); // added in 2.15
|
||||||
|
|
||||||
int iStep = m_iPreStep;
|
int iStep = m_iPreStep;
|
||||||
|
|
|
@ -115,10 +115,10 @@ void UIFloatingWindow::FrameInitialized
|
||||||
//
|
//
|
||||||
m_closeButton->InitFrame(
|
m_closeButton->InitFrame(
|
||||||
this,
|
this,
|
||||||
m_frame.size.width - 18.0,
|
m_frame.size.width - 18.0 * getHighResScale()[0],
|
||||||
2.0,
|
2.0,
|
||||||
16.0,
|
16.0 * getHighResScale()[0],
|
||||||
16.0,
|
16.0 * getHighResScale()[1],
|
||||||
-1,
|
-1,
|
||||||
"marlett"
|
"marlett"
|
||||||
);
|
);
|
||||||
|
@ -131,10 +131,10 @@ void UIFloatingWindow::FrameInitialized
|
||||||
//
|
//
|
||||||
m_minimizeButton->InitFrame(
|
m_minimizeButton->InitFrame(
|
||||||
this,
|
this,
|
||||||
m_frame.size.width - 36.0,
|
m_frame.size.width - 36.0 * getHighResScale()[0],
|
||||||
2.0,
|
2.0,
|
||||||
16.0,
|
16.0 * getHighResScale()[0],
|
||||||
16.0,
|
16.0 * getHighResScale()[1],
|
||||||
-1,
|
-1,
|
||||||
"marlett"
|
"marlett"
|
||||||
);
|
);
|
||||||
|
@ -156,7 +156,7 @@ void UIFloatingWindow::FrameInitialized
|
||||||
{
|
{
|
||||||
m_childspace->InitFrame(
|
m_childspace->InitFrame(
|
||||||
this,
|
this,
|
||||||
UIRect2D(2.0, 20.0, m_frame.size.width - 4.0, m_frame.size.height - 22.0),
|
UIRect2D(2.0, 20.0 * getHighResScale()[1], m_frame.size.width - 4.0, m_frame.size.height - 22.0 * getHighResScale()[1]),
|
||||||
0,
|
0,
|
||||||
"verdana-12"
|
"verdana-12"
|
||||||
);
|
);
|
||||||
|
@ -198,7 +198,7 @@ void UIFloatingWindow::MinimizePressed
|
||||||
// save the hold height
|
// save the hold height
|
||||||
// so the window can be restored later
|
// so the window can be restored later
|
||||||
m_restoredHeight = size.height;
|
m_restoredHeight = size.height;
|
||||||
size.height = 20.0;
|
size.height = 20.0 * getHighResScale()[1];
|
||||||
m_minimizeButton->setTitle("1");
|
m_minimizeButton->setTitle("1");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -288,17 +288,17 @@ void UIFloatingWindow::SizeChanged
|
||||||
{
|
{
|
||||||
UIRect2D childRect;
|
UIRect2D childRect;
|
||||||
childRect.pos.x = 2.0;
|
childRect.pos.x = 2.0;
|
||||||
childRect.pos.y = 20.0;
|
childRect.pos.y = 20.0 * getHighResScale()[1];
|
||||||
childRect.size.width = m_frame.size.width - 4.0;
|
childRect.size.width = m_frame.size.width - 4.0 * getHighResScale()[0];
|
||||||
childRect.size.height = m_frame.size.height - 22.0;
|
childRect.size.height = m_frame.size.height - 22.0 * getHighResScale()[1];
|
||||||
|
|
||||||
if (childRect.size.width <= 0.0 || childRect.size.height <= 0.0) {
|
if (childRect.size.width <= 0.0 || childRect.size.height <= 0.0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_childspace->setFrame(childRect);
|
m_childspace->setFrame(childRect);
|
||||||
m_closeButton->setFrame(UIRect2D(m_frame.size.width - 18.0, 2.0, 16.0, 16.0));
|
m_closeButton->setFrame(UIRect2D(m_frame.size.width - 18.0 * getHighResScale()[0], 2.0, 16.0 * getHighResScale()[0], 16.0 * getHighResScale()[1]));
|
||||||
m_minimizeButton->setFrame(UIRect2D(m_frame.size.width - 36.0, 2.0, 16.0, 16.0));
|
m_minimizeButton->setFrame(UIRect2D(m_frame.size.width - 36.0 * getHighResScale()[0], 2.0, 16.0 * getHighResScale()[0], 16.0 * getHighResScale()[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIFloatingWindow::OnActivated
|
void UIFloatingWindow::OnActivated
|
||||||
|
@ -414,11 +414,13 @@ void UIFloatingWindow::Draw
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const float maxTitleBarHeight = 20 * getHighResScale()[1];
|
||||||
|
|
||||||
DrawBox(
|
DrawBox(
|
||||||
0.0,
|
0.0,
|
||||||
0.0,
|
0.0,
|
||||||
m_frame.size.width,
|
m_frame.size.width,
|
||||||
m_frame.size.height > 20.0 ? 20.0 : m_frame.size.height,
|
m_frame.size.height > maxTitleBarHeight ? maxTitleBarHeight : m_frame.size.height,
|
||||||
titleBar,
|
titleBar,
|
||||||
1.0
|
1.0
|
||||||
);
|
);
|
||||||
|
@ -427,7 +429,7 @@ void UIFloatingWindow::Draw
|
||||||
0.0,
|
0.0,
|
||||||
0.0,
|
0.0,
|
||||||
m_frame.size.width,
|
m_frame.size.width,
|
||||||
m_frame.size.height > 20.0 ? 20.0 : m_frame.size.height,
|
m_frame.size.height > maxTitleBarHeight ? maxTitleBarHeight : m_frame.size.height,
|
||||||
false,
|
false,
|
||||||
titleBorder,
|
titleBorder,
|
||||||
1.0
|
1.0
|
||||||
|
|
|
@ -274,14 +274,14 @@ void UIFont::setFont(const char *fontname)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIFont::Print(float x, float y, const char *text, size_t maxlen, qboolean bVirtualScreen)
|
void UIFont::Print(float x, float y, const char *text, size_t maxlen, const float *virtualScreen)
|
||||||
{
|
{
|
||||||
uii.Rend_SetColor(color);
|
uii.Rend_SetColor(color);
|
||||||
uii.Rend_DrawString(m_font, text, x, y, maxlen, bVirtualScreen);
|
uii.Rend_DrawString(m_font, text, x, y, maxlen, virtualScreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIFont::PrintJustified(
|
void UIFont::PrintJustified(
|
||||||
const UIRect2D& rect, fonthorzjustify_t horz, fontvertjustify_t vert, const char *text, float *vVirtualScale
|
const UIRect2D& rect, fonthorzjustify_t horz, fontvertjustify_t vert, const char *text, const float *vVirtualScale
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
float newx, newy;
|
float newx, newy;
|
||||||
|
@ -302,11 +302,11 @@ void UIFont::PrintJustified(
|
||||||
|
|
||||||
if (horz == FONT_JUSTHORZ_LEFT && vert == FONT_JUSTVERT_TOP) {
|
if (horz == FONT_JUSTHORZ_LEFT && vert == FONT_JUSTVERT_TOP) {
|
||||||
// no need to justify
|
// no need to justify
|
||||||
Print(sizedRect.pos.x, sizedRect.pos.y, text, -1, vVirtualScale != NULL);
|
Print(sizedRect.pos.x, sizedRect.pos.y, text, -1, vVirtualScale);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
textheight = getHeight(text, -1, qfalse);
|
textheight = getHeight(text, -1);
|
||||||
|
|
||||||
switch (vert) {
|
switch (vert) {
|
||||||
case FONT_JUSTVERT_TOP:
|
case FONT_JUSTVERT_TOP:
|
||||||
|
@ -360,10 +360,10 @@ void UIFont::PrintJustified(
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Print(newx, newy, string, -1, vVirtualScale != NULL);
|
Print(newx, newy, string, -1, vVirtualScale);
|
||||||
|
|
||||||
// expand for newline
|
// expand for newline
|
||||||
newy += getHeight(" ", -1, qfalse);
|
newy += getHeight(" ", -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -373,7 +373,7 @@ void UIFont::PrintOutlinedJustified(
|
||||||
fontvertjustify_t vert,
|
fontvertjustify_t vert,
|
||||||
const char *text,
|
const char *text,
|
||||||
const UColor & outlineColor,
|
const UColor & outlineColor,
|
||||||
float *vVirtualScale
|
const float *vVirtualScale
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
float newx, newy;
|
float newx, newy;
|
||||||
|
@ -398,11 +398,11 @@ void UIFont::PrintOutlinedJustified(
|
||||||
|
|
||||||
if (horz == FONT_JUSTHORZ_LEFT && vert == FONT_JUSTVERT_TOP) {
|
if (horz == FONT_JUSTHORZ_LEFT && vert == FONT_JUSTVERT_TOP) {
|
||||||
// no need to justify
|
// no need to justify
|
||||||
Print(sizedRect.pos.x, sizedRect.pos.y, text, -1, vVirtualScale != NULL);
|
Print(sizedRect.pos.x, sizedRect.pos.y, text, -1, vVirtualScale);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
textheight = getHeight(text, -1, qfalse);
|
textheight = getHeight(text, -1);
|
||||||
|
|
||||||
switch (vert) {
|
switch (vert) {
|
||||||
case FONT_JUSTVERT_TOP:
|
case FONT_JUSTVERT_TOP:
|
||||||
|
@ -464,26 +464,26 @@ void UIFont::PrintOutlinedJustified(
|
||||||
// draw the outline
|
// draw the outline
|
||||||
//
|
//
|
||||||
setColor(outlineColor);
|
setColor(outlineColor);
|
||||||
Print(newx + 1, newy + 2, string, -1, bVirtual);
|
Print(newx + 1, newy + 2, string, -1, vVirtualScale);
|
||||||
Print(newx + 2, newy + 1, string, -1, bVirtual);
|
Print(newx + 2, newy + 1, string, -1, vVirtualScale);
|
||||||
Print(newx - 1, newy + 2, string, -1, bVirtual);
|
Print(newx - 1, newy + 2, string, -1, vVirtualScale);
|
||||||
Print(newx - 2, newy + 1, string, -1, bVirtual);
|
Print(newx - 2, newy + 1, string, -1, vVirtualScale);
|
||||||
Print(newx - 1, newy - 2, string, -1, bVirtual);
|
Print(newx - 1, newy - 2, string, -1, vVirtualScale);
|
||||||
Print(newx - 2, newy - 1, string, -1, bVirtual);
|
Print(newx - 2, newy - 1, string, -1, vVirtualScale);
|
||||||
Print(newx + 1, newy - 2, string, -1, bVirtual);
|
Print(newx + 1, newy - 2, string, -1, vVirtualScale);
|
||||||
Print(newx + 2, newy - 1, string, -1, bVirtual);
|
Print(newx + 2, newy - 1, string, -1, vVirtualScale);
|
||||||
Print(newx + 2, newy, string, -1, bVirtual);
|
Print(newx + 2, newy, string, -1, vVirtualScale);
|
||||||
Print(newx - 2, newy, string, -1, bVirtual);
|
Print(newx - 2, newy, string, -1, vVirtualScale);
|
||||||
Print(newx, newy + 2, string, -1, bVirtual);
|
Print(newx, newy + 2, string, -1, vVirtualScale);
|
||||||
Print(newx, newy - 2, string, -1, bVirtual);
|
Print(newx, newy - 2, string, -1, vVirtualScale);
|
||||||
//
|
//
|
||||||
// draw the text
|
// draw the text
|
||||||
//
|
//
|
||||||
setColor(originalColor);
|
setColor(originalColor);
|
||||||
Print(newx, newy, string, -1, bVirtual);
|
Print(newx, newy, string, -1, vVirtualScale);
|
||||||
|
|
||||||
// expand for newline
|
// expand for newline
|
||||||
newy += getHeight(" ", -1, qfalse);
|
newy += getHeight(" ", -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -532,7 +532,7 @@ int UIFont::getCharWidth(unsigned short ch)
|
||||||
return m_font->sgl[index]->locations[indirected].size[0] * 256.0 * widthMul;
|
return m_font->sgl[index]->locations[indirected].size[0] * 256.0 * widthMul;
|
||||||
}
|
}
|
||||||
|
|
||||||
int UIFont::getHeight(const char *text, int maxlen, qboolean bVirtual)
|
int UIFont::getHeight(const char *text, int maxlen, const float* virtualScale)
|
||||||
{
|
{
|
||||||
float height;
|
float height;
|
||||||
int i;
|
int i;
|
||||||
|
@ -541,7 +541,7 @@ int UIFont::getHeight(const char *text, int maxlen, qboolean bVirtual)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
height = getHeight(bVirtual);
|
height = getHeight(virtualScale);
|
||||||
|
|
||||||
for (i = 0; text[i]; i++) {
|
for (i = 0; text[i]; i++) {
|
||||||
if (maxlen != -1 && i > maxlen) {
|
if (maxlen != -1 && i > maxlen) {
|
||||||
|
@ -549,20 +549,20 @@ int UIFont::getHeight(const char *text, int maxlen, qboolean bVirtual)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (text[i] == '\n') {
|
if (text[i] == '\n') {
|
||||||
height += getHeight(bVirtual);
|
height += getHeight(virtualScale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return height;
|
return height;
|
||||||
}
|
}
|
||||||
|
|
||||||
int UIFont::getHeight(qboolean bVirtual)
|
int UIFont::getHeight(const float* virtualScale)
|
||||||
{
|
{
|
||||||
if (bVirtual) {
|
if (virtualScale) {
|
||||||
if (m_font) {
|
if (m_font) {
|
||||||
return (m_font->sgl[0]->height * uid.vidHeight / 480.0);
|
return (m_font->sgl[0]->height * virtualScale[0]);
|
||||||
} else {
|
} else {
|
||||||
return (16.0 * uid.vidHeight / 480.0);
|
return (16.0 * uid.vidHeight * virtualScale[1]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (m_font) {
|
if (m_font) {
|
||||||
|
|
|
@ -47,12 +47,12 @@ public:
|
||||||
UIFont();
|
UIFont();
|
||||||
UIFont(const char *fn);
|
UIFont(const char *fn);
|
||||||
|
|
||||||
void Print(float x, float y, const char *text, size_t maxlen = -1, qboolean bVirtualScreen = qfalse);
|
void Print(float x, float y, const char *text, size_t maxlen = -1, const float *virtualScreen = NULL);
|
||||||
void PrintJustified(
|
void PrintJustified(
|
||||||
const UIRect2D& rect, fonthorzjustify_t horz, fontvertjustify_t vert, const char *text, float *vVirtualScale
|
const UIRect2D& rect, fonthorzjustify_t horz, fontvertjustify_t vert, const char *text, const float *vVirtualScale
|
||||||
);
|
);
|
||||||
void PrintOutlinedJustified(
|
void PrintOutlinedJustified(
|
||||||
const UIRect2D& rect, fonthorzjustify_t horz, fontvertjustify_t vert, const char* text, const UColor& outlineColor, float* vVirtualScale
|
const UIRect2D& rect, fonthorzjustify_t horz, fontvertjustify_t vert, const char* text, const UColor& outlineColor, const float* vVirtualScale
|
||||||
);
|
);
|
||||||
void setColor(UColor col);
|
void setColor(UColor col);
|
||||||
void setAlpha(float alpha);
|
void setAlpha(float alpha);
|
||||||
|
@ -60,8 +60,8 @@ public:
|
||||||
int getMaxWidthIndex(const char* text, int maxlen);
|
int getMaxWidthIndex(const char* text, int maxlen);
|
||||||
int getWidth(const char *text, int maxlen);
|
int getWidth(const char *text, int maxlen);
|
||||||
int getCharWidth(unsigned short ch);
|
int getCharWidth(unsigned short ch);
|
||||||
int getHeight(const char *text, int maxlen, qboolean bVirtual);
|
int getHeight(const char *text, int maxlen, const float* virtualScale = NULL);
|
||||||
int getHeight(qboolean bVirtual);
|
int getHeight(const float* virtualScale = NULL);
|
||||||
int CodeSearch(unsigned short uch);
|
int CodeSearch(unsigned short uch);
|
||||||
bool DBCSIsLeadByte(unsigned short uch);
|
bool DBCSIsLeadByte(unsigned short uch);
|
||||||
bool DBCSIsMaekin(unsigned short uch);
|
bool DBCSIsMaekin(unsigned short uch);
|
||||||
|
|
|
@ -318,7 +318,7 @@ void UILabel::Draw(void)
|
||||||
m_iFontAlignmentVertical,
|
m_iFontAlignmentVertical,
|
||||||
string,
|
string,
|
||||||
UBlack,
|
UBlack,
|
||||||
m_bVirtual ? m_vVirtualScale : NULL
|
getVirtualScale()
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// print the text
|
// print the text
|
||||||
|
@ -327,7 +327,7 @@ void UILabel::Draw(void)
|
||||||
m_iFontAlignmentHorizontal,
|
m_iFontAlignmentHorizontal,
|
||||||
m_iFontAlignmentVertical,
|
m_iFontAlignmentVertical,
|
||||||
string,
|
string,
|
||||||
m_bVirtual ? m_vVirtualScale : NULL
|
getVirtualScale()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,10 +92,10 @@ void UIList::Draw
|
||||||
}
|
}
|
||||||
|
|
||||||
float textX = 0.5f * m_frame.size.width - 0.5f * m_font->getWidth(itemText, -1);
|
float textX = 0.5f * m_frame.size.width - 0.5f * m_font->getWidth(itemText, -1);
|
||||||
float textY = 0.5f * (m_frame.size.height - m_font->getHeight(m_bVirtual)) - 1.0f;
|
float textY = 0.5f * (m_frame.size.height - m_font->getHeight(m_bVirtual ? m_vVirtualScale : uid.scaleRes)) - 1.0f;
|
||||||
m_font->setColor(m_foreground_color);
|
m_font->setColor(m_foreground_color);
|
||||||
const char *text = Sys_LV_CL_ConvertString(itemText);
|
const char *text = Sys_LV_CL_ConvertString(itemText);
|
||||||
m_font->Print(textX, textY, text, -1, m_bVirtual);
|
m_font->Print(textX, textY, text, -1, m_bVirtual ? m_vVirtualScale : NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw the previous arrow
|
// draw the previous arrow
|
||||||
|
|
|
@ -303,7 +303,7 @@ void UIListBox::Draw(void)
|
||||||
0,
|
0,
|
||||||
aty * m_vVirtualScale[1],
|
aty * m_vVirtualScale[1],
|
||||||
m_frame.size.width - m_vVirtualScale[0] * 16,
|
m_frame.size.width - m_vVirtualScale[0] * 16,
|
||||||
m_font->getHeight(m_bVirtual),
|
m_font->getHeight(getVirtualScale()),
|
||||||
selectedBG,
|
selectedBG,
|
||||||
1.f
|
1.f
|
||||||
);
|
);
|
||||||
|
@ -318,7 +318,7 @@ void UIListBox::Draw(void)
|
||||||
} else {
|
} else {
|
||||||
str = li->string;
|
str = li->string;
|
||||||
}
|
}
|
||||||
m_font->Print(m_indent, aty, str, -1, m_bVirtual);
|
m_font->Print(m_indent, aty, str, -1, m_bVirtual ? m_vVirtualScale : NULL);
|
||||||
|
|
||||||
if (i == m_currentItem) {
|
if (i == m_currentItem) {
|
||||||
DrawBoxWithSolidBorder(
|
DrawBoxWithSolidBorder(
|
||||||
|
@ -326,7 +326,7 @@ void UIListBox::Draw(void)
|
||||||
0,
|
0,
|
||||||
aty * m_vVirtualScale[1],
|
aty * m_vVirtualScale[1],
|
||||||
m_frame.size.width - m_vVirtualScale[0] * 16,
|
m_frame.size.width - m_vVirtualScale[0] * 16,
|
||||||
m_font->getHeight(m_bVirtual)
|
m_font->getHeight(getVirtualScale())
|
||||||
),
|
),
|
||||||
UWhite,
|
UWhite,
|
||||||
selectedBorder,
|
selectedBorder,
|
||||||
|
@ -336,7 +336,7 @@ void UIListBox::Draw(void)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
aty += m_font->getHeight(false);
|
aty += m_font->getHeight(getHighResScale());
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -349,9 +349,9 @@ void UIListBox::MousePressed(Event *ev)
|
||||||
p.y = ev->GetFloat(2) - m_screenframe.pos.y;
|
p.y = ev->GetFloat(2) - m_screenframe.pos.y;
|
||||||
|
|
||||||
if (m_vertscroll) {
|
if (m_vertscroll) {
|
||||||
TrySelectItem((m_vertscroll->getTopItem() + 1) + p.y / m_font->getHeight(m_bVirtual));
|
TrySelectItem((m_vertscroll->getTopItem() + 1) + p.y / m_font->getHeight(getVirtualScale()));
|
||||||
} else {
|
} else {
|
||||||
TrySelectItem(p.y / m_font->getHeight(m_bVirtual) + 1);
|
TrySelectItem(p.y / m_font->getHeight(getVirtualScale()) + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_clickState.time + 500 > uid.time && m_currentItem == m_clickState.selected) {
|
if (m_clickState.time + 500 > uid.time && m_currentItem == m_clickState.selected) {
|
||||||
|
@ -409,7 +409,7 @@ void UIListBox::SetListFont(Event *ev)
|
||||||
LayoutFont(ev);
|
LayoutFont(ev);
|
||||||
|
|
||||||
if (m_vertscroll) {
|
if (m_vertscroll) {
|
||||||
m_vertscroll->setPageHeight(m_frame.size.height / m_font->getHeight(m_bVirtual));
|
m_vertscroll->setPageHeight(m_frame.size.height / m_font->getHeight(getVirtualScale()));
|
||||||
}
|
}
|
||||||
|
|
||||||
FrameInitialized();
|
FrameInitialized();
|
||||||
|
@ -483,7 +483,7 @@ void UIListBox::FrameInitialized(void)
|
||||||
UIListBase::FrameInitialized();
|
UIListBase::FrameInitialized();
|
||||||
|
|
||||||
if (m_vertscroll) {
|
if (m_vertscroll) {
|
||||||
m_vertscroll->setPageHeight(m_frame.size.height / m_font->getHeight(m_bVirtual));
|
m_vertscroll->setPageHeight(m_frame.size.height / m_font->getHeight(getVirtualScale()));
|
||||||
m_vertscroll->setNumItems(m_itemlist.NumObjects());
|
m_vertscroll->setNumItems(m_itemlist.NumObjects());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,14 +155,14 @@ int UIListCtrl::getHeaderHeight
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_headerfont) {
|
if (m_headerfont) {
|
||||||
return (int)(m_headerfont->getHeight(m_bVirtual) + (s_columnpadding.height + s_columnpadding.height) * m_vVirtualScale[1]);
|
return (int)(m_headerfont->getHeight(getVirtualScale()) + (s_columnpadding.height + s_columnpadding.height) * getVirtualScale()[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_font) {
|
if (m_font) {
|
||||||
return (int)(m_font->getHeight(m_bVirtual) + (s_columnpadding.height + s_columnpadding.height) * m_vVirtualScale[1]);
|
return (int)(m_font->getHeight(getVirtualScale()) + (s_columnpadding.height + s_columnpadding.height) * getVirtualScale()[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (int)((s_columnpadding.height + s_columnpadding.height) * m_vVirtualScale[1]);
|
return (int)((s_columnpadding.height + s_columnpadding.height) * getVirtualScale()[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIListCtrl::MousePressed
|
void UIListCtrl::MousePressed
|
||||||
|
@ -215,9 +215,9 @@ void UIListCtrl::MousePressed
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (m_vertscroll) {
|
if (m_vertscroll) {
|
||||||
TrySelectItem((m_vertscroll->getTopItem() + 1) + (p.y - getHeaderHeight()) / m_font->getHeight(m_bVirtual));
|
TrySelectItem((m_vertscroll->getTopItem() + 1) + (p.y - getHeaderHeight()) / m_font->getHeight(getVirtualScale()));
|
||||||
} else {
|
} else {
|
||||||
TrySelectItem(1.0 + (p.y - getHeaderHeight()) / m_font->getHeight(m_bVirtual));
|
TrySelectItem(1.0 + (p.y - getHeaderHeight()) / m_font->getHeight(getVirtualScale()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_clickState.time + 500 > uid.time
|
if (m_clickState.time + 500 > uid.time
|
||||||
|
@ -298,7 +298,7 @@ void UIListCtrl::OnSizeChanged
|
||||||
}
|
}
|
||||||
|
|
||||||
m_vertscroll->InitFrame(this, m_frame.size.width - 16.0, 0.0, 16.0, m_frame.size.height, -1);
|
m_vertscroll->InitFrame(this, m_frame.size.width - 16.0, 0.0, 16.0, m_frame.size.height, -1);
|
||||||
m_vertscroll->setPageHeight((m_frame.size.height - getHeaderHeight()) / m_font->getHeight(m_bVirtual));
|
m_vertscroll->setPageHeight((m_frame.size.height - getHeaderHeight()) / m_font->getHeight(getVirtualScale()));
|
||||||
m_vertscroll->setNumItems(m_itemlist.NumObjects());
|
m_vertscroll->setNumItems(m_itemlist.NumObjects());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,7 +321,7 @@ void UIListCtrl::DrawColumns
|
||||||
pFont = m_headerfont;
|
pFont = m_headerfont;
|
||||||
if (!pFont) pFont = m_font;
|
if (!pFont) pFont = m_font;
|
||||||
|
|
||||||
height = (s_columnpadding.height + s_columnpadding.height) * m_vVirtualScale[1] + pFont->getHeight(m_bVirtual);
|
height = (s_columnpadding.height + s_columnpadding.height) * getVirtualScale()[1] + pFont->getHeight(getVirtualScale());
|
||||||
pFont->setColor(textColor);
|
pFont->setColor(textColor);
|
||||||
|
|
||||||
for (i = 1; i <= m_columnlist.NumObjects(); i++)
|
for (i = 1; i <= m_columnlist.NumObjects(); i++)
|
||||||
|
@ -329,7 +329,7 @@ void UIListCtrl::DrawColumns
|
||||||
const columndef_t& column = m_columnlist.ObjectAt(i);
|
const columndef_t& column = m_columnlist.ObjectAt(i);
|
||||||
|
|
||||||
DrawBoxWithSolidBorder(
|
DrawBoxWithSolidBorder(
|
||||||
UIRect2D(atleft, 0, column.width + m_vVirtualScale[1], height),
|
UIRect2D(atleft, 0, column.width + getVirtualScale()[1], height),
|
||||||
columnColor,
|
columnColor,
|
||||||
textColor,
|
textColor,
|
||||||
1,
|
1,
|
||||||
|
@ -338,11 +338,11 @@ void UIListCtrl::DrawColumns
|
||||||
);
|
);
|
||||||
|
|
||||||
pFont->Print(
|
pFont->Print(
|
||||||
atleft / m_vVirtualScale[0] + s_columnpadding.width,
|
atleft / getVirtualScale()[0] + s_columnpadding.width,
|
||||||
s_columnpadding.height,
|
s_columnpadding.height,
|
||||||
Sys_LV_CL_ConvertString(column.title.c_str()),
|
Sys_LV_CL_ConvertString(column.title.c_str()),
|
||||||
-1,
|
-1,
|
||||||
m_bVirtual
|
getVirtualScale()
|
||||||
);
|
);
|
||||||
|
|
||||||
atleft += column.width;
|
atleft += column.width;
|
||||||
|
@ -374,14 +374,14 @@ void UIListCtrl::DrawContent
|
||||||
UColor selColor, selText;
|
UColor selColor, selText;
|
||||||
UColor backColor, textColor;
|
UColor backColor, textColor;
|
||||||
|
|
||||||
height = m_font->getHeight(m_bVirtual);
|
height = m_font->getHeight(getVirtualScale());
|
||||||
selColor = UColor(0.21f, 0.18f, 0.015f, 1.0f);
|
selColor = UColor(0.21f, 0.18f, 0.015f, 1.0f);
|
||||||
selText = UColor(0.9f, 0.8f, 0.6f, 1.0f);
|
selText = UColor(0.9f, 0.8f, 0.6f, 1.0f);
|
||||||
backColor = m_background_color;
|
backColor = m_background_color;
|
||||||
textColor = m_foreground_color;
|
textColor = m_foreground_color;
|
||||||
|
|
||||||
if (m_headerfont) {
|
if (m_headerfont) {
|
||||||
headerheight = m_headerfont->getHeight(m_bVirtual);
|
headerheight = m_headerfont->getHeight(getVirtualScale());
|
||||||
} else {
|
} else {
|
||||||
headerheight = 0;
|
headerheight = 0;
|
||||||
}
|
}
|
||||||
|
@ -439,11 +439,11 @@ void UIListCtrl::DrawContent
|
||||||
case TYPE_STRING:
|
case TYPE_STRING:
|
||||||
DrawBox(drawRect, *itemBg, m_local_alpha);
|
DrawBox(drawRect, *itemBg, m_local_alpha);
|
||||||
pFont->Print(
|
pFont->Print(
|
||||||
drawRect.pos.x / m_vVirtualScale[0] + 1.0,
|
drawRect.pos.x / getVirtualScale()[0] + 1.0,
|
||||||
drawRect.pos.y / m_vVirtualScale[1],
|
drawRect.pos.y / getVirtualScale()[1],
|
||||||
Sys_LV_CL_ConvertString(theitem->getListItemString(column.name)),
|
Sys_LV_CL_ConvertString(theitem->getListItemString(column.name)),
|
||||||
-1,
|
-1,
|
||||||
m_bVirtual
|
getVirtualScale()
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case TYPE_OWNERDRAW:
|
case TYPE_OWNERDRAW:
|
||||||
|
|
|
@ -146,7 +146,7 @@ void UIMultiLineEdit::FrameInitialized(void)
|
||||||
{
|
{
|
||||||
delete m_vertscroll;
|
delete m_vertscroll;
|
||||||
m_vertscroll = new UIVertScroll();
|
m_vertscroll = new UIVertScroll();
|
||||||
m_vertscroll->setPageHeight(m_frame.size.height / m_font->getHeight(false));
|
m_vertscroll->setPageHeight(m_frame.size.height / m_font->getHeight(getHighResScale()));
|
||||||
m_vertscroll->setTopItem(0);
|
m_vertscroll->setTopItem(0);
|
||||||
m_vertscroll->setNumItems(m_lines.getCount());
|
m_vertscroll->setNumItems(m_lines.getCount());
|
||||||
m_vertscroll->InitFrameAlignRight(this, 0, 0);
|
m_vertscroll->InitFrameAlignRight(this, 0, 0);
|
||||||
|
@ -157,7 +157,7 @@ void UIMultiLineEdit::FrameInitialized(void)
|
||||||
|
|
||||||
void UIMultiLineEdit::SizeChanged(Event *ev)
|
void UIMultiLineEdit::SizeChanged(Event *ev)
|
||||||
{
|
{
|
||||||
m_vertscroll->setPageHeight(m_frame.size.height / m_font->getHeight(m_bVirtual));
|
m_vertscroll->setPageHeight(m_frame.size.height / m_font->getHeight(getVirtualScale()));
|
||||||
m_vertscroll->InitFrameAlignRight(this, 0, 0);
|
m_vertscroll->InitFrameAlignRight(this, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ void UIMultiLineEdit::Draw(void)
|
||||||
if (i < topsel->line || i > botsel->line) {
|
if (i < topsel->line || i > botsel->line) {
|
||||||
// Print regular line without any selection or cursor present
|
// Print regular line without any selection or cursor present
|
||||||
m_font->setColor(m_foreground_color);
|
m_font->setColor(m_foreground_color);
|
||||||
m_font->Print(0, aty, cur, -1, m_bVirtual);
|
m_font->Print(0, aty / getVirtualScale()[1], cur, -1, getVirtualScale());
|
||||||
} else {
|
} else {
|
||||||
// Current line contains cursor and/or selected text
|
// Current line contains cursor and/or selected text
|
||||||
float linewidth = m_font->getWidth(cur, -1);
|
float linewidth = m_font->getWidth(cur, -1);
|
||||||
|
@ -217,13 +217,13 @@ void UIMultiLineEdit::Draw(void)
|
||||||
if (i > topsel->line && i < botsel->line) {
|
if (i > topsel->line && i < botsel->line) {
|
||||||
// all text in current line is selected, it's part of a larger selection,
|
// all text in current line is selected, it's part of a larger selection,
|
||||||
// print entire line with the selection highlight box around it
|
// print entire line with the selection highlight box around it
|
||||||
DrawBox(0.0f, aty, linewidth, m_font->getHeight(m_bVirtual), selectionBG, 1.f);
|
DrawBox(0.0f, aty, linewidth * getVirtualScale()[0], m_font->getHeight(getVirtualScale()), selectionBG, 1.f);
|
||||||
m_font->setColor(selectionColor);
|
m_font->setColor(selectionColor);
|
||||||
// Fixed in OPM:
|
// Fixed in OPM:
|
||||||
// don't spam LOCALIZATION ERROR messages to console
|
// don't spam LOCALIZATION ERROR messages to console
|
||||||
// for clicking lines in the opened text document
|
// for clicking lines in the opened text document
|
||||||
//m_font->Print(0, aty, Sys_LV_CL_ConvertString(cur), -1, m_bVirtual);
|
//m_font->Print(0, aty, Sys_LV_CL_ConvertString(cur), -1, m_bVirtual);
|
||||||
m_font->Print(0, aty, cur, -1, m_bVirtual);
|
m_font->Print(0, aty / getVirtualScale()[1], cur, -1, getVirtualScale());
|
||||||
} else if (i != topsel->line) {
|
} else if (i != topsel->line) {
|
||||||
// part of this line is selected, and selection continues/began above
|
// part of this line is selected, and selection continues/began above
|
||||||
if (i == botsel->line) { // sanity check, should always be true
|
if (i == botsel->line) { // sanity check, should always be true
|
||||||
|
@ -232,13 +232,13 @@ void UIMultiLineEdit::Draw(void)
|
||||||
// selection contains text from the beginning of the line,
|
// selection contains text from the beginning of the line,
|
||||||
// print it with the selection highlight box around it
|
// print it with the selection highlight box around it
|
||||||
m_font->setColor(selectionColor);
|
m_font->setColor(selectionColor);
|
||||||
DrawBox(0, aty, toplen, m_font->getHeight(m_bVirtual), selectionBG, 1.f);
|
DrawBox(0, aty, toplen * getVirtualScale()[0], m_font->getHeight(getVirtualScale()), selectionBG, 1.f);
|
||||||
m_font->Print(0, aty, cur, botsel->column, m_bVirtual);
|
m_font->Print(0, aty / getVirtualScale()[1], cur, botsel->column, getVirtualScale());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (toplen < linewidth) { // is there still text on this line after the selection?
|
if (toplen < linewidth) { // is there still text on this line after the selection?
|
||||||
m_font->setColor(m_foreground_color);
|
m_font->setColor(m_foreground_color);
|
||||||
m_font->Print(toplen, aty, &cur[botsel->column], -1, m_bVirtual);
|
m_font->Print(toplen, aty / getVirtualScale()[1], &cur[botsel->column], -1, getVirtualScale());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (botsel == &m_selection.end) {
|
if (botsel == &m_selection.end) {
|
||||||
|
@ -251,14 +251,14 @@ void UIMultiLineEdit::Draw(void)
|
||||||
int toplen = m_font->getWidth(cur, topsel->column); // X coord of highlighting start
|
int toplen = m_font->getWidth(cur, topsel->column); // X coord of highlighting start
|
||||||
if (topsel->column) { // is there any text on this line before the selection?
|
if (topsel->column) { // is there any text on this line before the selection?
|
||||||
m_font->setColor(m_foreground_color);
|
m_font->setColor(m_foreground_color);
|
||||||
m_font->Print(0, aty, cur, topsel->column, m_bVirtual);
|
m_font->Print(0, aty / getVirtualScale()[1], cur, topsel->column, getVirtualScale());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (toplen < linewidth) { // is there any selected text before the end of the line?
|
if (toplen < linewidth) { // is there any selected text before the end of the line?
|
||||||
// print the selected text with the selection highlight box around it
|
// print the selected text with the selection highlight box around it
|
||||||
m_font->setColor(selectionColor);
|
m_font->setColor(selectionColor);
|
||||||
DrawBox(toplen, aty, linewidth - toplen, m_font->getHeight(m_bVirtual), selectionBG, 1.f);
|
DrawBox(toplen * getVirtualScale()[0], aty, (linewidth - toplen) * getVirtualScale()[0], m_font->getHeight(getVirtualScale()), selectionBG, 1.f);
|
||||||
m_font->Print(toplen, aty, &cur[topsel->column], -1, m_bVirtual);
|
m_font->Print(toplen, aty / getVirtualScale()[1], &cur[topsel->column], -1, getVirtualScale());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (topsel == &m_selection.end) {
|
if (topsel == &m_selection.end) {
|
||||||
|
@ -275,7 +275,7 @@ void UIMultiLineEdit::Draw(void)
|
||||||
// don't spam LOCALIZATION ERROR messages to console
|
// don't spam LOCALIZATION ERROR messages to console
|
||||||
// for clicking lines in the opened text document
|
// for clicking lines in the opened text document
|
||||||
//m_font->Print(0, aty, Sys_LV_CL_ConvertString(cur), -1, m_bVirtual);
|
//m_font->Print(0, aty, Sys_LV_CL_ConvertString(cur), -1, m_bVirtual);
|
||||||
m_font->Print(0, aty, cur, -1, m_bVirtual);
|
m_font->Print(0, aty / getVirtualScale()[1], cur, -1, getVirtualScale());
|
||||||
} else {
|
} else {
|
||||||
// selection starts and ends on this line
|
// selection starts and ends on this line
|
||||||
int toplen = m_font->getWidth(cur, topsel->column); // X coord of highlighting start
|
int toplen = m_font->getWidth(cur, topsel->column); // X coord of highlighting start
|
||||||
|
@ -283,14 +283,14 @@ void UIMultiLineEdit::Draw(void)
|
||||||
|
|
||||||
if (toplen) { // is there any text on this line before the selection?
|
if (toplen) { // is there any text on this line before the selection?
|
||||||
m_font->setColor(m_foreground_color);
|
m_font->setColor(m_foreground_color);
|
||||||
m_font->Print(0, aty, cur, topsel->column, m_bVirtual);
|
m_font->Print(0, aty / getVirtualScale()[1], cur, topsel->column, getVirtualScale());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (botlen != toplen) { // is the selection wider than 0 pixels? (sanity check, always true)
|
if (botlen != toplen) { // is the selection wider than 0 pixels? (sanity check, always true)
|
||||||
// print the selected text with the selection highlight box around it
|
// print the selected text with the selection highlight box around it
|
||||||
DrawBox(toplen, aty, botlen - toplen, m_font->getHeight(m_bVirtual), selectionBG, 1.f);
|
DrawBox(toplen * getVirtualScale()[0], aty, (botlen - toplen) * getVirtualScale()[0], m_font->getHeight(getVirtualScale()), selectionBG, 1.f);
|
||||||
m_font->setColor(selectionColor);
|
m_font->setColor(selectionColor);
|
||||||
m_font->Print(toplen, aty, &cur[topsel->column], botsel->column - topsel->column, m_bVirtual);
|
m_font->Print(toplen, aty / getVirtualScale()[1], &cur[topsel->column], botsel->column - topsel->column, getVirtualScale());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cur.length() != botsel->column) { // is there still text on this line after the selection?
|
if (cur.length() != botsel->column) { // is there still text on this line after the selection?
|
||||||
|
@ -302,7 +302,7 @@ void UIMultiLineEdit::Draw(void)
|
||||||
// Cause: the last two arguments were incorrectly passed in originally,
|
// Cause: the last two arguments were incorrectly passed in originally,
|
||||||
// always specifying maxlen as m_bVirtual (which is usually zero).
|
// always specifying maxlen as m_bVirtual (which is usually zero).
|
||||||
// m_font->Print(botlen, aty, &cur[botsel->column], m_bVirtual, false);
|
// m_font->Print(botlen, aty, &cur[botsel->column], m_bVirtual, false);
|
||||||
m_font->Print(botlen, aty, &cur[botsel->column], -1, m_bVirtual);
|
m_font->Print(botlen, aty / getVirtualScale()[1], &cur[botsel->column], -1, getVirtualScale());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Place the cursor at the end of the selection...
|
// Place the cursor at the end of the selection...
|
||||||
|
@ -320,10 +320,10 @@ void UIMultiLineEdit::Draw(void)
|
||||||
|
|
||||||
if (m_selection.end.line == i && (uid.time % 750) >= 375 && IsActive()) {
|
if (m_selection.end.line == i && (uid.time % 750) >= 375 && IsActive()) {
|
||||||
// draw cursor caret
|
// draw cursor caret
|
||||||
DrawBox(caret, aty, 2.f, m_font->getHeight(m_bVirtual), UBlack, 1.f);
|
DrawBox(caret * getVirtualScale()[0], aty, 2.f, m_font->getHeight(getVirtualScale()), UBlack, 1.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
aty += m_font->getHeight(m_bVirtual);
|
aty += m_font->getHeight(getVirtualScale());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,7 +363,7 @@ void UIMultiLineEdit::PointToSelectionPoint(const UIPoint2D& p, selectionpoint_t
|
||||||
float totalWidth = 0;
|
float totalWidth = 0;
|
||||||
float lastWidth = 0;
|
float lastWidth = 0;
|
||||||
|
|
||||||
clickedLine = m_vertscroll->getTopItem() + p.y / m_font->getHeight(m_bVirtual);
|
clickedLine = m_vertscroll->getTopItem() + p.y / m_font->getHeight(getVirtualScale());
|
||||||
clickedLine = Q_min(clickedLine, m_lines.getCount() - 1);
|
clickedLine = Q_min(clickedLine, m_lines.getCount() - 1);
|
||||||
|
|
||||||
if (clickedLine < 0) {
|
if (clickedLine < 0) {
|
||||||
|
@ -374,7 +374,7 @@ void UIMultiLineEdit::PointToSelectionPoint(const UIPoint2D& p, selectionpoint_t
|
||||||
|
|
||||||
const char *line = LineFromLineNumber(clickedLine, true).c_str();
|
const char *line = LineFromLineNumber(clickedLine, true).c_str();
|
||||||
for (i = 0; line[i] && totalWidth < p.x; i++) {
|
for (i = 0; line[i] && totalWidth < p.x; i++) {
|
||||||
lastWidth = m_font->getCharWidth(line[i]);
|
lastWidth = m_font->getCharWidth(line[i]) * getVirtualScale()[0];
|
||||||
totalWidth += lastWidth;
|
totalWidth += lastWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,7 @@ uipopup_describe *UIPopupMenu::getDescribeFromPoint
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
float top = m_vVirtualScale[1] * 4.0f;
|
float top = getVirtualScale()[1] * 4.0f;
|
||||||
for (int i = 1; i <= m_describe->NumObjects(); i++)
|
for (int i = 1; i <= m_describe->NumObjects(); i++)
|
||||||
{
|
{
|
||||||
uipopup_describe* desc = m_describe->ObjectAt(i);
|
uipopup_describe* desc = m_describe->ObjectAt(i);
|
||||||
|
@ -163,10 +163,10 @@ float UIPopupMenu::getDescribeHeight
|
||||||
{
|
{
|
||||||
if (d->type == UIP_SEPARATOR)
|
if (d->type == UIP_SEPARATOR)
|
||||||
{
|
{
|
||||||
return 8.0f;
|
return 8.0f * getVirtualScale()[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_font->getHeight(m_bVirtual);
|
return m_font->getHeight(getVirtualScale());
|
||||||
}
|
}
|
||||||
|
|
||||||
float UIPopupMenu::getDescribeWidth
|
float UIPopupMenu::getDescribeWidth
|
||||||
|
@ -175,7 +175,7 @@ float UIPopupMenu::getDescribeWidth
|
||||||
)
|
)
|
||||||
|
|
||||||
{
|
{
|
||||||
return m_font->getWidth(d->title, -1);
|
return m_font->getWidth(d->title, -1) * getVirtualScale()[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UIPopupMenu::MouseInSubmenus
|
bool UIPopupMenu::MouseInSubmenus
|
||||||
|
@ -251,7 +251,7 @@ void UIPopupMenu::Create
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
totalSize.height /= m_vVirtualScale[1];
|
totalSize.height /= getVirtualScale()[1];
|
||||||
|
|
||||||
if (width != -1.0f)
|
if (width != -1.0f)
|
||||||
{
|
{
|
||||||
|
@ -266,11 +266,11 @@ void UIPopupMenu::Create
|
||||||
totalSize.width += 24.0f;
|
totalSize.width += 24.0f;
|
||||||
totalSize.height += 8.0f;
|
totalSize.height += 8.0f;
|
||||||
|
|
||||||
if (m_bVirtual)
|
//if (m_bVirtual)
|
||||||
{
|
//{
|
||||||
totalSize.width *= m_vVirtualScale[0];
|
totalSize.width *= getVirtualScale()[0];
|
||||||
totalSize.height *= m_vVirtualScale[1];
|
totalSize.height *= getVirtualScale()[1];
|
||||||
}
|
//}
|
||||||
|
|
||||||
UIPoint2D place;
|
UIPoint2D place;
|
||||||
place.x = (where) ? createRect.pos.x : createRect.size.width + createRect.pos.x;
|
place.x = (where) ? createRect.pos.x : createRect.size.width + createRect.pos.x;
|
||||||
|
@ -326,10 +326,10 @@ void UIPopupMenu::Draw
|
||||||
)
|
)
|
||||||
|
|
||||||
{
|
{
|
||||||
const float originX = m_vVirtualScale[0] * 4.0f;
|
const float originX = getVirtualScale()[0] * 4.0f;
|
||||||
const float originY = m_vVirtualScale[1] * 4.0f;
|
const float originY = getVirtualScale()[1] * 4.0f;
|
||||||
|
|
||||||
float fFontHeight = m_font->getHeight(m_bVirtual);
|
float fFontHeight = m_font->getHeight(getVirtualScale());
|
||||||
float top = originY;
|
float top = originY;
|
||||||
for (int i = 1; i <= m_describe->NumObjects(); i++)
|
for (int i = 1; i <= m_describe->NumObjects(); i++)
|
||||||
{
|
{
|
||||||
|
@ -369,7 +369,7 @@ void UIPopupMenu::Draw
|
||||||
m_font->setColor(textColor);
|
m_font->setColor(textColor);
|
||||||
m_marlett.setColor(textColor);
|
m_marlett.setColor(textColor);
|
||||||
const char *text = Sys_LV_CL_ConvertString(desc->title);
|
const char *text = Sys_LV_CL_ConvertString(desc->title);
|
||||||
m_font->Print(4.0f, top / m_vVirtualScale[1], text, -1, m_bVirtual);
|
m_font->Print(4.0f, top / getVirtualScale()[1], text, -1, getVirtualScale());
|
||||||
|
|
||||||
if (desc->type == UIP_SUBMENU)
|
if (desc->type == UIP_SUBMENU)
|
||||||
{
|
{
|
||||||
|
@ -378,7 +378,7 @@ void UIPopupMenu::Draw
|
||||||
m_iFontAlignmentHorizontal,
|
m_iFontAlignmentHorizontal,
|
||||||
m_iFontAlignmentVertical,
|
m_iFontAlignmentVertical,
|
||||||
"4",
|
"4",
|
||||||
m_bVirtual ? m_vVirtualScale : NULL
|
getVirtualScale()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,7 +115,7 @@ UIRect2D UIPulldownMenu::getAlignmentRect
|
||||||
m_vVirtualScale[1] = (float)uid.vidHeight / SCREEN_HEIGHT;
|
m_vVirtualScale[1] = (float)uid.vidHeight / SCREEN_HEIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
int maxheight = m_font->getHeight(m_bVirtual);
|
int maxheight = m_font->getHeight(m_bVirtual ? m_vVirtualScale : NULL);
|
||||||
for (int i = 1; i <= m_desc.NumObjects(); i++)
|
for (int i = 1; i <= m_desc.NumObjects(); i++)
|
||||||
{
|
{
|
||||||
uipull_describe *uipd = m_desc.ObjectAt(i);
|
uipull_describe *uipd = m_desc.ObjectAt(i);
|
||||||
|
@ -164,7 +164,7 @@ float UIPulldownMenu::getDescHeight
|
||||||
return uii.Rend_GetShaderHeight(mat->GetMaterial());
|
return uii.Rend_GetShaderHeight(mat->GetMaterial());
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_font->getHeight(m_bVirtual);
|
return m_font->getHeight(m_bVirtual ? m_vVirtualScale : NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
uipull_describe *UIPulldownMenu::getPulldown
|
uipull_describe *UIPulldownMenu::getPulldown
|
||||||
|
@ -590,7 +590,7 @@ void UIPulldownMenu::Draw
|
||||||
const char *text = Sys_LV_CL_ConvertString(desc->title);
|
const char *text = Sys_LV_CL_ConvertString(desc->title);
|
||||||
float text_xpos = m_vVirtualScale[0] * 4.0f + atx;
|
float text_xpos = m_vVirtualScale[0] * 4.0f + atx;
|
||||||
float text_ypos = m_vVirtualScale[1] * 2.0f;
|
float text_ypos = m_vVirtualScale[1] * 2.0f;
|
||||||
m_font->Print(text_xpos, text_ypos, text, -1, m_bVirtual);
|
m_font->Print(text_xpos, text_ypos, text, -1, m_bVirtual ? m_vVirtualScale : NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
atx += width;
|
atx += width;
|
||||||
|
|
|
@ -51,10 +51,10 @@ void UIWindowSizer::Draw
|
||||||
|
|
||||||
{
|
{
|
||||||
m_font->setColor(UWhite);
|
m_font->setColor(UWhite);
|
||||||
m_font->Print(0, 0, "o", -1, m_bVirtual);
|
m_font->Print(0, 0, "o", -1, getVirtualScale());
|
||||||
|
|
||||||
m_font->setColor(UBlack);
|
m_font->setColor(UBlack);
|
||||||
m_font->Print(0, 0, "p", -1, m_bVirtual);
|
m_font->Print(0, 0, "p", -1, getVirtualScale());
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIWindowSizer::FrameInitialized
|
void UIWindowSizer::FrameInitialized
|
||||||
|
@ -202,7 +202,7 @@ void UIStatusBar::Draw
|
||||||
m_iFontAlignmentHorizontal,
|
m_iFontAlignmentHorizontal,
|
||||||
m_iFontAlignmentVertical,
|
m_iFontAlignmentVertical,
|
||||||
Sys_LV_CL_ConvertString(m_title.c_str()),
|
Sys_LV_CL_ConvertString(m_title.c_str()),
|
||||||
m_bVirtual ? m_vVirtualScale : NULL
|
getVirtualScale()
|
||||||
);
|
);
|
||||||
|
|
||||||
if (m_sizer)
|
if (m_sizer)
|
||||||
|
@ -267,16 +267,13 @@ void UIStatusBar::SelfSized
|
||||||
{
|
{
|
||||||
if (m_sizeenabled)
|
if (m_sizeenabled)
|
||||||
{
|
{
|
||||||
if (m_sizer) {
|
if (!m_sizer) {
|
||||||
if (m_sizer->getDraggingWidget() != m_sizeenabled) {
|
m_sizer = new UIWindowSizer(m_sizeenabled);
|
||||||
m_sizer->setDraggingWidget(m_sizeenabled);
|
m_sizer->InitFrame(this, 0, 0, 16.0 * getHighResScale()[0], 16.0 * getHighResScale()[1], 0);
|
||||||
}
|
|
||||||
}
|
} else if (m_sizer->getDraggingWidget() != m_sizeenabled) {
|
||||||
else {
|
m_sizer->setDraggingWidget(m_sizeenabled);
|
||||||
m_sizer = new UIWindowSizer(m_sizeenabled);
|
}
|
||||||
m_sizer->InitFrame(this, 0, 0, 16.0, 16.0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
UISize2D sizerFrame = m_sizer->getSize();
|
UISize2D sizerFrame = m_sizer->getSize();
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ int UIVertScroll::getItemFromHeight
|
||||||
)
|
)
|
||||||
|
|
||||||
{
|
{
|
||||||
return (int)((height - 16.0) * (float)this->m_numitems / (m_frame.size.height - 32.0));
|
return (int)((height - 16.0 * uid.scaleRes[1]) * (float)this->m_numitems / (m_frame.size.height - 32.0 * uid.scaleRes[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UIVertScroll::isEnoughItems
|
bool UIVertScroll::isEnoughItems
|
||||||
|
@ -102,7 +102,7 @@ void UIVertScroll::Draw
|
||||||
);
|
);
|
||||||
|
|
||||||
DrawArrow(0.0, "5", m_pressed == VS_UP_ARROW);
|
DrawArrow(0.0, "5", m_pressed == VS_UP_ARROW);
|
||||||
DrawArrow(m_frame.size.height - m_vVirtualScale[1] * 16.0, "6", m_pressed == VS_DOWN_ARROW);
|
DrawArrow(m_frame.size.height - getVirtualScale()[1] * 16.0, "6", m_pressed == VS_DOWN_ARROW);
|
||||||
|
|
||||||
if (m_numitems > m_pageheight) {
|
if (m_numitems > m_pageheight) {
|
||||||
DrawThumb();
|
DrawThumb();
|
||||||
|
@ -123,7 +123,7 @@ void UIVertScroll::DrawArrow
|
||||||
arrowRect.pos.x = 0.0;
|
arrowRect.pos.x = 0.0;
|
||||||
arrowRect.pos.y = top;
|
arrowRect.pos.y = top;
|
||||||
arrowRect.size.width = m_frame.size.width;
|
arrowRect.size.width = m_frame.size.width;
|
||||||
arrowRect.size.height = m_vVirtualScale[1] * 16.0;
|
arrowRect.size.height = getVirtualScale()[1] * 16.0;
|
||||||
|
|
||||||
innerColor = getBackgroundColor();
|
innerColor = getBackgroundColor();
|
||||||
m_marlett.setColor(getForegroundColor());
|
m_marlett.setColor(getForegroundColor());
|
||||||
|
@ -150,7 +150,7 @@ void UIVertScroll::DrawArrow
|
||||||
m_iFontAlignmentHorizontal,
|
m_iFontAlignmentHorizontal,
|
||||||
m_iFontAlignmentVertical,
|
m_iFontAlignmentVertical,
|
||||||
Sys_LV_CL_ConvertString(text),
|
Sys_LV_CL_ConvertString(text),
|
||||||
m_bVirtual ? m_vVirtualScale : NULL
|
getVirtualScale()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,10 +164,10 @@ void UIVertScroll::DrawThumb
|
||||||
float thumbHeight, thumbdiff;
|
float thumbHeight, thumbdiff;
|
||||||
UColor thumbInside;
|
UColor thumbInside;
|
||||||
|
|
||||||
thumbdiff = m_frame.size.height - m_vVirtualScale[1] * 32.0;
|
thumbdiff = m_frame.size.height - getVirtualScale()[1] * 32.0;
|
||||||
|
|
||||||
inbarrect.pos.x = 0.0;
|
inbarrect.pos.x = 0.0;
|
||||||
inbarrect.pos.y = m_vVirtualScale[1] * 16.0;
|
inbarrect.pos.y = getVirtualScale()[1] * 16.0;
|
||||||
inbarrect.size.width = m_frame.size.width;
|
inbarrect.size.width = m_frame.size.width;
|
||||||
inbarrect.size.height = m_frame.size.height - thumbdiff;
|
inbarrect.size.height = m_frame.size.height - thumbdiff;
|
||||||
|
|
||||||
|
@ -500,10 +500,10 @@ void UIVertScroll::InitFrameAlignRight
|
||||||
UIRect2D frame, frameOut;
|
UIRect2D frame, frameOut;
|
||||||
|
|
||||||
frame = parent->getClientFrame();
|
frame = parent->getClientFrame();
|
||||||
frameOut.pos.x = frame.pos.x + frame.size.width - (fWidthPadding + 16.0) * m_vVirtualScale[0];
|
frameOut.pos.x = frame.pos.x + frame.size.width - (fWidthPadding + 16.0) * getVirtualScale()[0];
|
||||||
frameOut.pos.y = fHeightPadding * m_vVirtualScale[1];
|
frameOut.pos.y = fHeightPadding * getVirtualScale()[1];
|
||||||
frameOut.size.width = m_vVirtualScale[0] * 16.0;
|
frameOut.size.width = getVirtualScale()[0] * 16.0;
|
||||||
frameOut.size.height = frame.size.height - (fHeightPadding * 2) * m_vVirtualScale[1];
|
frameOut.size.height = frame.size.height - (fHeightPadding * 2) * getVirtualScale()[1];
|
||||||
|
|
||||||
if (!m_frameinitted)
|
if (!m_frameinitted)
|
||||||
{
|
{
|
||||||
|
@ -514,3 +514,8 @@ void UIVertScroll::InitFrameAlignRight
|
||||||
setFrame(frameOut);
|
setFrame(frameOut);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UIVertScroll::FrameInitialized()
|
||||||
|
{
|
||||||
|
UIWidget::FrameInitialized();
|
||||||
|
}
|
||||||
|
|
|
@ -70,5 +70,6 @@ public:
|
||||||
void setThumbColor( const UColor& thumb );
|
void setThumbColor( const UColor& thumb );
|
||||||
void setSolidBorderColor( const UColor& col );
|
void setSolidBorderColor( const UColor& col );
|
||||||
void InitFrameAlignRight( UIWidget *parent, float fWidthPadding, float fHeightPadding );
|
void InitFrameAlignRight( UIWidget *parent, float fWidthPadding, float fHeightPadding );
|
||||||
|
void FrameInitialized() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -607,6 +607,23 @@ void DrawBoxWithSolidBorder( const UIRect2D& rect, const UColor& inside, const U
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool scaleFrameVirtualRes(UIRect2D& frame, vec3_t outScale, const vec3_t newScale)
|
||||||
|
{
|
||||||
|
if (!VectorCompare2D(outScale, newScale))
|
||||||
|
{
|
||||||
|
frame.pos.x = frame.pos.x / outScale[0] * newScale[0];
|
||||||
|
frame.pos.y = frame.pos.y / outScale[1] * newScale[1];
|
||||||
|
frame.size.width = frame.size.width / outScale[0] * newScale[0];
|
||||||
|
frame.size.height = frame.size.height / outScale[1] * newScale[1];
|
||||||
|
outScale[0] = newScale[0];
|
||||||
|
outScale[1] = newScale[1];
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
UIReggedMaterial::UIReggedMaterial()
|
UIReggedMaterial::UIReggedMaterial()
|
||||||
{
|
{
|
||||||
hMat = 0;
|
hMat = 0;
|
||||||
|
@ -924,7 +941,7 @@ void UIWidget::DrawTitle
|
||||||
|
|
||||||
{
|
{
|
||||||
m_font->setColor( m_foreground_color );
|
m_font->setColor( m_foreground_color );
|
||||||
m_font->Print( x, y, Sys_LV_CL_ConvertString( m_title ), -1, m_bVirtual );
|
m_font->Print( x, y, Sys_LV_CL_ConvertString( m_title ), -1, getVirtualScale() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIWidget::Motion
|
void UIWidget::Motion
|
||||||
|
@ -1108,16 +1125,17 @@ void UIWidget::AlignPosition
|
||||||
|
|
||||||
SetVirtualScale(vNewVirtualScale);
|
SetVirtualScale(vNewVirtualScale);
|
||||||
|
|
||||||
if (!VectorCompare2D(m_vVirtualScale, vNewVirtualScale))
|
scaleFrameVirtualRes(m_frame, m_vVirtualScale, vNewVirtualScale);
|
||||||
{
|
|
||||||
m_frame.pos.x = m_frame.pos.x / m_vVirtualScale[0] * vNewVirtualScale[0];
|
|
||||||
m_frame.pos.y = m_frame.pos.y / m_vVirtualScale[1] * vNewVirtualScale[1];
|
|
||||||
m_frame.size.width = m_frame.size.width / m_vVirtualScale[0] * vNewVirtualScale[0];
|
|
||||||
m_frame.size.height = m_frame.size.height / m_vVirtualScale[1] * vNewVirtualScale[1];
|
|
||||||
m_vVirtualScale[0] = vNewVirtualScale[0];
|
|
||||||
m_vVirtualScale[1] = vNewVirtualScale[1];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else if (uid.bHighResScaling)
|
||||||
|
{
|
||||||
|
scaleFrameVirtualRes(m_frame, m_vVirtualScale, uid.scaleRes);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vec2_t vNewVirtualScale = { 1.0, 1.0 };
|
||||||
|
scaleFrameVirtualRes(m_frame, m_vVirtualScale, vNewVirtualScale);
|
||||||
|
}
|
||||||
|
|
||||||
if (m_flags & WF_STRETCH_VERTICAL)
|
if (m_flags & WF_STRETCH_VERTICAL)
|
||||||
{
|
{
|
||||||
|
@ -1330,7 +1348,7 @@ void UIWidget::InitFrame
|
||||||
setParent( parentview );
|
setParent( parentview );
|
||||||
}
|
}
|
||||||
else if( this != &uWinMan )
|
else if( this != &uWinMan )
|
||||||
{
|
{
|
||||||
setParent( &uWinMan );
|
setParent( &uWinMan );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2473,7 +2491,7 @@ void UIWidget::Display
|
||||||
|
|
||||||
if( m_flags & WF_TILESHADER )
|
if( m_flags & WF_TILESHADER )
|
||||||
{
|
{
|
||||||
if (m_bVirtual) {
|
if (m_bVirtual) {
|
||||||
float fvWidth = m_frame.size.width / m_vVirtualScale[0] / uii.Rend_GetShaderWidth(m_material->GetMaterial());
|
float fvWidth = m_frame.size.width / m_vVirtualScale[0] / uii.Rend_GetShaderWidth(m_material->GetMaterial());
|
||||||
float fvHeight = m_frame.size.height / m_vVirtualScale[1] / uii.Rend_GetShaderHeight(m_material->GetMaterial());
|
float fvHeight = m_frame.size.height / m_vVirtualScale[1] / uii.Rend_GetShaderHeight(m_material->GetMaterial());
|
||||||
|
|
||||||
|
@ -2555,7 +2573,7 @@ float UIWidget::getTitleHeight
|
||||||
)
|
)
|
||||||
|
|
||||||
{
|
{
|
||||||
return m_font->getHeight( m_bVirtual );
|
return m_font->getHeight(getVirtualScale());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UIWidget::CanActivate
|
bool UIWidget::CanActivate
|
||||||
|
@ -2741,22 +2759,27 @@ void UIWidget::Realign
|
||||||
)
|
)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
bool bScaled = false;
|
||||||
|
|
||||||
if (m_bVirtual)
|
if (m_bVirtual)
|
||||||
{
|
{
|
||||||
vec2_t vNewVirtualScale;
|
vec2_t vNewVirtualScale;
|
||||||
|
|
||||||
SetVirtualScale(vNewVirtualScale);
|
SetVirtualScale(vNewVirtualScale);
|
||||||
|
|
||||||
if (!VectorCompare2D(m_vVirtualScale, vNewVirtualScale))
|
scaleFrameVirtualRes(m_frame, m_vVirtualScale, vNewVirtualScale);
|
||||||
{
|
bScaled = true;
|
||||||
m_frame.pos.x = m_frame.pos.x / m_vVirtualScale[0] * vNewVirtualScale[0];
|
|
||||||
m_frame.pos.y = m_frame.pos.y / m_vVirtualScale[1] * vNewVirtualScale[1];
|
|
||||||
m_frame.size.width = m_frame.size.width / m_vVirtualScale[0] * vNewVirtualScale[0];
|
|
||||||
m_frame.size.height = m_frame.size.height / m_vVirtualScale[1] * vNewVirtualScale[1];
|
|
||||||
m_vVirtualScale[0] = vNewVirtualScale[0];
|
|
||||||
m_vVirtualScale[1] = vNewVirtualScale[1];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else if (uid.bHighResScaling)
|
||||||
|
{
|
||||||
|
scaleFrameVirtualRes(m_frame, m_vVirtualScale, uid.scaleRes);
|
||||||
|
bScaled = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vec2_t vNewVirtualScale = { 1.0, 1.0 };
|
||||||
|
bScaled = scaleFrameVirtualRes(m_frame, m_vVirtualScale, vNewVirtualScale);
|
||||||
|
}
|
||||||
|
|
||||||
if (m_flags & WF_STRETCH_VERTICAL)
|
if (m_flags & WF_STRETCH_VERTICAL)
|
||||||
{
|
{
|
||||||
|
@ -2797,7 +2820,7 @@ void UIWidget::Realign
|
||||||
m_frame.pos.y = 0;
|
m_frame.pos.y = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((m_align & WA_FULL) || (m_flags & (WF_STRETCH_HORIZONTAL | WF_STRETCH_VERTICAL)) || (m_bVirtual))
|
if ((m_align & WA_FULL) || (m_flags & (WF_STRETCH_HORIZONTAL | WF_STRETCH_VERTICAL)) || bScaled)
|
||||||
{
|
{
|
||||||
setFrame(m_frame);
|
setFrame(m_frame);
|
||||||
m_startingpos = m_frame.pos;
|
m_startingpos = m_frame.pos;
|
||||||
|
@ -3119,7 +3142,16 @@ bool UIWidget::isVirtual() const
|
||||||
|
|
||||||
const vec2_t& UIWidget::getVirtualScale() const
|
const vec2_t& UIWidget::getVirtualScale() const
|
||||||
{
|
{
|
||||||
return m_vVirtualScale;
|
if (m_bVirtual) {
|
||||||
|
return m_vVirtualScale;
|
||||||
|
} else {
|
||||||
|
return uid.scaleRes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const vec2_t& UIWidget::getHighResScale() const
|
||||||
|
{
|
||||||
|
return uid.scaleRes;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIWidget::SetEnabledCvar
|
void UIWidget::SetEnabledCvar
|
||||||
|
@ -3208,16 +3240,17 @@ void UIWidgetContainer::AlignPosition
|
||||||
|
|
||||||
SetVirtualScale(vNewVirtualScale);
|
SetVirtualScale(vNewVirtualScale);
|
||||||
|
|
||||||
if (!VectorCompare2D(m_vVirtualScale, vNewVirtualScale))
|
scaleFrameVirtualRes(m_frame, m_vVirtualScale, vNewVirtualScale);
|
||||||
{
|
|
||||||
m_frame.pos.x = m_frame.pos.x / m_vVirtualScale[0] * vNewVirtualScale[0];
|
|
||||||
m_frame.pos.y = m_frame.pos.y / m_vVirtualScale[1] * vNewVirtualScale[1];
|
|
||||||
m_frame.size.width = m_frame.size.width / m_vVirtualScale[0] * vNewVirtualScale[0];
|
|
||||||
m_frame.size.height = m_frame.size.height / m_vVirtualScale[1] * vNewVirtualScale[1];
|
|
||||||
m_vVirtualScale[0] = vNewVirtualScale[0];
|
|
||||||
m_vVirtualScale[1] = vNewVirtualScale[1];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else if (uid.bHighResScaling)
|
||||||
|
{
|
||||||
|
scaleFrameVirtualRes(m_frame, m_vVirtualScale, uid.scaleRes);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vec2_t vNewVirtualScale = { 1.0, 1.0 };
|
||||||
|
scaleFrameVirtualRes(m_frame, m_vVirtualScale, vNewVirtualScale);
|
||||||
|
}
|
||||||
|
|
||||||
if (m_align & WA_LEFT)
|
if (m_align & WA_LEFT)
|
||||||
{
|
{
|
||||||
|
|
|
@ -333,6 +333,7 @@ public:
|
||||||
// Added in OPM
|
// Added in OPM
|
||||||
bool isVirtual() const;
|
bool isVirtual() const;
|
||||||
const vec2_t& getVirtualScale() const;
|
const vec2_t& getVirtualScale() const;
|
||||||
|
const vec2_t& getHighResScale() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class UIWidgetContainer : public UIWidget {
|
class UIWidgetContainer : public UIWidget {
|
||||||
|
|
|
@ -269,7 +269,7 @@ void UIWindowManager::UpdateViews(void)
|
||||||
if (UI_GetCvarInt("ui_drawcoords", 0)) {
|
if (UI_GetCvarInt("ui_drawcoords", 0)) {
|
||||||
x = uid.mouseX + 10;
|
x = uid.mouseX + 10;
|
||||||
y = uid.mouseY - 10;
|
y = uid.mouseY - 10;
|
||||||
m_font->Print(x, y, va("%d:%d", uid.mouseX, uid.mouseY), -1, m_bVirtual);
|
m_font->Print(x, y, va("%d:%d", uid.mouseX, uid.mouseY), -1, m_bVirtual ? m_vVirtualScale : NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ A lot of bugs and exploits from MOH:AA were fixed in OpenMoHAA (BOF exploit, gre
|
||||||
- Cross-platform support
|
- Cross-platform support
|
||||||
- Multiuser support on OS (On Windows, user game data is stored in "%APPDATA%\openmohaa")
|
- Multiuser support on OS (On Windows, user game data is stored in "%APPDATA%\openmohaa")
|
||||||
- Many bug fixes and additions from ioquake3
|
- Many bug fixes and additions from ioquake3
|
||||||
|
- Automatic scaling of UI elements on high resolutions like 4K
|
||||||
|
|
||||||
Overall, better compatibility on modern systems and bugfixes.
|
Overall, better compatibility on modern systems and bugfixes.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue