elbows
10/30/2003 2:28:00 AM
I've actually been working on a project like this for a while now
(specifically for drawing maps, for RPGs and such). The big thing you
will need is a canvas which does collision detection -- so you can
tell when a line on the canvas or whatever is moused over, allowing
the user to click on it and move it, etc. You'll also want a fairly
rich set of canvas items.
Tk: This is what I'm using right now. It has good ruby bindings which
your users won't have to build themselves. It does collision detection
and the canvas API is pretty powerful overall.
On the downside, image support is limited, and text items can't be
rotated (which I would like to do). The look and feel is rather
archaic, and the built-in widgets are sub-par. Non-canvas things are
sometimes a pain.
I'm considering moving to another toolkit, but first I have to find
one with a sufficiently powerful canvas, or implement the needed
canvas features myself, which I lack the time an expertise for at the
moment.
Qt: Has collision detection.
Lines are only single-segment, with width 1, and no curves. Polygons
are solids with no outline. You can draw more complex stuff, but not
as full-fledged canvas items with collision detection.
It is very difficult to implement your own canvas items, as the APIs
relating to this are not very well documented. I tried and ended up
with many segfaults.
Also, the only ruby bindings are for Qt 2.x, and I don't know if they
are maintained anymore (although they work well).
FOX: No collision detection
WxWindows: No collision detection, IIRC
Gnome: Well, I am biased against gnome/GTK since I'm a KDE fan and I
think gnome is ugly (both the look and the pseudo-OO C API). OTOH, it
has ruby bindings which I imagine improve the API, and a decent set of
canvas items. The documentation doesn't seem to be very good -- for
example, I can't tell whether it does collision detection. (Does
anyone know?)
Let us know what you decide on, and feel free to drop me an email if
you want to discuss implementation details or take a peek at my code
(which should be going up on sourceforge anyway, as soon as I can come
up with a name for the project).
Nathan
jpmprb@sapo.pt (Joao Barros) wrote in message news:<3c5c32de.0310291101.10d9f24b@posting.google.com>...
> I would like to build a simple graphical editor in Ruby. The editor
> should allow a subset of the usual graphical editing operations: draw
> boxes, circles, connectors, text labels, copy, paste, and some more.
> What is the best way to do it in Ruby? Is there some graphic library?
> Should I use another language (library) together with Ruby? Which one.
> Thanks in advance for any help.
>
> Joao