Not a ruby question as such (sorry), but one of you might know.. Is there
a ruby gem that lets me open an OS X window, blit pixels to it, and handle
basic, mouse input?
Seems like someone must have wanted to do this before?
I'd really rather not have to import the whole of OpenGL just to display a
2d bitmap in a window.
On Fri, Jul 22, 2016 at 7:34 AM, Sophie Wellow <sophie.wellow@gmail.com> wrote:
Hi,
Not a ruby question as such (sorry), but one of you might know.. Is there a
ruby gem that lets me open an OS X window, blit pixels to it, and handle
basic, mouse input?
Seems like someone must have wanted to do this before?
I'd really rather not have to import the whole of OpenGL just to display a
2d bitmap in a window.
It's still rough, but you might like my graphics gem:
The code lives here:
and lets you do things like:
class Ball < Graphics::Body
def initialize w
super
# ...
end
def draw
w.angle x, y, a, 10+3*m, :red
w.circle x, y, 5, :white, :filled
end
def update
fall
move
bounce
end
# ...
end
class BounceSimulation < Graphics::Simulation
attr_accessor :bs
def initialize
super 640, 640, 16, "Bounce"
self.bs = populate Ball
end
def update n
bs.each(&:update)
end
def draw n
clear
bs.each(&:draw)
fps n
end
# ...
end
BounceSimulation.new.run
···
On Jul 22, 2016, at 07:34, Sophie Wellow <sophie.wellow@gmail.com> wrote:
Not a ruby question as such (sorry), but one of you might know.. Is there a ruby gem that lets me open an OS X window, blit pixels to it, and handle basic, mouse input?
Seems like someone must have wanted to do this before?
I'd really rather not have to import the whole of OpenGL just to display a 2d bitmap in a window.