mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 14:51:51 +00:00
- Moved the vid_fps display to the upper-right of the screen.
- The stat display can now show multiple stats at once. SVN r328 (trunk)
This commit is contained in:
parent
76e94bde6b
commit
b951721c1b
4 changed files with 39 additions and 43 deletions
|
@ -1,4 +1,6 @@
|
|||
September 13, 2006
|
||||
- Moved the vid_fps display to the upper-right of the screen.
|
||||
- The stat display can now show multiple stats at once.
|
||||
- Fixed: cycle_t was still a DWORD and not a QWORD under GCC.
|
||||
- The stat meters now return an FString instead of sprintfing into a fixed
|
||||
output buffer.
|
||||
|
|
|
@ -41,19 +41,19 @@
|
|||
#include "c_dispatch.h"
|
||||
#include "m_swap.h"
|
||||
|
||||
FStat *FStat::m_FirstStat;
|
||||
FStat *FStat::m_CurrStat;
|
||||
FStat *FStat::FirstStat;
|
||||
|
||||
FStat::FStat (const char *name)
|
||||
{
|
||||
m_Name = name;
|
||||
m_Next = m_FirstStat;
|
||||
m_FirstStat = this;
|
||||
m_Active = false;
|
||||
m_Next = FirstStat;
|
||||
FirstStat = this;
|
||||
}
|
||||
|
||||
FStat::~FStat ()
|
||||
{
|
||||
FStat **prev = &m_FirstStat;
|
||||
FStat **prev = &FirstStat;
|
||||
|
||||
while (*prev && *prev != this)
|
||||
prev = &((*prev)->m_Next)->m_Next;
|
||||
|
@ -64,7 +64,7 @@ FStat::~FStat ()
|
|||
|
||||
FStat *FStat::FindStat (const char *name)
|
||||
{
|
||||
FStat *stat = m_FirstStat;
|
||||
FStat *stat = FirstStat;
|
||||
|
||||
while (stat && stricmp (name, stat->m_Name))
|
||||
stat = stat->m_Next;
|
||||
|
@ -72,60 +72,52 @@ FStat *FStat::FindStat (const char *name)
|
|||
return stat;
|
||||
}
|
||||
|
||||
void FStat::SelectStat (const char *name)
|
||||
{
|
||||
FStat *stat = FindStat (name);
|
||||
if (stat)
|
||||
SelectStat (stat);
|
||||
else
|
||||
Printf ("Unknown stat: %s\n", name);
|
||||
}
|
||||
|
||||
void FStat::SelectStat (FStat *stat)
|
||||
{
|
||||
m_CurrStat = stat;
|
||||
SB_state = screen->GetPageCount ();
|
||||
}
|
||||
|
||||
void FStat::ToggleStat (const char *name)
|
||||
{
|
||||
FStat *stat = FindStat (name);
|
||||
if (stat)
|
||||
ToggleStat (stat);
|
||||
stat->ToggleStat ();
|
||||
else
|
||||
Printf ("Unknown stat: %s\n", name);
|
||||
}
|
||||
|
||||
void FStat::ToggleStat (FStat *stat)
|
||||
void FStat::ToggleStat ()
|
||||
{
|
||||
if (m_CurrStat == stat)
|
||||
m_CurrStat = NULL;
|
||||
else
|
||||
m_CurrStat = stat;
|
||||
m_Active = !m_Active;
|
||||
SB_state = screen->GetPageCount ();
|
||||
}
|
||||
|
||||
void FStat::PrintStat ()
|
||||
{
|
||||
if (m_CurrStat)
|
||||
int y = SCREENHEIGHT - SmallFont->GetHeight();
|
||||
int count = 0;
|
||||
|
||||
screen->SetFont (ConFont);
|
||||
for (FStat *stat = FirstStat; stat != NULL; stat = stat->m_Next)
|
||||
{
|
||||
if (stat->m_Active)
|
||||
{
|
||||
FString stattext(stat->GetStats());
|
||||
screen->DrawText (CR_GREEN, 5, y, stattext, TAG_DONE);
|
||||
y -= SmallFont->GetHeight() + 1;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
screen->SetFont (SmallFont);
|
||||
if (count)
|
||||
{
|
||||
FString stattext(m_CurrStat->GetStats());
|
||||
screen->SetFont (ConFont);
|
||||
screen->DrawText (CR_GREEN, 5, SCREENHEIGHT -
|
||||
SmallFont->GetHeight(), stattext, TAG_DONE);
|
||||
screen->SetFont (SmallFont);
|
||||
SB_state = screen->GetPageCount ();
|
||||
}
|
||||
}
|
||||
|
||||
void FStat::DumpRegisteredStats ()
|
||||
{
|
||||
FStat *stat = m_FirstStat;
|
||||
FStat *stat = FirstStat;
|
||||
|
||||
Printf ("Available stats:\n");
|
||||
while (stat)
|
||||
{
|
||||
Printf (" %s\n", stat->m_Name);
|
||||
Printf (" %c%s\n", stat->m_Active ? '*' : ' ', stat->m_Name);
|
||||
stat = stat->m_Next;
|
||||
}
|
||||
}
|
||||
|
|
11
src/stats.h
11
src/stats.h
|
@ -93,20 +93,19 @@ public:
|
|||
|
||||
virtual FString GetStats () = 0;
|
||||
|
||||
void ToggleStat ();
|
||||
|
||||
static void PrintStat ();
|
||||
static FStat *FindStat (const char *name);
|
||||
static void SelectStat (const char *name);
|
||||
static void SelectStat (FStat *stat);
|
||||
static void ToggleStat (const char *name);
|
||||
static void ToggleStat (FStat *stat);
|
||||
inline static FStat *ActiveStat () { return m_CurrStat; }
|
||||
static void DumpRegisteredStats ();
|
||||
|
||||
private:
|
||||
FStat *m_Next;
|
||||
const char *m_Name;
|
||||
static FStat *m_FirstStat;
|
||||
static FStat *m_CurrStat;
|
||||
bool m_Active;
|
||||
|
||||
static FStat *FirstStat;
|
||||
};
|
||||
|
||||
#define ADD_STAT(n) \
|
||||
|
|
|
@ -188,6 +188,9 @@ void DCanvas::Clear (int left, int top, int right, int bottom, int color) const
|
|||
int x, y;
|
||||
BYTE *dest;
|
||||
|
||||
assert (left < right);
|
||||
assert (top < bottom);
|
||||
|
||||
dest = Buffer + top * Pitch + left;
|
||||
x = right - left;
|
||||
for (y = top; y < bottom; y++)
|
||||
|
@ -634,9 +637,9 @@ void DFrameBuffer::DrawRateStuff ()
|
|||
int chars;
|
||||
|
||||
chars = sprintf (fpsbuff, "%2u ms (%3u fps)", howlong, LastCount);
|
||||
Clear (0, screen->GetHeight() - 8, chars * 8, screen->GetHeight(), 0);
|
||||
Clear (Width - chars * 8, 0, Width, 8, 0);
|
||||
SetFont (ConFont);
|
||||
DrawText (CR_WHITE, 0, screen->GetHeight() - 8, (char *)&fpsbuff[0], TAG_DONE);
|
||||
DrawText (CR_WHITE, Width - chars * 8, 0, (char *)&fpsbuff[0], TAG_DONE);
|
||||
SetFont (SmallFont);
|
||||
|
||||
DWORD thisSec = ms/1000;
|
||||
|
|
Loading…
Reference in a new issue