fdivitto/fabgl

2.0.0

Latest
uploaded 7 hours ago
FabGL2 - ESP32 Display Controller (VGA, PAL/NTSC Composite), PS/2 keyboard and mouse, Graphics Library, Sound Engine, GUI, Game/Emulation Engine and ANSI/VT Terminal

Readme

# FabGL2

**Graphics, audio, GUI and retro-computing library for the ESP32, as a native ESP-IDF component**

FabGL2 turns an ESP32 into a complete retro-computing and embedded-UI platform: VGA and PAL/NTSC composite video
output, PS/2 keyboard and mouse input, a multi-channel sound engine with a polyphonic synthesizer and a drum machine,
a windowed graphical user interface, a sprite and game engine, an ANSI/VT terminal and CPU emulators
(8080, Z80, 6502, 8086).

- Documentation and user guide: https://www.fabglib.org
- Source code, examples and screenshots: https://github.com/fdivitto/FabGL2
- Tutorial (PDF): https://github.com/fdivitto/FabGL2/blob/main/docs/tutorial/FabGL2_Tutorial.pdf

Requires **ESP-IDF v6.1** or newer and the classic **ESP32** target. Only components shipped with ESP-IDF are used.


## Installation

```
idf.py add-dependency "fdivitto/fabgl^2.0.0"
```

The command adds the dependency to `main/idf_component.yml`; the next build downloads the component into
`managed_components/`. Then require it in `main/CMakeLists.txt`:

```cmake
idf_component_register(SRCS "main.cpp" REQUIRES fabgl)
```

Or start from one of the examples:

```
idf.py create-project-from-example "fdivitto/fabgl:SpaceInvaders"
```


## Hello world

```cpp
// main/main.cpp
#include "fabgl.h"

fabgl::VGA16Controller DisplayController;   // 16 colors, about 153 KB of frame buffer at 640x480

extern "C" void app_main()
{
  DisplayController.begin();
  DisplayController.setResolution(VGA_640x480_60Hz);

  fabgl::Canvas cv(&DisplayController);
  cv.clear();
  cv.drawText(10, 10, "Hello from FabGL2!");
}
```

Recommended `sdkconfig.defaults` (every example includes one):

```
CONFIG_IDF_TARGET="esp32"
CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y
CONFIG_COMPILER_OPTIMIZATION_PERF=y
CONFIG_FREERTOS_HZ=1000
CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192
CONFIG_ESP_MAIN_TASK_AFFINITY_CPU1=y
CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1=n
# required by the PS/2 controller (ULP FSM program)
CONFIG_ULP_COPROC_ENABLED=y
CONFIG_ULP_COPROC_TYPE_FSM=y
CONFIG_ULP_COPROC_RESERVE_MEM=4096
```

The PS/2 controller runs a program on the ULP FSM coprocessor, so `CONFIG_ULP_COPROC_RESERVE_MEM` must be at least
2112 bytes. The build stops with an explicit error message if it is smaller.


## License

Copyright (c) 2019-2026 Fabrizio Di Vittorio. All rights reserved.

FabGL2 is released under the GNU General Public License v3 (GPL v3), see `LICENSE`. For a commercial license,
please contact fdivitto2013@gmail.com.

Links

Target

To add this component to your project, run:

idf.py add-dependency "fdivitto/fabgl^2.0.0"

download archive

Stats

  • Archive size
    Archive size ~ 644.96 KB
  • Downloaded in total
    Downloaded in total 0 times
  • Downloaded this version
    This version: 0 times

Badge

fdivitto/fabgl version: 2.0.0
|