* Make anti-aliassing of text optional (for slower systems); it's turned on by default though (option "textantialiassing")
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2529 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
7835b437e7
commit
9d9370e13c
|
@ -47,6 +47,17 @@ extern unsigned int iV_GetCharWidth(uint32_t charCode);
|
||||||
extern unsigned int iV_GetTextHeight(const char* string);
|
extern unsigned int iV_GetTextHeight(const char* string);
|
||||||
extern void iV_SetTextColour(SWORD Index);
|
extern void iV_SetTextColour(SWORD Index);
|
||||||
|
|
||||||
|
/** Enable or disable anti-aliasing of text
|
||||||
|
* \param enable set this to true to enable anti-aliassing of text,
|
||||||
|
* set it to false to disable it.
|
||||||
|
*/
|
||||||
|
extern void iV_SetTextAntialias(bool enable);
|
||||||
|
|
||||||
|
/** Find out if anti-aliasing of text is enabled or disabled
|
||||||
|
* \return true if anti-aliassing of text is enabled, false otherwise
|
||||||
|
*/
|
||||||
|
extern bool iV_TextAntialiased(void);
|
||||||
|
|
||||||
#define ASCII_SPACE (32)
|
#define ASCII_SPACE (32)
|
||||||
#define ASCII_NEWLINE ('@')
|
#define ASCII_NEWLINE ('@')
|
||||||
#define ASCII_COLOURMODE ('#')
|
#define ASCII_COLOURMODE ('#')
|
||||||
|
|
|
@ -45,6 +45,8 @@ static GLint GLC_Context = 0;
|
||||||
static GLint GLC_Font_Regular = 0;
|
static GLint GLC_Font_Regular = 0;
|
||||||
static GLint GLC_Font_Bold = 0;
|
static GLint GLC_Font_Bold = 0;
|
||||||
|
|
||||||
|
static bool anti_aliasing = true;
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/*
|
/*
|
||||||
* Source
|
* Source
|
||||||
|
@ -145,6 +147,16 @@ void iV_TextShutdown()
|
||||||
glcDeleteContext(GLC_Context);
|
glcDeleteContext(GLC_Context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void iV_SetTextAntialias(bool enable)
|
||||||
|
{
|
||||||
|
anti_aliasing = enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool iV_TextAntialiased()
|
||||||
|
{
|
||||||
|
return anti_aliasing;
|
||||||
|
}
|
||||||
|
|
||||||
void iV_SetFont(enum iV_fonts FontID)
|
void iV_SetFont(enum iV_fonts FontID)
|
||||||
{
|
{
|
||||||
switch (FontID)
|
switch (FontID)
|
||||||
|
@ -573,10 +585,13 @@ void iV_DrawTextRotated(const char* string, float XPos, float YPos, float rotati
|
||||||
{
|
{
|
||||||
pie_SetTexturePage(-2);
|
pie_SetTexturePage(-2);
|
||||||
|
|
||||||
// Enable Anti Aliasing
|
// Enable Anti Aliasing if it's enabled
|
||||||
|
if (anti_aliasing)
|
||||||
|
{
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||||
glEnable(GL_POLYGON_SMOOTH);
|
glEnable(GL_POLYGON_SMOOTH);
|
||||||
|
}
|
||||||
|
|
||||||
if (rotation != 0.f)
|
if (rotation != 0.f)
|
||||||
rotation = 360.f - rotation;
|
rotation = 360.f - rotation;
|
||||||
|
@ -592,9 +607,12 @@ void iV_DrawTextRotated(const char* string, float XPos, float YPos, float rotati
|
||||||
glcRenderString(string);
|
glcRenderString(string);
|
||||||
glFrontFace(GL_CCW);
|
glFrontFace(GL_CCW);
|
||||||
|
|
||||||
// Turn off anti aliasing
|
// Turn off anti aliasing (if we enabled it above)
|
||||||
|
if (anti_aliasing)
|
||||||
|
{
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
glDisable(GL_POLYGON_SMOOTH);
|
glDisable(GL_POLYGON_SMOOTH);
|
||||||
|
}
|
||||||
|
|
||||||
// Reset the current model view matrix
|
// Reset the current model view matrix
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include "lib/sound/track.h" // audio
|
#include "lib/sound/track.h" // audio
|
||||||
#include "lib/sound/cdaudio.h" // audio
|
#include "lib/sound/cdaudio.h" // audio
|
||||||
#include "lib/ivis_common/piestate.h" // setgamma.
|
#include "lib/ivis_common/piestate.h" // setgamma.
|
||||||
|
#include "lib/ivis_common/textdraw.h" // text-antialiassing
|
||||||
#include "warzoneconfig.h" // renderMode
|
#include "warzoneconfig.h" // renderMode
|
||||||
#include "component.h"
|
#include "component.h"
|
||||||
#include "text.h"
|
#include "text.h"
|
||||||
|
@ -516,6 +517,16 @@ BOOL loadConfig(void)
|
||||||
setWarzoneKeyNumeric("radarTerrainMode", radarDrawMode);
|
setWarzoneKeyNumeric("radarTerrainMode", radarDrawMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (getWarzoneKeyNumeric("text-antialiassing", &val))
|
||||||
|
{
|
||||||
|
iV_SetTextAntialias(val);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
iV_SetTextAntialias(true);
|
||||||
|
setWarzoneKeyNumeric("text-antialiassing", true);
|
||||||
|
}
|
||||||
|
|
||||||
return closeWarzoneKey();
|
return closeWarzoneKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -622,6 +633,8 @@ BOOL saveConfig(void)
|
||||||
setWarzoneKeyString("phrase4", ingame.phrases[4]);
|
setWarzoneKeyString("phrase4", ingame.phrases[4]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setWarzoneKeyNumeric("text-antialiassing", iV_TextAntialiased());
|
||||||
|
|
||||||
return closeWarzoneKey();
|
return closeWarzoneKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue