Reputation: 1378
I am writing an OpenGL game and am about to start writing the code for a Quake-like console (a la Quake 2/Counter-Strike, where you press tilde (~) and a console interface drops down). I have already used the Haskeline library for a plain text-based console application and would like to incorporate it into my OpenGL app, but am not sure how to go about this.
For example, how would I use the getInputLine
function when the
Haskeline REPL loop is in another thread? I am guessing that I'd have to use
forkIO
and then use file descriptors to simulate UNIX-style piping to
achieve this. I'd have to write a bridge function that takes keyboard
input with GLFW, then pass it on to Haskeline, have Haskeline do its
magic to what it thinks is the STDOUT, then capture this, and then have
it displayed on the screen via OpenGL calls. Am I on the right track, or is this approach not the most sensible way to do it?
Upvotes: 4
Views: 118