mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-13 07:57:52 +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
|
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.
|
- 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
|
- The stat meters now return an FString instead of sprintfing into a fixed
|
||||||
output buffer.
|
output buffer.
|
||||||
|
|
|
@ -41,19 +41,19 @@
|
||||||
#include "c_dispatch.h"
|
#include "c_dispatch.h"
|
||||||
#include "m_swap.h"
|
#include "m_swap.h"
|
||||||
|
|
||||||
FStat *FStat::m_FirstStat;
|
FStat *FStat::FirstStat;
|
||||||
FStat *FStat::m_CurrStat;
|
|
||||||
|
|
||||||
FStat::FStat (const char *name)
|
FStat::FStat (const char *name)
|
||||||
{
|
{
|
||||||
m_Name = name;
|
m_Name = name;
|
||||||
m_Next = m_FirstStat;
|
m_Active = false;
|
||||||
m_FirstStat = this;
|
m_Next = FirstStat;
|
||||||
|
FirstStat = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
FStat::~FStat ()
|
FStat::~FStat ()
|
||||||
{
|
{
|
||||||
FStat **prev = &m_FirstStat;
|
FStat **prev = &FirstStat;
|
||||||
|
|
||||||
while (*prev && *prev != this)
|
while (*prev && *prev != this)
|
||||||
prev = &((*prev)->m_Next)->m_Next;
|
prev = &((*prev)->m_Next)->m_Next;
|
||||||
|
@ -64,7 +64,7 @@ FStat::~FStat ()
|
||||||
|
|
||||||
FStat *FStat::FindStat (const char *name)
|
FStat *FStat::FindStat (const char *name)
|
||||||
{
|
{
|
||||||
FStat *stat = m_FirstStat;
|
FStat *stat = FirstStat;
|
||||||
|
|
||||||
while (stat && stricmp (name, stat->m_Name))
|
while (stat && stricmp (name, stat->m_Name))
|
||||||
stat = stat->m_Next;
|
stat = stat->m_Next;
|
||||||
|
@ -72,60 +72,52 @@ FStat *FStat::FindStat (const char *name)
|
||||||
return stat;
|
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)
|
void FStat::ToggleStat (const char *name)
|
||||||
{
|
{
|
||||||
FStat *stat = FindStat (name);
|
FStat *stat = FindStat (name);
|
||||||
if (stat)
|
if (stat)
|
||||||
ToggleStat (stat);
|
stat->ToggleStat ();
|
||||||
else
|
else
|
||||||
Printf ("Unknown stat: %s\n", name);
|
Printf ("Unknown stat: %s\n", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FStat::ToggleStat (FStat *stat)
|
void FStat::ToggleStat ()
|
||||||
{
|
{
|
||||||
if (m_CurrStat == stat)
|
m_Active = !m_Active;
|
||||||
m_CurrStat = NULL;
|
|
||||||
else
|
|
||||||
m_CurrStat = stat;
|
|
||||||
SB_state = screen->GetPageCount ();
|
SB_state = screen->GetPageCount ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FStat::PrintStat ()
|
void FStat::PrintStat ()
|
||||||
{
|
{
|
||||||
if (m_CurrStat)
|
int y = SCREENHEIGHT - SmallFont->GetHeight();
|
||||||
{
|
int count = 0;
|
||||||
FString stattext(m_CurrStat->GetStats());
|
|
||||||
screen->SetFont (ConFont);
|
screen->SetFont (ConFont);
|
||||||
screen->DrawText (CR_GREEN, 5, SCREENHEIGHT -
|
for (FStat *stat = FirstStat; stat != NULL; stat = stat->m_Next)
|
||||||
SmallFont->GetHeight(), stattext, TAG_DONE);
|
{
|
||||||
|
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);
|
screen->SetFont (SmallFont);
|
||||||
|
if (count)
|
||||||
|
{
|
||||||
SB_state = screen->GetPageCount ();
|
SB_state = screen->GetPageCount ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FStat::DumpRegisteredStats ()
|
void FStat::DumpRegisteredStats ()
|
||||||
{
|
{
|
||||||
FStat *stat = m_FirstStat;
|
FStat *stat = FirstStat;
|
||||||
|
|
||||||
Printf ("Available stats:\n");
|
Printf ("Available stats:\n");
|
||||||
while (stat)
|
while (stat)
|
||||||
{
|
{
|
||||||
Printf (" %s\n", stat->m_Name);
|
Printf (" %c%s\n", stat->m_Active ? '*' : ' ', stat->m_Name);
|
||||||
stat = stat->m_Next;
|
stat = stat->m_Next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
11
src/stats.h
11
src/stats.h
|
@ -93,20 +93,19 @@ public:
|
||||||
|
|
||||||
virtual FString GetStats () = 0;
|
virtual FString GetStats () = 0;
|
||||||
|
|
||||||
|
void ToggleStat ();
|
||||||
|
|
||||||
static void PrintStat ();
|
static void PrintStat ();
|
||||||
static FStat *FindStat (const char *name);
|
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 (const char *name);
|
||||||
static void ToggleStat (FStat *stat);
|
|
||||||
inline static FStat *ActiveStat () { return m_CurrStat; }
|
|
||||||
static void DumpRegisteredStats ();
|
static void DumpRegisteredStats ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FStat *m_Next;
|
FStat *m_Next;
|
||||||
const char *m_Name;
|
const char *m_Name;
|
||||||
static FStat *m_FirstStat;
|
bool m_Active;
|
||||||
static FStat *m_CurrStat;
|
|
||||||
|
static FStat *FirstStat;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define ADD_STAT(n) \
|
#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;
|
int x, y;
|
||||||
BYTE *dest;
|
BYTE *dest;
|
||||||
|
|
||||||
|
assert (left < right);
|
||||||
|
assert (top < bottom);
|
||||||
|
|
||||||
dest = Buffer + top * Pitch + left;
|
dest = Buffer + top * Pitch + left;
|
||||||
x = right - left;
|
x = right - left;
|
||||||
for (y = top; y < bottom; y++)
|
for (y = top; y < bottom; y++)
|
||||||
|
@ -634,9 +637,9 @@ void DFrameBuffer::DrawRateStuff ()
|
||||||
int chars;
|
int chars;
|
||||||
|
|
||||||
chars = sprintf (fpsbuff, "%2u ms (%3u fps)", howlong, LastCount);
|
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);
|
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);
|
SetFont (SmallFont);
|
||||||
|
|
||||||
DWORD thisSec = ms/1000;
|
DWORD thisSec = ms/1000;
|
||||||
|
|
Loading…
Reference in a new issue