mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-16 01:11:44 +00:00
Add "osdscale", allowing the console text to be resized anywhere from 1-4x. It's a float because that seemed more useful to Android, where this will probably be hooked up to a slider (its intended usage).
git-svn-id: https://svn.eduke32.com/eduke32@4425 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
706f0a10ab
commit
1d077db710
4 changed files with 56 additions and 8 deletions
|
@ -11240,7 +11240,7 @@ int32_t app_main(int32_t argc, const char **argv)
|
|||
GAME_drawosdcursor,
|
||||
GAME_getcolumnwidth,
|
||||
GAME_getrowheight,
|
||||
COMMON_clearbackground,
|
||||
GAME_clearbackground,
|
||||
GetTime,
|
||||
GAME_onshowosd
|
||||
);
|
||||
|
|
|
@ -1442,6 +1442,13 @@ static int32_t osdcmd_cvar_set_game(const osdfuncparm_t *parm)
|
|||
|
||||
return r;
|
||||
}
|
||||
else if (!Bstrcasecmp(parm->name, "osdscale"))
|
||||
{
|
||||
if (xdim && ydim)
|
||||
OSD_ResizeDisplay(xdim, ydim);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
@ -1538,6 +1545,7 @@ int32_t registerosdcommands(void)
|
|||
{ "mus_volume", "controls volume of midi music", (void *)&ud.config.MusicVolume, CVAR_INT, 0, 255 },
|
||||
|
||||
{ "osdhightile", "enable/disable hires art replacements for console text", (void *)&osdhightile, CVAR_BOOL, 0, 1 },
|
||||
{ "osdscale", "adjust console text size", (void *)&osdscale, CVAR_DOUBLE|CVAR_FUNCPTR, 1.f, 4.f },
|
||||
|
||||
{ "r_drawweapon", "enable/disable weapon drawing", (void *)&ud.drawweapon, CVAR_INT, 0, 2 },
|
||||
{ "r_showfps", "show the frame rate counter", (void *)&ud.tickrate, CVAR_BOOL, 0, 1 },
|
||||
|
|
|
@ -20,6 +20,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#include <math.h>
|
||||
#include "compat.h"
|
||||
#include "duke3d.h"
|
||||
#include "build.h"
|
||||
#include "namesdyn.h"
|
||||
|
@ -27,6 +29,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "premap.h"
|
||||
|
||||
int32_t osdhightile = 0;
|
||||
double osdscale = 1.0f;
|
||||
|
||||
#define OSD_SCALE(x) (int32_t)(osdscale != 1.f ? nearbyintf(osdscale*(double)(x)) : x)
|
||||
|
||||
static int32_t GAME_isspace(int32_t ch)
|
||||
{
|
||||
|
@ -52,9 +57,11 @@ void GAME_drawosdchar(int32_t x, int32_t y, char ch, int32_t shade, int32_t pal)
|
|||
if (GAME_isspace(ch)) return;
|
||||
if ((ac = GAME_getchartile(ch)) == -1)
|
||||
return;
|
||||
|
||||
|
||||
usehightile = (osdhightile && ht);
|
||||
rotatesprite_fs((9*x)<<16, (y<<3)<<16, 65536, 0, ac, shade, pal, 8|16);
|
||||
rotatesprite_fs(OSD_SCALE(9*x<<16),
|
||||
OSD_SCALE((y<<3)<<16),
|
||||
OSD_SCALE(65536.f), 0, ac, shade, pal, 8|16);
|
||||
usehightile = ht;
|
||||
}
|
||||
|
||||
|
@ -74,7 +81,8 @@ void GAME_drawosdstr(int32_t x, int32_t y, const char *ch, int32_t len, int32_t
|
|||
if ((ac = GAME_getchartile(*ch)) >= 0)
|
||||
{
|
||||
OSD_GetShadePal(ch, &shade, &pal);
|
||||
rotatesprite_fs(x<<16, (y<<3)<<16, 65536, 0, ac, shade, pal, 8|16);
|
||||
rotatesprite_fs(OSD_SCALE(x<<16), OSD_SCALE((y<<3)<<16),
|
||||
OSD_SCALE(65536.f), 0, ac, shade, pal, 8|16);
|
||||
}
|
||||
|
||||
x += OSDCHAR_WIDTH+1;
|
||||
|
@ -95,17 +103,19 @@ void GAME_drawosdcursor(int32_t x, int32_t y, int32_t type, int32_t lastkeypress
|
|||
else ac = '_'-'!'+STARTALPHANUM;
|
||||
|
||||
if (((GetTime()-lastkeypress) & 0x40)==0)
|
||||
rotatesprite_fs((9*x)<<16, ((y<<3)+(type?-1:2))<<16, 65536, 0, ac, 0, 8, 8|16);
|
||||
rotatesprite_fs(OSD_SCALE(9*x<<16),
|
||||
OSD_SCALE(((y<<3)+(type?-1:2))<<16),
|
||||
OSD_SCALE(65536.f), 0, ac, 0, 8, 8|16);
|
||||
}
|
||||
|
||||
int32_t GAME_getcolumnwidth(int32_t w)
|
||||
{
|
||||
return w/9;
|
||||
return nearbyintf((w/9)/osdscale);
|
||||
}
|
||||
|
||||
int32_t GAME_getrowheight(int32_t w)
|
||||
int32_t GAME_getrowheight(int32_t h)
|
||||
{
|
||||
return w>>3;
|
||||
return OSD_SCALE(h>>3);
|
||||
}
|
||||
|
||||
void GAME_onshowosd(int32_t shown)
|
||||
|
@ -117,3 +127,31 @@ void GAME_onshowosd(int32_t shown)
|
|||
// if (numplayers == 1 && ((shown && !ud.pause_on) || (!shown && ud.pause_on)))
|
||||
// KB_KeyDown[sc_Pause] = 1;
|
||||
}
|
||||
|
||||
void GAME_clearbackground(int32_t numcols, int32_t numrows)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(numcols);
|
||||
|
||||
# ifdef USE_OPENGL
|
||||
if (getrendermode() >= REND_POLYMOST && qsetmode==200)
|
||||
{
|
||||
bglPushAttrib(GL_FOG_BIT);
|
||||
bglDisable(GL_FOG);
|
||||
|
||||
setpolymost2dview();
|
||||
bglColor4f(0, 0, 0, 0.67f);
|
||||
bglEnable(GL_BLEND);
|
||||
bglRectd(0, 0, xdim, OSD_SCALE(8*numrows+8));
|
||||
bglColor4f(0, 0, 0, 1);
|
||||
bglRectd(0, OSD_SCALE(8*numrows+4), xdim, OSD_SCALE(8*numrows+8));
|
||||
|
||||
bglPopAttrib();
|
||||
|
||||
return;
|
||||
}
|
||||
# endif
|
||||
|
||||
CLEARLINES2D(0, min(ydim, OSD_SCALE(numrows*8+8)), editorcolors[16]);
|
||||
}
|
||||
|
||||
#undef OSD_SCALE
|
||||
|
|
|
@ -26,8 +26,10 @@ void GAME_drawosdcursor(int32_t x, int32_t y, int32_t type, int32_t lastkeypress
|
|||
int32_t GAME_getcolumnwidth(int32_t w);
|
||||
int32_t GAME_getrowheight(int32_t w);
|
||||
void GAME_onshowosd(int32_t shown);
|
||||
void GAME_clearbackground(int32_t numcols, int32_t numrows);
|
||||
|
||||
extern int32_t osdhightile;
|
||||
extern double osdscale;
|
||||
|
||||
#define OSDCHAR_WIDTH 8
|
||||
|
||||
|
|
Loading…
Reference in a new issue