AppCUI-rs

AppCUI-rs adalah pustaka Rust yang cepat dan lintas platform untuk membangun antarmuka pengguna berbasis teks modern (TUI) dengan widget kaya, tema, dan dukungan Unicode penuh—sebuah alternatif untuk ncurses dan framework UI terminal lainnya.
✨ Fitur
- [x] banyak kontrol siap pakai (tombol, label, kotak teks, check box, radio button, list view, tree view, combo box, pemilih tanggal/waktu, pemilih warna, tab, accordion, dll.). Daftar lengkap kontrol dapat ditemukan di sini
- [x] sistem tata letak yang kuat yang memungkinkan Anda memposisikan kontrol menggunakan koordinat absolut, koordinat relatif, docking, alignment, anchor, atau pivot positioning (lihat lebih lanjut di sini)
- [x] menu dan toolbar
- [x] dukungan multi-platform (Windows via API dan virtual terminal, Linux via ncurses, macOS via termios)
- [x] dukungan multi-threading untuk menjalankan tugas di latar belakang
- [x] timer
- [x] dukungan mouse
- [x] dukungan clipboard
- [x] tema warna
- [x] dukungan karakter Unicode
- [x] dialog yang sudah tersedia (message box, input box, color picker, save & open dialog, folder navigator, dll.)
- [x] dukungan true-color (24 bit per piksel) untuk terminal yang mendukungnya.
📸 Tangkapan Layar

👉 Lihat Galeri untuk demo penuh dari semua kontrol!
🖥️ Backend
AppCUI mendukung berbagai backend tergantung pada sistem operasi:
- Windows Console - berdasarkan Win32 low-level API, dirancang untuk konsol Windows klasik
- Windows VT - berdasarkan ANSI sequences, dirancang untuk virtual terminal Windows modern
- NCurses - berdasarkan NCurses API untuk lingkungan Linux
- Termios - berdasarkan ANSI sequences dan low-level API untuk macOS
- Web Terminal - dirancang untuk implementasi web (berbasis WebGL)
- CrossTerm - berdasarkan crate crossterm
, diaktifkan melalui feature flag
🚀 Mulai Cepat
Tambahkan berikut ini ke Cargo.toml Anda:
toml
[dependencies]
appcui = "*"
Kemudian buat proyek Rust baru dan tambahkan kode berikut:
rust
use appcui::prelude::*;fn main() -> Result<(), appcui::system::Error> { let mut app = App::new().build()?; let mut win = Window::new( "Test", LayoutBuilder::new().alignment(Alignment::Center).width(30).height(9).build(), window::Flags::Sizeable, ); win.add(Label::new( "Hello World !", LayoutBuilder::new().alignment(Alignment::Center).width(13).height(1).build(), )); app.add_window(win); app.run(); Ok(()) }
Atau versi yang lebih ringkas menggunakan proc-macros:
rs
use appcui::prelude::*;fn main() -> Result<(), appcui::system::Error> { let mut app = App::new().build()?; let mut win = window!("Test,a:c,w:30,h:9"); win.add(label!("'Hello World !',a:c,w:13,h:1")); app.add_window(win); app.run(); Ok(()) }
rust use appcui::prelude::*;Kemudian jalankan proyek dengancargo run. Anda akan melihat sebuah jendela dengan judulTestdan teksHello World !di tengah.🧪 Contoh
AppCUI-rs dilengkapi dengan beberapa contoh untuk membantu Anda memulai. Anda dapat menemukannya di folder examples, termasuk:
- Permainan seperti Tic Tac Toe, Snake, Flappy Bird, Minesweeper, Ram it, PacMan, Chess, Connect Four, 2048, atau Tetris
- Utilitas seperti Calculator, CSV Viewer, Temperature Converter, atau Timer
- Animasi seperti Matrix, Fractals, atau Spiral
- Kontrol/Widget seperti Button, CheckBox, ComboBox, DatePicker, ListView, TreeView dan masih banyak lagi.
- Dialog seperti Notification atau Input
🛠️ Contoh yang lebih kompleks
Sebuah contoh yang membuat sebuah jendela dengan tombol yang, ketika ditekan, akan meningkatkan penghitung.
// Create a window that handles button events and has a counter #[Window(events = ButtonEvents)] struct CounterWindow { counter: i32 }
impl CounterWindow { fn new() -> Self { let mut w = Self { // set up the window title and position base: window!("'Counter window',a:c,w:30,h:5"), // initial counter is 1 counter: 1 }; // add a single button with the caption "1" (like the counter) w.add(button!("'1',d:b,w:20")); w } } impl ButtonEvents for CounterWindow { // When the button is pressed, this function will be called // with the handle of the button that was pressed // Since we only have one button, we don't need to store its handle // in the struct, as we will receive the handle via the on_pressed method fn on_pressed(&mut self, handle: Handle
fn main() -> Result<(), appcui::system::Error> { // create a new application let mut a = App::new().build()?; // add a new window (of type CounterWindow) to the application a.add_window(CounterWindow::new()); // Run AppCUI framework (this will start the window loop and message passing) a.run(); Ok(()) } ``
🛣️ Peta Jalan
- [x] Set widget dasar dan dukungan untuk Windows, Linux, dan macOS
- [x] Dukungan WebGL
- [ ] Dukungan OpenGL / SDL / Vulkan
- [ ] Dukungan TextArea untuk penyorotan kode
🤝 Kontribusi
Kontribusi, isu, dan permintaan fitur sangat diterima! Lihat CONTRIBUTING.md untuk memulai.
Bergabunglah dalam diskusi di GitHub Discussions.
--- Tranlated By Open Ai Tx | Last indexed: 2026-06-13 ---