Difference between revisions of "Libjcsi"
Jump to navigation
Jump to search
(Some formatting, clarification and a link to library page, cause you know that might be useful.) |
(added category.) |
||
Line 56: | Line 56: | ||
== Extenrnal Links == | == Extenrnal Links == | ||
[http://slashie.net/libjcsi/ libjcs - Homepage] | [http://slashie.net/libjcsi/ libjcs - Homepage] | ||
[[Category:Library]] |
Latest revision as of 03:11, 2 February 2011
libjcsi, or the Java Control System Interface libarary, is a Java library made by Slash with some help from Deej. It allows Java developers to output to a console, either Curses or emulated using Swing.
Example
package net.slashie.libjcsi.examples;
import net.slashie.libjcsi.CSIColor;
import net.slashie.libjcsi.CharKey;
import net.slashie.libjcsi.ConsoleSystemInterface;
import net.slashie.libjcsi.jcurses.JCursesConsoleInterface;
import net.slashie.libjcsi.wswing.WSwingConsoleInterface;
public class SimpleRoguelike {
//private ConsoleSystemInterface csi = new JCursesConsoleInterface();
private ConsoleSystemInterface csi = new WSwingConsoleInterface("Simple Roguelike - libjcsi Testing Grounds");
private int a, b;
public static void main(String[] p) {
new SimpleRoguelike().run();
}
public void run () {
csi.cls();
csi.print(5, 5, "Welcome to TEH game!", CSIColor.BABY_BLUE);
csi.saveBuffer();
boolean exit = false;
while (!exit){
csi.restore();
csi.print(a, b, "@", CSIColor.ATOMIC_TANGERINE);
csi.refresh();
int key = csi.inkey().code;
switch (key){
case CharKey.UARROW:
b--;
break;
case CharKey.DARROW:
b++;
break;
case CharKey.LARROW:
a--;
break;
case CharKey.RARROW:
a++;
break;
case CharKey.Q: case CharKey.q:
exit = true;
}
}
csi.print(1, 20, "Press space to continue");
csi.refresh();
csi.waitKey(CharKey.SPACE);
System.exit(0);
}
}