1
1
forked from 0ad/0ad

tiny bit of dox

This was SVN commit r377.
This commit is contained in:
janwas 2004-06-03 01:42:40 +00:00
parent 2339389870
commit a5938f5e13
2 changed files with 13 additions and 12 deletions

View File

@ -9,7 +9,7 @@ CConsole::CConsole(float X, float Y, float W, float H)
m_bToggle = false;
m_bVisible = false;
m_VisibleFrac = 0.0f;
m_fVisibleFrac = 0.0f;
m_szBuffer = (char*)malloc(sizeof(char) * BUFFER_SIZE);
FlushBuffer();
@ -114,19 +114,19 @@ void CConsole::Update(const float DeltaTime)
const float Delta = DeltaTime / AnimateTime;
if(m_bVisible)
{
m_VisibleFrac += Delta;
if(m_VisibleFrac > 1.0f)
m_fVisibleFrac += Delta;
if(m_fVisibleFrac > 1.0f)
{
m_VisibleFrac = 1.0f;
m_fVisibleFrac = 1.0f;
m_bToggle = false;
}
}
else
{
m_VisibleFrac -= Delta;
if(m_VisibleFrac < 0.0f)
m_fVisibleFrac -= Delta;
if(m_fVisibleFrac < 0.0f)
{
m_VisibleFrac = 0.0f;
m_fVisibleFrac = 0.0f;
m_bToggle = false;
}
}
@ -140,7 +140,7 @@ void CConsole::Render()
// animation: slide in from top of screen
const float MaxY = m_fHeight;
const float DeltaY = (1.0f - m_VisibleFrac) * MaxY;
const float DeltaY = (1.0f - m_fVisibleFrac) * MaxY;
glTranslatef(m_fX, m_fY + DeltaY, 0.0f); //Move to window position

View File

@ -26,8 +26,9 @@ private:
float m_fHeight;
float m_fWidth;
// show / hide animation
float m_VisibleFrac;
// "position" in show/hide animation, how visible the console is (0..1).
// allows implementing other animations than sliding, e.g. fading in/out.
float m_fVisibleFrac;
std::map<std::string, fptr> m_mapFuncList;
@ -41,8 +42,8 @@ private:
int m_iBufferLength;
bool m_bFocus;
bool m_bVisible;
bool m_bToggle;
bool m_bVisible; // console is to be drawn
bool m_bToggle; // show/hide animation is currently active
char* ToLower(const char* szMessage, uint iSize = 0);
char* Trim(const char* szMessage, const char cChar = 32, uint iSize = 0);