Tuirmite is an NCurses wrapper written in Java, it provides direct access to many NCurses methods, and also provides an API for directly creating GUIs using Windows Buttons and Text fields
Download The latest version and add it as a Library to your Project
Alternatively Clone the Repository
git clone https://github.com/CommandJoo/Tuirmite
Building the library:
- compiling and linking the library
cd ./src/native
make compile
make lib
- Generating the header and then compiling and linking the library
cd ./src/native
make
Running the Jar
java -jar "build/libs/Tuirmite.jar"
#or
./run
...
public static void main(String[] args) {
int fps = 30;//too high fps will cause flickering
int width = 40;//minimum width in characters
int width = 10;//minimum height in lines
WindowManager windowManager = new WindowManager(fps, width, height, false);
MyWindow win = WindowBuilder<MyWindow>()
.at(0,0).bounds(100, 20)
.color(CursesConstants.DARK_CYAN)
.build(MyWindow::new);
Window window = windowManager.addWindow(0, win);//add a window to the screen and make it be the actively rendered one
windowManager.render();//starts the drawing
windowManager.handleKey();//starts listening for inputs
}
public class MyWindow {
public MyWindow() {}
public void init() {
//initialize your components like Textfields
}
public void draw() {
//Draw things like Text which aren't a component
}
public boolean handleKey(char ch) {
for(Component comp : getComponents()) {
comp.handleKey(ch);
}
return false;
}
public boolean handleClick(Mouse mouse) {
return false;
}
}
A working example of all the basic components and formatting can be found in ExampleProject
A Simple Snake-Game can also be found here: Snake
Johannes Hans (@CommandJoo)
Give a ⭐️ if this project helped you!