Skip to content

pot/boba

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Boba

Maven Central Version

Boba enables the creation of rich terminal user interfaces including games using a functional, message-passing architecture using pure java.

Requirements

  • Java 22+
  • Terminal with ANSI support

Examples

Simple Counter

A basic counter application demonstrating core concepts:

public class Counter extends Program<Model> {
    @Override
    public UpdateResult<Model> update(Model model, Msg msg) {
        switch (msg) {
            case Msg.KeyClickMsg(char key) -> {
                if (key == 'w') model.count++;
                else if (key == 's') model.count--;
                else if (key == 'q') System.exit(0);
            }
            default -> {}
        }
        return new UpdateResult<>(model, null);
    }

    @Override
    public String view(Model model) {
        return "Count: " + model.count + "\n'w' to increment, 's' to decrement, 'q' to quit";
    }
}

Logging

We use the slf4j logging framework. You will need to include a logging implementation like logback-classic as seen below. There is a default logback.xml provided so the actual program isn't interrupted by unexpected logging. By default, it logs to a file called app.log, but it is highly recommended to either disable logging completely or log to your own file.

        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
        </dependency>

Roadmap

  • Non char inputs (arrow keys, control, combinations, ect..)
  • Mouse scrolling support
  • Layout API
  • Look at MacTerminal#makeCooked (figure out why its not working)

Versioning

We follow the Calendar Versioning schema (YYYY.M.D[.MODIFIER])

About

A java library for building terminal user interfaces

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Java 97.8%
  • Just 2.2%