Feature tracker item 1885951:

Added LogSize option to celestia.cfg. The value of LogSize controls the number of rows in Celestia's console log. Added comment and usage example to celestia.cfg.
This commit is contained in:
Chris Laurel 2008-03-19 22:34:05 +00:00
parent dcc1d75b99
commit 585fb39859
6 changed files with 44 additions and 0 deletions

View file

@ -326,6 +326,13 @@ StarTextures
# IgnoreGLExtensions [ "GL_ARB_vertex_program" ]
#------------------------------------------------------------------------
# The number of rows in the debug log (displayable onscreen by pressing
# the ~ (tilde). The default log size is 200.
#------------------------------------------------------------------------
# LogSize 1000
#------------------------------------------------------------------------
# The LabelledStars section defines which stars will have text labels
# assigned to them, which are visible when this option is turned on.

View file

@ -10,6 +10,7 @@
#include <cstdarg>
#include <cstdio>
#include <cassert>
#include <algorithm>
#include "celutil/utf8.h"
#include "gl.h"
#include "vecgl.h"
@ -52,6 +53,32 @@ Console::~Console()
}
/*! Resize the console log to use the specified number of rows.
* Old long entries are preserved in the resize. setRowCount()
* returns true if it was able to successfully allocate a new
* buffer, and false if there was a problem (out of memory.)
*/
bool Console::setRowCount(int _nRows)
{
wchar_t* newText = new wchar_t[(nColumns + 1) * _nRows];
if (newText == NULL)
return false;
for (int i = 0; i < _nRows; i++)
{
newText[(nColumns + 1) * i] = '\0';
}
std::copy(newText, newText + (nColumns + 1) * min(_nRows, nRows), text);
delete[] text;
text = newText;
nRows = _nRows;
return true;
}
void Console::begin()
{
glMatrixMode(GL_PROJECTION);

View file

@ -47,6 +47,8 @@ class Console : public std::ostream
Console(int _nRows, int _nColumns);
~Console();
bool setRowCount(int _nRows);
void begin();
void end();
void render(int rowHeight);

View file

@ -3969,6 +3969,10 @@ bool CelestiaCore::initSimulation(const string* configFileName,
return false;
}
// Set the console log size; ignore any request to use less than 100 lines
if (config->consoleLogRows > 100)
console.setRowCount(config->consoleLogRows);
#ifdef USE_SPICE
if (!InitializeSpice())
{

View file

@ -131,6 +131,8 @@ CelestiaConfig* ReadCelestiaConfig(string filename, CelestiaConfig *config)
config->shadowTextureSize = getUint(configParams, "ShadowTextureSize", 256);
config->eclipseTextureSize = getUint(configParams, "EclipseTextureSize", 128);
config->consoleLogRows = getUint(configParams, "LogSize", 200);
Value* solarSystemsVal = configParams->getValue("SolarSystemCatalogs");
if (solarSystemsVal != NULL)
{

View file

@ -63,6 +63,8 @@ public:
unsigned int aaSamples;
bool hdr;
unsigned int consoleLogRows;
Hash* params;