Author Topic: HELP: redirect GNE console in/output elsewhere  (Read 3603 times)

andwan0

  • User
  • *
  • Posts: 3
HELP: redirect GNE console in/output elsewhere
« on: February 19, 2009, 11:27:33 AM »
Is it possible to use the GNE console... but output somewhere else?

I like to use it mixed with a SDL GUI. I managed to build a SDL GUI sample with exhello running together, but the GNE console shows no text (however it accepts keyboard input). Also need to get input from the SDL GUI if possible....

Gillius

  • Administrator
  • User
  • *****
  • Posts: 147
    • http://www.gillius.org/
Re: HELP: redirect GNE console in/output elsewhere
« Reply #1 on: February 19, 2009, 02:35:12 PM »
You could try to replace the underlying streambuf to redirect the output somewhere else, but the original intent of the GNE console library was to support things like servers that run without any GUI at all, not for clients. The example programs use it just because it's quick and easy.

Even if you find a way to redirect it to SDL, you still need to handle the fact that the text comes in as a stream. GNE adds the additional concept of moving the cursor location, which could map to the SDL world, but you still need to support a concept like "addChar" or "addText" to incrementally add more text.

If you've implemented a sort of "graphical console" similar to what games like Valve Source engine might do, then you might already have some API capable of accepting the streaming input. In that case, the ConsoleStreambuf or a layer above that you might just want to switch in your own streambuf.
Gillius
Gillius's Programming http://www.gillius.org/