86 lines
2.6 KiB
Markdown
86 lines
2.6 KiB
Markdown
# desktoplib
|
|
|
|
[](LICENSE)
|
|
|
|
A lightweight, cross-platform C++20 library for building desktop applications that need uniform access to terminal UIs, OS processes, and serial (USB) interfaces.
|
|
|
|
Designed as a standalone static library with an intentionally limited scope. No heavy dependencies — just standard C++20 and platform-specific OS calls.
|
|
|
|
## Features
|
|
|
|
- **Terminal UI** — ANSI escape-sequenced output with RGB/HSL colors, cursor positioning, alternative buffers, and input handling
|
|
- **UI Widgets** — Built-in `Box`, `InnerScroll`, `MenuMap`, and `Content` for composing terminal layouts
|
|
- **Process Management** — Planned uniform process spawn/stream abstraction (stub in place)
|
|
- **Serial Communication** — Planned cross-platform USB/serial port interface
|
|
- **OS Abstraction Layer** — Shared terminal/input/OS calls behind `common.hpp`, with POSIX and Windows implementations
|
|
|
|
## Requirements
|
|
|
|
- C++20 compatible compiler (`g++` recommended)
|
|
- Make (GNU Make)
|
|
- POSIX or Windows environment
|
|
|
|
## Building
|
|
|
|
```bash
|
|
# Build the static library
|
|
make -f makelib.mak
|
|
|
|
# Build and run the test executable
|
|
make
|
|
./out/out.exe
|
|
```
|
|
|
|
Produces `out/libdesktoplib.a` for linking into your own projects.
|
|
|
|
## Quick Start
|
|
|
|
```cpp
|
|
#include <desktoplib/terminal/Terminal.hpp>
|
|
|
|
int main() {
|
|
using namespace ckitty::terminal;
|
|
|
|
Terminal term;
|
|
term.altbuff(true)
|
|
.cursor(false)
|
|
.cls()
|
|
.fill(color::B_BLACK);
|
|
|
|
term << pos{ 1, 1 } << backg::BLUE << color::WHITE << style::BOLD;
|
|
term.center(40, " Hello, desktoplib ");
|
|
term << style::RESET;
|
|
|
|
term.flush();
|
|
term.wait(); // Block until a key is pressed
|
|
|
|
term.altbuff(false).cursor(true).cls();
|
|
return 0;
|
|
}
|
|
```
|
|
|
|
## Architecture
|
|
|
|
```
|
|
src/desktoplib/
|
|
├── os/ # Platform abstraction (POSIX / Windows)
|
|
├── terminal/ # Terminal engine, ANSI codes, input
|
|
│ └── ui/ # Widgets: Box, InnerScroll, MenuMap, Content
|
|
└── proc/ # Process management (stub)
|
|
```
|
|
|
|
All modules live in the `ckitty` namespace. The terminal layer uses ANSI escape sequences wrapped in typed structs (`color`, `backg`, `style`, `pos`, `move`) and supports method chaining on `Terminal`.
|
|
|
|
## Roadmap
|
|
|
|
| Module | Status | Target |
|
|
|--------|--------|--------|
|
|
| Terminal UI | Stable | — |
|
|
| OS Abstraction | Stable (POSIX + Windows) | — |
|
|
| Process | Stub | Spawn, stdin/stdout/stderr streams, exit code |
|
|
| Serial / USB | Not started | Cross-platform port enumeration + read/write |
|
|
|
|
## License
|
|
|
|
MIT — see [LICENSE](LICENSE).
|