From: “Weston C.” [email protected]
Actually, I want to know how the people who made these graphics
libraries and GUIs made them in the first place. How are these libraries
and toolkits working with graphics? How do they do it?
Ultimately such libraries tend to call window manager and graphics
on the native platform. These operating system calls are totally
Windows, Mac OS X, Linux, etc…
On Windows, one tends to use the CreateWindowEx() function to
create the window, which is documented here:
There are numerous examples on the web for creating windows and
drawing graphics into them.
I need to know how to make my own custom libraries and toolkits, mainly
because I get so frustrated using something that I don’t really
understand. Or, more likely, the library or tk doesn’t have what I need
or implements something in a way I don’t agree with.
If you want to do it yourself, you’ll need to learn at least the
How to write the code for your platform (usually in C or C++) to
create windows and draw graphics. (There will be plenty of examples
on the web for this.)
How to wrap your C or C++ code so that it may be called from ruby.
Another possibility would be to start with an already-existing but
library which already has ruby bindings, and learn to use it. Then when
you find something it can’t do, or something you would prefer to do
differently, study its code and tweak it to suit your needs, add
So, I’m basically asking how to make my own graphics libraries and GUI
toolkits, I want to know where my tech-organic graphics are being grown,
and how. Thanks for any enlightenment in advance.
Also - as Phlip mentioned: It depends on the kind of graphics you want
to render. If you’re interested in fast, efficient, high-framerate
suitable for real-time video game rendering, you’ll take one path. If
are interested in slower high-resolution anti-aliased print-quality
you’ll probably take a different path. If you want to render
buttons and widgets, and draw some simple static or animated icons next
to them, you might take a third path.
I would never try to discourage you from learning more about the native
window manager and graphics API calls on your platform. But at the
same time I would recommend at least playing with a few various
toolkits… Whether WxRuby, FXRuby, Tk, … or even some more game-
oriented ones like Gosu or rubygame, if you want to cut right to the
Hope this helps,