mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 21:33:09 +02:00
brings Log class into stable state
This commit is contained in:
parent
58b40f7ed2
commit
cf3e2635c1
2 changed files with 13 additions and 3 deletions
|
@ -18,12 +18,13 @@
|
|||
|
||||
namespace {
|
||||
// anonymous namespace - everything in here only exists within this very .cpp file
|
||||
// just as 'static' on every effective line in plain C
|
||||
|
||||
unsigned const CHARACTER_BUFFER_SIZE = 16384;
|
||||
unsigned const LINE_BUFFER_SIZE = 256;
|
||||
unsigned const MAX_MESSAGE_LENGTH = 512;
|
||||
|
||||
bool const TEXT_MONOSPACED = false;
|
||||
bool const TEXT_MONOSPACED = true;
|
||||
|
||||
float const TEXT_RED = 0.7f;
|
||||
float const TEXT_GREEN = 0.6f;
|
||||
|
@ -117,6 +118,11 @@ inline void Log::addMessage(char const* ptr) {
|
|||
}
|
||||
*_itrLastLine = _itrWriteLineStart;
|
||||
|
||||
// terminate line, unless done already
|
||||
if (c != '\0') {
|
||||
*_itrWritePos++ = '\0';
|
||||
}
|
||||
|
||||
// remember start position in character buffer for next line and reset character count
|
||||
_itrWriteLineStart = _itrWritePos;
|
||||
_valWrittenInLine = 0;
|
||||
|
@ -249,7 +255,10 @@ void Log::render(unsigned screenWidth, unsigned screenHeight) {
|
|||
// render text
|
||||
char** line = _ptrLinesEnd + showLines;
|
||||
int x = screenWidth - _valLogWidth;
|
||||
|
||||
|
||||
|
||||
GLint matrixMode;
|
||||
glGetIntegerv(GL_MATRIX_MODE, & matrixMode);
|
||||
glPushMatrix();
|
||||
glScalef(1.0f, yScale, 1.0f);
|
||||
|
||||
|
@ -272,6 +281,7 @@ void Log::render(unsigned screenWidth, unsigned screenHeight) {
|
|||
}
|
||||
|
||||
glPopMatrix();
|
||||
glMatrixMode(matrixMode);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ class Log {
|
|||
public:
|
||||
|
||||
explicit Log(FILE* tPipeTo = stdout, unsigned bufferedLines = 1024,
|
||||
unsigned defaultLogWidth = 240, unsigned defaultCharWidth = 12, unsigned defaultCharHeight = 24);
|
||||
unsigned defaultLogWidth = 240, unsigned defaultCharWidth = 10, unsigned defaultCharHeight = 24);
|
||||
~Log();
|
||||
|
||||
void setLogWidth(unsigned pixels);
|
||||
|
|
Loading…
Reference in a new issue