zacharycarter / zengine

2D | 3D Game development library
156 stars 13 forks source link

2D Drawing API #24

Open define-private-public opened 7 years ago

define-private-public commented 7 years ago

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.

zacharycarter commented 7 years ago

How about NanoVG?

https://github.com/memononen/nanovg

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

define-private-public commented 7 years ago

Got sample code?

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

zacharycarter commented 7 years ago

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.