Hardware Agnostic Graphics Library

tuupola
Posts: 7
Joined: Fri Apr 20, 2018 3:49 am

Hardware Agnostic Graphics Library

Postby tuupola » Tue Jun 09, 2020 2:18 pm

Image

HAGL is a lightweight hardware agnostic graphics library. It does not contain any hardware specific code. You can use it with any microcontroller including ESP32 and esp-idf. I have been working on and off with it for a while, mostly to scratch my own itch. It can still be considered work in progress. However API should be 90% stable.

Being hardware agnostic means user has to provide a HAL. Minimal HAL can provide only a putpixel function. There is a HAL for ESP32 which supports most hobbyist displays. There is also an SDL2 HAL for normal computers. You can use the latter to develop graphics code on your laptop.

For example when I was doing the Old school demo effects I first coded them on my laptop. When I was happy with the effects I used the same code for ESP32. I also did some other proof of concepts with the library such as ESP video player.

I would appreciate some feedback about the API and the library in general. I try to keep things fairly low level.

Mika Tuupola
https://appelsiini.net/

Hackswell
Posts: 14
Joined: Wed Jun 03, 2020 8:13 pm

Re: Hardware Agnostic Graphics Library

Postby Hackswell » Tue Jun 09, 2020 3:49 pm

This is awesome! Great job!

Future improvement suggestions:
* font character / pixmap collision detection. Throw an exception or errval if any non-0 portion of character/pixmap collides with something in the buffer. This would allow for GAMES! :D
* character rotation. Fast rotation: 90* increments. Slow rotation: any other angle increments.

Custom "player/missile" fonts would be possible for fast mini-games! (Yeah, I grew up with an Atari 8-bit system)

tuupola
Posts: 7
Joined: Fri Apr 20, 2018 3:49 am

Re: Hardware Agnostic Graphics Library

Postby tuupola » Tue Jun 09, 2020 6:52 pm

Yeah. Also need to support transparent background color with fonts. I have been pondering if there should be separate functions for fonts and sprites. Sprites would act similar to way you described.
Custom "player/missile" fonts would be possible for fast mini-games! (Yeah, I grew up with an Atari 8-bit system)

Check the UNSCII font. You might like it :)

Mika Tuupola
https://appelsiini.net/

Hackswell
Posts: 14
Joined: Wed Jun 03, 2020 8:13 pm

Re: Hardware Agnostic Graphics Library

Postby Hackswell » Tue Jun 09, 2020 7:59 pm

Nice fonts! "unscii-8-fantasy" reminds me of the font used in the "Alternate Reality" 8-bit game! :D

Agreed. Fonts and sprites should be different, but font characters should be able to be used as sprites, too! I see space invaders in those fonts! :D

Who is online

Users browsing this forum: No registered users and 105 guests