AppCUI-rs

AppCUI-rsは、高速でクロスプラットフォームなRustライブラリであり、リッチなウィジェット、テーマ、完全なUnicodeサポートを備えたモダンなテキストベースのユーザーインターフェース(TUI)を構築できます。ncursesやその他のターミナルUIフレームワークの代替となります。
✨ 特徴
- [x] 複数の標準コントロール(ボタン、ラベル、テキストボックス、チェックボックス、ラジオボタン、リストビュー、ツリービュー、コンボボックス、日付/時刻ピッカー、カラーピッカー、タブ、アコーディオン等)を標準装備。全コントロール一覧はこちら
- [x] 絶対座標、相対座標、ドッキング、整列、アンカー、ピボット指定などでコントロール配置ができる強力なレイアウトシステム(詳細はこちら)
- [x] メニューとツールバー
- [x] マルチプラットフォーム対応(WindowsはAPIと仮想ターミナル、Linuxはncurses、macOSはtermios)
- [x] バックグラウンドタスク用のマルチスレッド対応
- [x] タイマー
- [x] マウスサポート
- [x] クリップボードサポート
- [x] カラーテーマ
- [x] Unicode文字対応
- [x] 定義済みダイアログ(メッセージボックス、入力ボックス、カラーピッカー、保存・開くダイアログ、フォルダナビゲータ等)
- [x] 対応端末でのTrueColor(24bit/pixel)サポート
📸 スクリーンショット

👉 すべてのコントロールの完全なデモはギャラリーをチェック!
🖥️ バックエンド
AppCUIは、OSに応じて様々なバックエンドをサポートしています。
- Windows Console - Win32の低レベルAPIに基づき、従来のWindowsコンソール向けに設計されています
- Windows VT - ANSIシーケンスに基づき、最新のWindows仮想端末向けに設計されています
- NCurses - Linux環境向けにNCurses APIに基づいています
- Termios - ANSIシーケンスとmacOS用の低レベルAPIに基づいています
- Web Terminal - Web実装向けに設計されています(WebGLベース)
- CrossTerm - crossterm
クレートに基づき、フィーチャーフラグで有効化されます
🚀 クイックスタート
以下をCargo.tomlに追加してください:
toml
[dependencies]
appcui = "*"
次に、新しいRustプロジェクトを作成し、以下のコードを追加します:
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(()) }
または、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::*;その後、cargo runでプロジェクトを実行してください。タイトルがTestのウィンドウと、中央にHello World !というテキストが表示されるはずです。🧪 例
AppCUI-rsには、使い始めるための一連のサンプルが付属しています。examplesフォルダーで見つけることができます。内容は以下の通りです:
- ゲーム 例えば Tic Tac Toe、Snake、Flappy Bird、Minesweeper、Ram it、PacMan、Chess、Connect Four、2048、または Tetris
- ユーティリティ 例えば Calculator、CSV Viewer、Temperature Converter、または Timer
- アニメーション 例えば Matrix、Fractals、または Spiral
- コントロール/ウィジェット 例えば Button、CheckBox、ComboBox、DatePicker、ListView、TreeViewなど多数。
- ダイアログ 例えば Notification や Input
🛠️ より複雑な例
ボタン付きのウィンドウを作成し、そのボタンを押すとカウンターが増加する例。
// 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(()) } ``
🛣️ ロードマップ
- [x] 基本的なウィジェットセットとWindows、Linux、macOSのサポート
- [x] WebGLサポート
- [ ] OpenGL / SDL / Vulkanサポート
- [ ] コードハイライト用のTextAreaサポート
🤝 コントリビューション
貢献、問題報告、機能要望は大歓迎です! 始めるにはCONTRIBUTING.mdをご覧ください。
GitHub Discussionsで議論に参加してください。
--- Tranlated By Open Ai Tx | Last indexed: 2026-06-13 ---