OK, this is going to sound like a crazy idea - but I'm interested in emulating a 1980s style roguelike game text interface in pure Java, i.e. using Swing or similar.
Here's roughly what it needs to do:
Anyone know of a good existing solution that would enable this? Or am I stuck with hacking one together from scratch?
p.s. the reason I want pure Java is so that it can run in a sandboxed applet. So JNI solutions like jcurses are sadly ruled out.....
Not crazy at all, this is the approach I implemented in Legerdemain:http://roguelikefiction.com
I used a two dimensional array of characters (char[][]) with a corresponding array of java.awt.Color[][] objects to track the colors. You can shove these arrays into a class that inherits from JPanel (which in turn is part of a JFrame) and do all of the drawing in the panel's paintComponent() callback.
Nothing wrong with the Curses/JNI approach either, although you get all sorts of great Unicode glyphs if you go the Swing route. Legerdemain uses five or six hundred of them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With