# Subject: rubygoo 0.0.6 Released

**URL:** <https://www.ruby-forum.com/t/subject-rubygoo-0-0-6-released/153268>\
**Category:** Ruby\
**Created:** [November 14, 2008, 4:54am UTC](https://www.ruby-forum.com/t/subject-rubygoo-0-0-6-released/153268 "2008-11-14T04:54:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![allgeier](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ba9def/32.png) [@allgeier](https://www.ruby-forum.com/u/allgeier)\
**Post date:** [November 14, 2008, 4:54am UTC](https://www.ruby-forum.com/t/subject-rubygoo-0-0-6-released/153268/1 "2008-11-14T04:54:57Z")

</div>

rubygoo version 0.0.6 has been released!

- [http://rubygoo.googlecode.com](http://rubygoo.googlecode.com)

GUI library for use with Gosu or Rubygame

Changes:

### 0.0.6 / 2008-11-13

- Getting closer to a 1.0 release
  - Better TextField support for Gosu
  - small rendering bugs fixed
  - added relative positioning of widgets
  - added RadioButton and RadioGroup

Screenshot:  
[http://rubygoo.googlecode.com/files/rubygoo\_radio\_groups.png](http://rubygoo.googlecode.com/files/rubygoo_radio_groups.png)

Sample Rubygame code:

require ‘rubygems’  
$: \<\< ‘./lib’  
$: \<\< File.dirname( **FILE** )  
require ‘rubygoo’  
require ‘rubygame’  
include Rubygame  
include Rubygoo

if $0 == **FILE**

screen = Screen.new [600,480]  
screen.show\_cursor = false

factory = AdapterFactory.new  
render\_adapter = factory.renderer\_for :rubygame, screen  
icon = Surface.load File.dirname( **FILE** ) + “/icon.png”

app = App.new :renderer =\> renderer

label = Label.new “click the button to set the time”, :x=\>20, :y=\>30

button = Button.new “Click Me!”, :x=\>70, :y=\>80, :x\_pad=\>20,  
:y\_pad=\>20, :icon =\> icon  
button.on :pressed do |\*opts|  
label.set\_text(Time.now.to\_s)  
end

check = CheckBox.new :x=\>370, :y=\>70, :w=\>20, :h=\>20  
check.on :checked do  
label.set\_text(“CHECKED [#{check.checked?}]”)  
end

text\_field = TextField.new “initial text”, :x =\> 70, :y =\> 170,  
:max\_length =\> 20, :min\_length =\> 6

text\_field.on\_key K\_RETURN, K\_KP\_ENTER do |evt|  
puts “BOO-YAH”  
end

modal\_button = Button.new “Modal dialogs”, :x=\>270, :y=\>280,  
:x\_pad=\>20, :y\_pad=\>20  
modal\_button.on :pressed do |\*opts|  
modal = Dialog.new :modal =\> app, :x=\>60, :y=\>110, :w=\>250, :h=\>250

```
modal.add Label.new("Message Here", :x=>20, :y=>70, :x_pad=>20,

```

:y\_pad=\>20, :relative=\>true)

```
ok_butt = Button.new("OK", :x=>70, :y=>180, :x_pad=>20,

```

:y\_pad=\>20,:relative=\>true)  
ok\_butt.on :pressed do |\*opts|  
app.remove\_modal(modal)  
end  
modal.add ok\_butt

```
modal.show

```

end

grp = RadioGroup.new :x=\>10, :y=\>380, :x\_pad=\>20, :y\_pad=\>20, :w=\>  
500, :h=\>80  
grp\_label = Label.new “RadioGroups are fun!”, :x=\>40, :y=\>10,  
:w=\>20, :h=\>20, :relative=\>true  
grp\_radio\_one = RadioButton.new :x=\>40, :y=\>40, :w=\>20, :h=\>20,  
:relative=\>true  
grp\_radio\_two = RadioButton.new :x=\>90, :y=\>40, :w=\>20, :h=\>20,  
:relative=\>true  
grp\_radio\_three = RadioButton.new :x=\>140, :y=\>40, :w=\>20, :h=\>20,  
:relative=\>true

grp.add grp\_label, grp\_radio\_one, grp\_radio\_two, grp\_radio\_three

# implicit tab ordering based on order of addition, can

# specify if you want on widget creation

# can add many or one at a time

app.add text\_field, label, button, modal\_button, grp  
app.add check

app\_adapter = factory.app\_for :rubygame, app

# rubygame standard stuff below here

queue = EventQueue.new  
queue.ignore = [  
ActiveEvent, JoyAxisEvent, JoyBallEvent, JoyDownEvent,  
JoyHatEvent, JoyUpEvent, ResizeEvent  
]  
clock = Clock.new  
clock.target\_framerate = 20

catch(:rubygame\_quit) do  
loop do  
queue.each do |event|  
case event  
when KeyDownEvent  
case event.key  
when K\_ESCAPE  
throw :rubygame\_quit  
end  
when QuitEvent  
throw :rubygame\_quit  
end

```
    # pass on our events to the GUI
    app_adapter.on_event event
  end

  app_adapter.update clock.tick
  app_adapter.draw render_adapter
end

```

end  
end
