mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-10-01 17:29:07 +08:00
Add opt-in piped input support for POSIX systems
Enables applications to read piped data while maintaining interactive keyboard input by redirecting stdin to /dev/tty when explicitly enabled.
This commit is contained in:

committed by
ArthurSonzogni

parent
40e1fac3d4
commit
143b24c6a5
16
README.md
16
README.md
@@ -378,6 +378,22 @@ Several games using the FTXUI have been made during the Game Jam:
|
||||
- [smoothlife](https://github.com/cpp-best-practices/game_jam/blob/main/Jam1_April_2022/smoothlife.md)
|
||||
- [Consu](https://github.com/cpp-best-practices/game_jam/blob/main/Jam1_April_2022/consu.md)
|
||||
|
||||
## Advanced Usage
|
||||
|
||||
### Piped Input Support
|
||||
|
||||
If your application reads from stdin (piped data) and also needs interactive keyboard input:
|
||||
|
||||
```cpp
|
||||
auto screen = ScreenInteractive::Fullscreen();
|
||||
screen.HandlePipedInput(true); // Enable before Loop()
|
||||
screen.Loop(component);
|
||||
```
|
||||
|
||||
This allows commands like `cat data.txt | your_app` to work with full keyboard interaction.
|
||||
|
||||
**Note:** This feature is only available on POSIX systems (Linux/macOS). On Windows, the method call is a no-op.
|
||||
|
||||
## Build using CMake
|
||||
|
||||
It is **highly** recommended to use CMake FetchContent to depend on FTXUI so you may specify which commit you would like to depend on.
|
||||
|
Reference in New Issue
Block a user