https://github.com/rrrinav/term-graphics
A simple header only library for terminal graphics
https://github.com/rrrinav/term-graphics
cli graphics-engine terminal-game terminal-graphics terminal-graphics-engine terminal-graphics-rendering tui
Last synced: about 1 month ago
JSON representation
A simple header only library for terminal graphics
- Host: GitHub
- URL: https://github.com/rrrinav/term-graphics
- Owner: Rrrinav
- License: mit
- Created: 2024-07-05T13:32:45.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-01-27T16:59:47.000Z (4 months ago)
- Last Synced: 2025-02-04T13:03:24.450Z (4 months ago)
- Topics: cli, graphics-engine, terminal-game, terminal-graphics, terminal-graphics-engine, terminal-graphics-rendering, tui
- Language: C++
- Homepage:
- Size: 26.9 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# ASCII Graphics Engine
A powerful and flexible ASCII graphics rendering engine with advanced features for creating stunning console-based visuals and interactive applications.
## Features
- **High-performance rendering**: Optimized for speed and efficiency
- **Rich shape drawing**: Lines, circles, rectangles, triangles, polygons, and more
- **Anti-aliasing**: Smooth line and shape rendering for improved visual quality
- **Color support**: Full RGB color capabilities with transparency
- **Text rendering**: Custom font support with shadowing effects
- **Glyphs and glyphs animation**: Load and render custom glyphs and animations
- **Sprite system**: Load and render sprite animations
- **Input handling**: Keyboard and mouse input support
- **Window management**: Easy-to-use window controls## Quick Start
```cpp
#define RENDERER_IMPLEMENTATION
#include "renderer.hpp"int main() {
auto buffer = Renderer::create_buffer(100, 80);
Renderer renderer(buffer);renderer.Init();
while (true) {
renderer.empty();
renderer.reset_screen();// Draw your graphics here
renderer.draw_circle({50, 40}, 20, 'o', GREEN);
renderer.draw_text({10, 10}, "Hello, ASCII World!", BRIGHT_WHITE);renderer.draw();
renderer.sleep(1000 / 60); // 60 FPSif (Window::is_pressed(Keys::KEY_ESC)) break;
}return 0;
}
```## Advanced Usage
### Glyph animation
```cpp
sprite.load_from_file("animation.txt");
renderer.draw_sprite({10, 10}, animated_sprite.get_frame(frame));
Animated_sprite animated_sprite;
animated_sprite.load_from_file("animation.txt");
renderer.draw_sprite(start_pos, animated_sprite.get_frame(frame));
```### Shapes and anti-aliasing
```cpp
renderer.draw_anti_aliased_line({10, 10}, {90, 70}, '-', BLUE);
renderer.draw_fill_antialias_triangleInstallation
```### Sprites animations
```cpp
Animated_sprite animated_sprite;
animated_sprite.load_from_file("animation.txt");
renderer.draw_sprite({10, 10}, animated_sprite.get_frame(frame));
```### User input and interaction
```cpp
if (Window::is_pressed(Keys::KEY_SPACE)) {
// Perform action on spacebar press
}auto mouse_pos = Window::get_mouse_pos();
renderer.draw_point(mouse_pos, 'x', YELLOW);
```## Installation
Clone the repository
This is a header only library, so you can simply include the header files in your project.
Compile with your preferred C++ compiler (C++11 or later required)## Contributing
All contributions are welcome and appreciated. For major changes, please open an issue first to discuss what you would like to change.
## License
[MIT License](https://choosealicense.com/licenses/mit/)
## Acknowledgements
[Rinav](https://github.com/Rrrinav) (original author)
[Stb libraries](https://github.com/nothings/stb) (used stb_image for image loading)
### STILL IN DEVELOPMENT
- [ ] Testing and proper development on windows still not done
- [ ] Only update the points that are changed
- [ ] Hot Reloading