SimpleGFX is a straightforward tool designed to help you create graphics using SDL 1.2 or SDL 2. It supports development for the Anbernic RG35xx running Onion OS 1.4.9 and can also be used on macOS for experimenting, building, and testing small graphical applications.
- Compatibility with SDL 1.2 and SDL 2.
- Supports macOS and RG35xx platforms.
- Basic text rendering functionality.
- 16-bit tone generation for simple sound effects.
- Minimal dependencies for portability and ease of use.
- Can be used in embedded projects.
- For native development:
- GNU Make (check with
make --version)
- GNU Make (check with
- For RG35xx cross-compilation:
- Docker installed and set up
- To use SDL backend you have the options:
- Use nix:
nix-shell(all dependencies will be set up automatically)
- Install SDL2 and SDL 1.2 compatibility:
- SDL2 (
brew install sdl2) - SDL 1.2 compatibility (
brew install sdl12-compat) - ADB (
brew install android-platform-tools)
- Onion OS 1.4.9
- ADB enabled on the device (Consoles -> APPS -> Toggle_ADB)
- Any platform that supports C/C++ and has a display driver.
- Define
WINDOW_WIDTHandWINDOW_HEIGHTconstants. - Use
uint16_t* gfx_get_frame_buffer(void)to get the frame buffer or implement your own backend.
- Call
gfx_app(0 or more)to run the application setup. - Call
gfx_app(-1)to run the application cleanup. - Define a function
X, that should:- Check for input and call
int gfx_on_key(char key, int down) - Compute FPS and call
gfx_draw(float fps)andgfx_clear()- Note: if
gfx_drawreturns 0, the draw operation should be skipped.
- Note: if
- On remaining time until (1000ms / GFX_FPS) after draw you can:
- Busy-wait calling
gfx_process_datapassing the remaining time in milliseconds. - Perform a optmized sleep using the sleep function provided by the platform.
- Busy-wait calling
- Check for input and call
Run the following commands to build and test the application:
# Using native (without nix)
$ make macos-gfx-run
# Using SDL2
$ make sdl-gfx-run
# Using SDL1.2
$ make sdl1.2-gfx-run
# Anbernic RG35xx
$ make rg35xx-gfx-run
$ make <plaform>-<example>-run
To build and install the application on RG35xx:
make rg35xx-gfx-adb-installEnsure that ADB is properly configured and the device is connected before running this command.
- Explore the example code provided in
examples/gfx.c. - The example demonstrates rendering random rectangles and drawing text on the screen.
This project is distributed under the CC0 license, allowing unrestricted use, modification, and distribution.
If you successfully compile this on Windows or Linux (Linux support will be updated after the end-of-year holidays) and can adapt the Makefile while keeping it organized and consistent, please consider submitting a pull request. Your contributions would be greatly appreciated and integrated into the project.
- This tool is designed for small, simple projects.
- Includes Makefile targets to simplify building and installing on RG35xx.
- Features are intentionally basic to ensure portability and simplicity.
Special thanks to https://github.com/nfriedly/miyoo-toolchain for providing a Docker image with a precompiled toolchain, streamlining RG35xx development.




