zengine icon indicating copy to clipboard operation
zengine copied to clipboard

2D Drawing API

Open define-private-public opened this issue 8 years ago • 3 comments

Taking about some future ideas here (also maybe something to do before v1.0). Any plans on 2D drawing other than rendering sprites & textures?

Having functions to do 2D drawing isn't really necessary for a game dev library, but it can be really handy. I see that there is some stuff in primitives.nim, but not much.

  1. Would we want to design our own API?
  2. Model it after something else? (e.g. like how NanoVG is modeled after HTML5's Canvas API)
  3. Would we want to implement it ourselves?
  4. Or is there something off the shelf that we can integrate (e.g. cairo)? a. Maybe provide an abstraction layer over a 3rd party library?

I very much would like to do option no. 4, since it would be a lot less work for us (among other things). But options 1-3 look a little more fun, and possibly better since we would have more control, understanding, and portability if we had something in pure Nim rather than binding an existing C library.

What are your thoughts? This isn't an immediate thing to work on, but a nice little cherry on the top.

define-private-public avatar Aug 19 '17 17:08 define-private-public

How about NanoVG?

https://github.com/memononen/nanovg

I've implemented this before. It's nice...

zacharycarter avatar Aug 20 '17 11:08 zacharycarter

Got sample code?

(EDIT, I meant to write "NanoVG," instead of "OpenVG," in the OP)

define-private-public avatar Aug 20 '17 14:08 define-private-public

Not really - I never did any higher level wrapper around NanoVG but I have bindings here - https://github.com/zacharycarter/nanovg.nim

Using it pretty much means using the NanoVG API at the moment.

We could introduce a thin wrapper around NanoVG if you'd be game for that.

zacharycarter avatar Aug 20 '17 15:08 zacharycarter