Console::Console()
{
background = new Surface("images/engine/console.png");
+ background2 = new Surface("images/engine/console2.png");
}
Console::~Console()
{
delete background;
+ delete background2;
}
void
void
Console::addLine(std::string s)
{
+ std::cerr << s << std::endl;
+ while (s.length() > 99) {
+ lines.push_front(s.substr(0, 99-3)+"...");
+ s = "..."+s.substr(99-3);
+ }
lines.push_front(s);
- if (lines.size() >= 65535) lines.pop_back();
+ while (lines.size() >= 65535) lines.pop_back();
if (height < 64) {
if (height < 4+9) height=4+9;
height+=9;
}
ticks=60;
- std::cerr << s << std::endl;
}
void
if (height == 0) return;
}
+ context.draw_surface(background2, Vector(SCREEN_WIDTH/2 - background->get_width()/2 - background->get_width() + backgroundOffset, height - background->get_height()), LAYER_FOREGROUND1+1);
+ context.draw_surface(background2, Vector(SCREEN_WIDTH/2 - background->get_width()/2 + backgroundOffset, height - background->get_height()), LAYER_FOREGROUND1+1);
context.draw_surface(background, Vector(SCREEN_WIDTH/2 - background->get_width()/2, height - background->get_height()), LAYER_FOREGROUND1+1);
+ backgroundOffset+=10;
+ if (backgroundOffset > (int)background->get_width()) backgroundOffset -= (int)background->get_width();
int lineNo = 0;
std::ostream Console::input(&Console::inputBuffer);
std::ostream Console::output(&Console::outputBuffer);
int Console::offset = 0;
+int Console::backgroundOffset = 0;
static std::list<std::string> lines; /**< backbuffer of lines sent to the console */
static std::map<std::string, std::list<ConsoleCommandReceiver*> > commands; /**< map of console commands and a list of associated ConsoleCommandReceivers */
Surface* background; /**< console background image */
+ Surface* background2; /**< second, moving console background image */
+ static int backgroundOffset; /**< current offset of scrolling background image */
static int height; /**< height of the console in px */
static int offset; /**< decrease to scroll text up */
static bool focused; /**< true if console has input focus */