rubygoo 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +10 -0
- data/Manifest.txt +37 -0
- data/README.txt +81 -0
- data/Rakefile +35 -0
- data/TODO +10 -0
- data/docs/.DS_Store +0 -0
- data/docs/Picture 1.png +0 -0
- data/docs/ui/.DS_Store +0 -0
- data/docs/ui/UI.hpp +425 -0
- data/docs/ui/abutton.png +0 -0
- data/docs/ui/background.png +0 -0
- data/docs/ui/button.png +0 -0
- data/docs/ui/moveable.png +0 -0
- data/docs/ui/textbutton.png +0 -0
- data/lib/code_statistics.rb +107 -0
- data/lib/platform.rb +15 -0
- data/lib/rubygoo.rb +19 -0
- data/lib/rubygoo/adapters/adapter_factory.rb +14 -0
- data/lib/rubygoo/adapters/gosu_app_adapter.rb +50 -0
- data/lib/rubygoo/adapters/gosu_render_adapter.rb +53 -0
- data/lib/rubygoo/adapters/rubygame_app_adapter.rb +37 -0
- data/lib/rubygoo/adapters/rubygame_render_adapter.rb +51 -0
- data/lib/rubygoo/app.rb +80 -0
- data/lib/rubygoo/button.rb +53 -0
- data/lib/rubygoo/check_box.rb +74 -0
- data/lib/rubygoo/container.rb +130 -0
- data/lib/rubygoo/css_colors.rb +151 -0
- data/lib/rubygoo/dialog.rb +40 -0
- data/lib/rubygoo/goo_color.rb +8 -0
- data/lib/rubygoo/goo_event.rb +11 -0
- data/lib/rubygoo/label.rb +42 -0
- data/lib/rubygoo/text_field.rb +301 -0
- data/lib/rubygoo/widget.rb +144 -0
- data/samples/gosu_app.rb +102 -0
- data/samples/rubygame_app.rb +102 -0
- data/themes/default/Vera.ttf +0 -0
- data/themes/default/config.yml +20 -0
- metadata +121 -0
data/samples/gosu_app.rb
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
$: << './lib'
|
3
|
+
require 'rubygoo'
|
4
|
+
|
5
|
+
require 'gosu'
|
6
|
+
require 'rubygame'
|
7
|
+
include Gosu
|
8
|
+
include Rubygame
|
9
|
+
|
10
|
+
class GameWindow < Window
|
11
|
+
def initialize()
|
12
|
+
super(640, 480, false)
|
13
|
+
factory = AdapterFactory.new
|
14
|
+
@render_adapter = factory.renderer_for :gosu, self
|
15
|
+
app = create_gui(@render_adapter)
|
16
|
+
@app_adapter = factory.app_for :gosu, app, self
|
17
|
+
self.caption = "Gosu Tutorial Game"
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
def create_gui(renderer)
|
22
|
+
app = App.new :renderer => renderer
|
23
|
+
|
24
|
+
label = Label.new "click the button to set the time", :x=>20, :y=>30
|
25
|
+
|
26
|
+
button = Button.new "Click Me!", :x=>70, :y=>80, :x_pad=>20, :y_pad=>20
|
27
|
+
button.on :pressed do |*opts|
|
28
|
+
label.set_text(Time.now.to_s)
|
29
|
+
end
|
30
|
+
|
31
|
+
check = CheckBox.new :x=>370, :y=>70, :w=>20, :h=>20
|
32
|
+
check.on :checked do
|
33
|
+
label.set_text("CHECKED [#{check.checked?}]")
|
34
|
+
end
|
35
|
+
|
36
|
+
text_field = TextField.new "initial text", :x => 70, :y => 170
|
37
|
+
|
38
|
+
text_field.on_key K_RETURN, K_KP_ENTER do |evt|
|
39
|
+
puts "BOO-YAH"
|
40
|
+
end
|
41
|
+
|
42
|
+
modal_button = Button.new "Modal dialogs", :x=>270, :y=>280, :x_pad=>20, :y_pad=>20
|
43
|
+
modal_button.on :pressed do |*opts|
|
44
|
+
msg = "I AM MODAL"
|
45
|
+
# TODO make some of this stuff relative and/or make Dialog's
|
46
|
+
# constructor take a layout to use
|
47
|
+
modal = Dialog.new :modal => app, :x=>10, :y=>110, :w=>250, :h=>250
|
48
|
+
|
49
|
+
modal.add Label.new("Message Here", :x=>70, :y=>180, :x_pad=>20, :y_pad=>20)
|
50
|
+
ok_butt = Button.new("OK", :x=>90, :y=>280, :x_pad=>20, :y_pad=>20)
|
51
|
+
ok_butt.on :pressed do |*opts|
|
52
|
+
# TODO not sure about this yet
|
53
|
+
app.remove(modal)
|
54
|
+
end
|
55
|
+
modal.add ok_butt
|
56
|
+
|
57
|
+
modal.show
|
58
|
+
end
|
59
|
+
|
60
|
+
# implicit tab ordering based on order of addition, can
|
61
|
+
# specify if you want on widget creation
|
62
|
+
|
63
|
+
# can add many or one at a time
|
64
|
+
app.add text_field, label, button, modal_button
|
65
|
+
app.add check
|
66
|
+
|
67
|
+
# pulldown = Pulldown.new {:x=>70, :y=>80}
|
68
|
+
# pulldown.on :changed do |*opts|
|
69
|
+
# label.set_text(opts.first)
|
70
|
+
# end
|
71
|
+
#
|
72
|
+
# app.add pulldown
|
73
|
+
app
|
74
|
+
end
|
75
|
+
|
76
|
+
def update
|
77
|
+
@app_adapter.update Gosu::milliseconds
|
78
|
+
end
|
79
|
+
|
80
|
+
def draw
|
81
|
+
# possibly need to set something like GosuRenderer vs
|
82
|
+
# RubygameRenderer that each know how to draw a textbox in
|
83
|
+
# its own way?
|
84
|
+
@app_adapter.draw @render_adapter
|
85
|
+
end
|
86
|
+
|
87
|
+
# in gosu this captures mouse and keyboard events
|
88
|
+
def button_down(id)
|
89
|
+
@app_adapter.button_down id
|
90
|
+
end
|
91
|
+
|
92
|
+
def button_up(id)
|
93
|
+
@app_adapter.button_up id
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
if $0 == __FILE__
|
98
|
+
|
99
|
+
window = GameWindow.new
|
100
|
+
window.show
|
101
|
+
|
102
|
+
end
|
@@ -0,0 +1,102 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
$: << './lib'
|
3
|
+
require 'rubygoo'
|
4
|
+
require 'rubygame'
|
5
|
+
include Rubygame
|
6
|
+
|
7
|
+
def create_gui(renderer)
|
8
|
+
app = App.new :renderer => renderer
|
9
|
+
|
10
|
+
label = Label.new "click the button to set the time", :x=>20, :y=>30
|
11
|
+
|
12
|
+
button = Button.new "Click Me!", :x=>70, :y=>80, :x_pad=>20, :y_pad=>20
|
13
|
+
button.on :pressed do |*opts|
|
14
|
+
label.set_text(Time.now.to_s)
|
15
|
+
end
|
16
|
+
|
17
|
+
check = CheckBox.new :x=>370, :y=>70, :w=>20, :h=>20
|
18
|
+
check.on :checked do
|
19
|
+
label.set_text("CHECKED [#{check.checked?}]")
|
20
|
+
end
|
21
|
+
|
22
|
+
text_field = TextField.new "initial text", :x => 70, :y => 170
|
23
|
+
|
24
|
+
text_field.on_key K_RETURN, K_KP_ENTER do |evt|
|
25
|
+
puts "BOO-YAH"
|
26
|
+
end
|
27
|
+
|
28
|
+
modal_button = Button.new "Modal dialogs", :x=>270, :y=>280, :x_pad=>20, :y_pad=>20
|
29
|
+
modal_button.on :pressed do |*opts|
|
30
|
+
msg = "I AM MODAL"
|
31
|
+
# TODO make some of this stuff relative and/or make Dialog's
|
32
|
+
# constructor take a layout to use
|
33
|
+
modal = Dialog.new :modal => app, :x=>10, :y=>110, :w=>250, :h=>250
|
34
|
+
|
35
|
+
modal.add Label.new("Message Here", :x=>70, :y=>180, :x_pad=>20, :y_pad=>20)
|
36
|
+
ok_butt = Button.new("OK", :x=>90, :y=>280, :x_pad=>20, :y_pad=>20)
|
37
|
+
ok_butt.on :pressed do |*opts|
|
38
|
+
# TODO not sure about this yet
|
39
|
+
app.remove(modal)
|
40
|
+
end
|
41
|
+
modal.add ok_butt
|
42
|
+
|
43
|
+
modal.show
|
44
|
+
end
|
45
|
+
|
46
|
+
# implicit tab ordering based on order of addition, can
|
47
|
+
# specify if you want on widget creation
|
48
|
+
|
49
|
+
# can add many or one at a time
|
50
|
+
app.add text_field, label, button, modal_button
|
51
|
+
app.add check
|
52
|
+
|
53
|
+
# pulldown = Pulldown.new {:x=>70, :y=>80}
|
54
|
+
# pulldown.on :changed do |*opts|
|
55
|
+
# label.set_text(opts.first)
|
56
|
+
# end
|
57
|
+
#
|
58
|
+
# app.add pulldown
|
59
|
+
app
|
60
|
+
end
|
61
|
+
|
62
|
+
if $0 == __FILE__
|
63
|
+
|
64
|
+
screen = Screen.new [600,480]
|
65
|
+
|
66
|
+
factory = AdapterFactory.new
|
67
|
+
render_adapter = factory.renderer_for :rubygame, screen
|
68
|
+
app = create_gui(render_adapter)
|
69
|
+
app_adapter = factory.app_for :rubygame, app
|
70
|
+
|
71
|
+
# rubygame standard stuff below here
|
72
|
+
queue = EventQueue.new
|
73
|
+
queue.ignore = [
|
74
|
+
ActiveEvent, JoyAxisEvent, JoyBallEvent, JoyDownEvent,
|
75
|
+
JoyHatEvent, JoyUpEvent, ResizeEvent
|
76
|
+
]
|
77
|
+
clock = Clock.new
|
78
|
+
clock.target_framerate = 20
|
79
|
+
|
80
|
+
catch(:rubygame_quit) do
|
81
|
+
loop do
|
82
|
+
queue.each do |event|
|
83
|
+
case event
|
84
|
+
when KeyDownEvent
|
85
|
+
case event.key
|
86
|
+
when K_ESCAPE
|
87
|
+
throw :rubygame_quit
|
88
|
+
end
|
89
|
+
when QuitEvent
|
90
|
+
throw :rubygame_quit
|
91
|
+
end
|
92
|
+
|
93
|
+
# pass on our events to the GUI
|
94
|
+
app_adapter.on_event event
|
95
|
+
end
|
96
|
+
|
97
|
+
app_adapter.update clock.tick
|
98
|
+
app_adapter.draw render_adapter
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
Binary file
|
@@ -0,0 +1,20 @@
|
|
1
|
+
---
|
2
|
+
App:
|
3
|
+
:bg_color: :Black
|
4
|
+
Widget:
|
5
|
+
:font: Vera.ttf
|
6
|
+
:font_size: 20
|
7
|
+
:color: :Black
|
8
|
+
:focus_color: :FireBrick
|
9
|
+
:bg_color: :Gray
|
10
|
+
:border_color: :FireBrick
|
11
|
+
Button:
|
12
|
+
:bg_color: :DimGray
|
13
|
+
CheckBox:
|
14
|
+
:checked_color: :FireBrick
|
15
|
+
TextField:
|
16
|
+
:fg_color: :FireBrick
|
17
|
+
:bg_color: :Gray
|
18
|
+
:bg_select_color: :FireBrick
|
19
|
+
:fg_select_color: :Snow
|
20
|
+
:border_color: :Black
|
metadata
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rubygoo
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Shawn Anderson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-09-17 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: constructor
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: publisher
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0"
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: hoe
|
37
|
+
type: :development
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 1.7.0
|
44
|
+
version:
|
45
|
+
description: GUI library for use with Gosu or Rubygame
|
46
|
+
email: boss@topfunky.com
|
47
|
+
executables: []
|
48
|
+
|
49
|
+
extensions: []
|
50
|
+
|
51
|
+
extra_rdoc_files:
|
52
|
+
- History.txt
|
53
|
+
- Manifest.txt
|
54
|
+
- README.txt
|
55
|
+
files:
|
56
|
+
- History.txt
|
57
|
+
- Manifest.txt
|
58
|
+
- README.txt
|
59
|
+
- Rakefile
|
60
|
+
- TODO
|
61
|
+
- docs/.DS_Store
|
62
|
+
- docs/Picture 1.png
|
63
|
+
- docs/ui/.DS_Store
|
64
|
+
- docs/ui/UI.hpp
|
65
|
+
- docs/ui/abutton.png
|
66
|
+
- docs/ui/background.png
|
67
|
+
- docs/ui/button.png
|
68
|
+
- docs/ui/moveable.png
|
69
|
+
- docs/ui/textbutton.png
|
70
|
+
- lib/code_statistics.rb
|
71
|
+
- lib/platform.rb
|
72
|
+
- lib/rubygoo.rb
|
73
|
+
- lib/rubygoo/adapters/adapter_factory.rb
|
74
|
+
- lib/rubygoo/adapters/gosu_app_adapter.rb
|
75
|
+
- lib/rubygoo/adapters/gosu_render_adapter.rb
|
76
|
+
- lib/rubygoo/adapters/rubygame_app_adapter.rb
|
77
|
+
- lib/rubygoo/adapters/rubygame_render_adapter.rb
|
78
|
+
- lib/rubygoo/app.rb
|
79
|
+
- lib/rubygoo/button.rb
|
80
|
+
- lib/rubygoo/check_box.rb
|
81
|
+
- lib/rubygoo/container.rb
|
82
|
+
- lib/rubygoo/css_colors.rb
|
83
|
+
- lib/rubygoo/dialog.rb
|
84
|
+
- lib/rubygoo/goo_color.rb
|
85
|
+
- lib/rubygoo/goo_event.rb
|
86
|
+
- lib/rubygoo/label.rb
|
87
|
+
- lib/rubygoo/text_field.rb
|
88
|
+
- lib/rubygoo/widget.rb
|
89
|
+
- samples/gosu_app.rb
|
90
|
+
- samples/rubygame_app.rb
|
91
|
+
- themes/default/Vera.ttf
|
92
|
+
- themes/default/config.yml
|
93
|
+
has_rdoc: true
|
94
|
+
homepage: http://rubygoo.googlecode.com
|
95
|
+
post_install_message:
|
96
|
+
rdoc_options:
|
97
|
+
- --main
|
98
|
+
- README.txt
|
99
|
+
require_paths:
|
100
|
+
- lib
|
101
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: "0"
|
106
|
+
version:
|
107
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: "0"
|
112
|
+
version:
|
113
|
+
requirements: []
|
114
|
+
|
115
|
+
rubyforge_project: rubygoo
|
116
|
+
rubygems_version: 1.2.0
|
117
|
+
signing_key:
|
118
|
+
specification_version: 2
|
119
|
+
summary: Beautiful graphs for one or multiple datasets.
|
120
|
+
test_files: []
|
121
|
+
|