[SoC] GlimR 0.1.0

== GlimR 0.1.0 - Ruby OpenGL GUI Widget Kit ==

Homepage: http://glimr.rubyforge.org/
Download: http://rubyforge.org/frs/?group_id=1736
Blog: http://glimr.blogspot.com/

This is one of Ruby Central Inc.'s
Google Summer of Code 2006 projects.

== What is it? ==

A GUI toolkit written in Ruby, using OpenGL for
drawing and SDL for text and loading images.

Intended for being embedded in other OpenGL
applications and for stand-alone apps that don’t
need complex widgets.

See the README in the tarball or at
http://glimr.blogspot.com/2006/07/glimr-010.html
for more.

Take it for a spin if you like, there are small
example programs focusing on different
aspects of the toolkit in
tests/integration_tests/

== Requirements ==

Ruby >= 1.8.1, tested to run on YARV (but encountered some segfaults)
ruby-opengl
Ruby/SDL with TTF support ( Ruby/SDL )

Tested to run on Linux and Windows,
should work on OS X too if you
get SDL_ttf installed.

Perceptibly faster on Linux than Windows (go figure.)

== Currently implemented widgets ==

  • Horizontal and vertical layout
  • Buttons, radio buttons, checkboxes
  • Scrollbars
  • Resizable scrollable container
  • Image, strechable image
  • Text labels, single-line text input
  • Simple theme system

== Example code ==

require ‘glimr’
include GlimR

form = VLayout.new(
:expand_height => true, :expand_width => true,
:align => :center, :valign => :middle)

label = Label.new(:text => “Enter your name:”)
name_input = TextInput.new(:text => “”){|o,e|
form.attach Label.new(:text => “Hi, #{e.text}!”)
}
submit = Button.new(:label => “OK”){|o,e|
name_input.submit
}
form.attach label, name_input, submit

window = GLUTWindow.new(400, 200, “Greeter”)
window.attach form
window.run

Ctrl-Q to quit

== Features in development ==

  • menus, lists, tables
  • multi-line text editor
  • keyboard focus management
  • clipboard integration
  • second theme

P.S.
Anyone have ideas on what’s causing segfaults on Windows
when using OpenGL and SDL? Now I’m using a GC.disabled
critical section to work around them.

This seems pretty neat, I snagged the gem and ran the little sample
form below. It seemed a little slugish to respond, but on the
otherhand it handles resizing and such well from what I could tell.

So yeah, neat :slight_smile: Want to post some more examples?

Thanks for your project,
.adam

Hi,

On 7/16/06, Adam S. [email protected] wrote:

This seems pretty neat, I snagged the gem and ran the little sample
form below. It seemed a little slugish to respond, but on the
otherhand it handles resizing and such well from what I could tell.

Thanks for trying it out :slight_smile:
Btw, what were the parts being sluggish? Text input? Everything?
Could you also tell what OS and hardware you ran it on?
I’ll try to fix performance in a later release (after coding the main
features)

So yeah, neat :slight_smile: Want to post some more examples?

Sure!
Here’s an image viewer (beware, if an image is larger
than max OpenGL texture size (usually 2048x2048 or more),
it won’t show it):

files = Dir[“.”].grep(/.(jpg|png)$/i)
require ‘glimr’
include GlimR

sc = ScrollableContainer.new(
:content => Image.load(files.first))

sc.container.on_click{|o,e|
case e.button
when :left
files.push files.shift
sc.content.load(files.first)
when :right
files.unshift files.pop
sc.content.load(files.first)
end
}

w = GLUTWindow.new
w.attach sc
w.run

That one had bad performance on Windows,
on Linux it’s a lot smoother for some reason.

I put the integration_tests sample code online at
http://glimr.rubyforge.org/samples/

Thanks for your project,
.adam

Cheers,
Ilmari