8000 GitHub - JackDerksen/minui: My minimal terminal-based game and UI library ๐ŸŒ’
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

My minimal terminal-based game and UI library ๐ŸŒ’

Notifications You must be signed in to change notification settings

JackDerksen/minui

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

66 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

MinUI ๐ŸŒ’

MinUI is a minimal terminal-based game and UI engine written in Rust. This project is a work in progress, currently in its very early stages!

Motivation

MinUI was born from a desire to create terminal-based games in Rust, specifically a terminal Tetris clone in my case. While several terminal UI libraries exist for Rust, none quite offered the perfect balance of simplicity, performance, and game-focused features that I was looking for. MinUI aims to fill this gap by providing a fast, easy-to-use library that makes terminal game and UI development a joy.

Planned Features

  • ๐Ÿš€ Fast: Built for performance with gaming in mind
  • ๐ŸŽฎ Game-focused, TUI-ready: API designed around common game development needs
  • ๐ŸŽฏ Minimalist: Clean, intuitive API with zero unnecessary complexity
  • โŒจ๏ธ Input Handling: Robust keyboard event system
  • ๐Ÿงฐ Safe: Proper error handling and automatic resource cleanup

Project Status

MinUI is in early development, and I'm actively working on adding more features:

  • Color support
  • Simple and customizable widget system
    • Container widget
    • Label widget
    • Text block widget
    • Panel widget
    • Table widget
    • Input widget
    • Predefined widget layouts
  • Buffered drawing for smooth and efficient updates
  • Built-in game loop utilities
  • Simplified sprite and map management utilities
  • Easy character movement support
  • Cell management with collision detection options
  • Support for various input methods (custom key binds, mouse support, etc.)

Getting Started

For now, you'll have to clone this repository and build your games/applications locally.

Once MinUI is formally released as a crate, you could add it to your Cargo.toml like so:

[dependencies]
minui = "0.1.0"

Basic Example

use minui::{Window, Event, TerminalWindow};

// This example shows the minimal workflow, how to:
//  - Create a window
//  - Write some text
//  - Enter an input loop
//  - Handle different types of input events
//  - Clean up automatically when done

fn main() -> minui::Result<()> {
    let mut window = TerminalWindow::new()?;
    window.clear()?;

    window.write_str(0, 0, "Press 'q' to quit")?;

    loop {
        match window.get_input()? {
            Event::Character('q') => break,
            Event::Character(c) => {
                window.write_str(1, 0, &format!("You pressed: {}", c))?;
            }
            evt => {
                window.write_str(1, 0, &format!("Event: {:?}", evt))?;
            }
        }
    }

    Ok(())
}

Run the program with the command: cargo run example --basic_usage

Building Terminal Games with MinUI

MinUI is designed to make terminal game development straightforward. Here's what makes it great for games:

  • Minimal Dependencies: Built on crossterm with minimal additional dependencies
  • Game First: Designed primarily for terminal-based game development, with great UI capabilities as well
  • Easy to Learn: Clean, intuitive API that gets out of your way
  • Performance Focused: Built with game performance requirements in mind

Building TUI Apps with MinUI

MinUI also has a focus on simplifying the task of building TUI applications. Here's some of what it has to offer:

  • Simple Widget System: Easy-to-use widgets with all the features you need and nothing you don't
  • Example Programs: Several examples to help you get started with the widgets
  • Customizable: I'm trying to make every widget I add as configurable as possible, while not overwhelming you with options

Games Built with MinUI

Acknowledgments

Built using:

About

My minimal terminal-based game and UI library ๐ŸŒ’

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0