https://github.com/commandjoo/tuirmite
NCurses Implementation written in Java, with a Wrapper for making GUIs
https://github.com/commandjoo/tuirmite
cli curses curses-library curses-ui java jni jni-java jni-wrapper linux-app native ncurses ncurses-library ncurses-tui terminal-app terminal-based tui wrapper
Last synced: 11 months ago
JSON representation
NCurses Implementation written in Java, with a Wrapper for making GUIs
- Host: GitHub
- URL: https://github.com/commandjoo/tuirmite
- Owner: CommandJoo
- Created: 2024-11-19T18:31:41.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-16T13:46:54.000Z (11 months ago)
- Last Synced: 2025-02-23T15:15:36.624Z (11 months ago)
- Topics: cli, curses, curses-library, curses-ui, java, jni, jni-java, jni-wrapper, linux-app, native, ncurses, ncurses-library, ncurses-tui, terminal-app, terminal-based, tui, wrapper
- Language: Java
- Homepage:
- Size: 682 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Welcome to Tuirmite 👋
> 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
***
## Quickstart
Download
[The latest version](https://github.com/CommandJoo/Tuirmite/releases/latest)
and add it as a Library to your Project
Alternatively
Clone the Repository
```shell
git clone https://github.com/CommandJoo/Tuirmite
```
***
## Usage
### Running the Application
Building the library:
- compiling and linking the library
```sh
cd ./src/native
make compile
make lib
```
- Generating the header and then compiling and linking the library
```sh
cd ./src/native
make
```
Running the Jar
```sh
java -jar "build/libs/Tuirmite.jar"
#or
./run
```
### Creating a GUI in Tuirmite
```java
...
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()
.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
}
```
```java
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](src/main/java/de/johannes/example/Example.java)
A Simple Snake-Game can also be found here: [Snake](src/main/java/de/johannes/snake/SnakeWindow.java)
***
## Author
**Johannes Hans** ([@CommandJoo](https://github.com/CommandJoo))
## Show your support
Give a ⭐️ if this project helped you!