GUI or 2d game crate writing some drawing app?

I'm thinking of writing a very simple drawing/animation app for my 5-year-old daughter. The focus will be on a very simple user interface. She's able to draw with krita and has had fun animating with pencil2d, but both have too many controls because they're for real artists, and as a result I have to keep helping her out. Also I'm intrigued by the possibility of creating a cool normal tweening algorithm to turn just a few drawings into an animation.

Anyhow, I'm looking for a gui or game framework that would make it as simple as possible to get pixels on the screen and to draw just a few controls (which I'd happily create my putting pixels into the screen!). And to get input from a finger or Wacom stylus.

It would be a bonus to support wasm, but not a requirement. I do want something cross platform. I do want something that is easy to get going in and relatively stable.

My challenge for looking into crates is that everything has a lot that I don't need. It seems like my needs ought to match well with game f development, but all the game frameworks seem to focus on assets and sprites and other things I don't (think I) need. Gui frameworks focus on lots of tools and widgi that I also don't need. I suspect that several of these will serve my needs beautifully, but can't tell which, this this post. I don't need the best crate, just one that is good enough!

I have no experience with it, but pixels’ design philosophy seems to match your needs.

1 Like

Looks like it doesn't support IO or windows, so not quite what I want. But it does (in its readme) point at minifb which sounds almost exactly like what I was looking for! :slight_smile:

Edit Turned out minifb doesn't support fullscreen mode, which isn't needed, but is very helpful given my 5 year old's wild use of a trackpad.

2 Likes

It might take a little bit more work but using OpenGL or SDL2 might be the way to go, instead of a game engine or GUI library. Both have good support everywhere and have pretty okay documentation.

1 Like

@ahunter I've just started looking at flo_draw, which also looks intriguing. It's part of a set of packages built for an animation program, which makes it extra promising. In particular I see that it separates input from output, which appeals because my quick experiment with minifb suggest that it could do better at getting mouse events frequently.

I'm a little concerned at how much time I might spend learning the ins and outs of flo_between, however, for a fun project I hope to limit my time spent on.

Edit: Looking at the flo_ ecosystem, I can see how to render to an offscreen bitmap but I haven't been able to figure out how to get a bitmap into the screen. :frowning:

Edit again Looks like bitmaps are called textures and can be created from bytes as you would hope.

Another option is softbuffer which is similar to minifb, but softbuffer is easy to use with winit, which may address the mouse event issue.

A very quick iteration option that handles input and rendering would be Macroquad

Main downside is that I'd expect an animation tool to have bezier support, but I suppose it's pretty easy to do the subdivision down to pixels yourself.

Not sure if anyone has already mentioned this -- why not web_sys + {canvas, webgl} ?

1 Like

My intent (in keeping this simple) is be all bitmap, so that wouldn't be an issue..

Do you happen to know if macroquad can draw to a buffer? I'm having trouble seeing how to use its graphics commands to draw into a texture or image. Other than this trouble (which I can work around) it's looking great.

Docs are weirdly sparse, but it looks like you can do this with render_target to create the output texture and the RenderPass that you pass to a new Camera2D which you can then pass to set_camera

Indeed, I've just found that Texture2d leaks memory in a serious and undocumented way. There seems to be a workaround for it, and I'm not jumping ship just yet, but I wouldn't recommend macroquad to anyone at this stage.

I've also seen abundant seg faults, so my poor evaluation of macroquad is coming from multiple directions.

I'm sad to hear that! It seems to be the hot new thing everyone uses. There's the older project piston it essentially replaced, which might be an option still?

I tend to use vulkano myself, which is a good mix of safe and (often painfully!) low level.

If making a web app, canvas, webgl would be the fastest, easiest way to get input and output. Any framework will go through canvas anyway.

If going for native there is still glut (gl utility toolkit). I have not researched rust glut libraries, but the c glut library is not too hard to use. ( calling it from rust may be hard, I don't see it recommended much )

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.