cloudy_ui 0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +24 -0
- data/README.md +28 -0
- data/data/themes/cloudy/button_active_bottom.png +0 -0
- data/data/themes/cloudy/button_active_bottom_left.png +0 -0
- data/data/themes/cloudy/button_active_bottom_right.png +0 -0
- data/data/themes/cloudy/button_active_color.png +0 -0
- data/data/themes/cloudy/button_active_left.png +0 -0
- data/data/themes/cloudy/button_active_right.png +0 -0
- data/data/themes/cloudy/button_active_top.png +0 -0
- data/data/themes/cloudy/button_active_top_left.png +0 -0
- data/data/themes/cloudy/button_active_top_right.png +0 -0
- data/data/themes/cloudy/button_hover_bottom.png +0 -0
- data/data/themes/cloudy/button_hover_bottom_left.png +0 -0
- data/data/themes/cloudy/button_hover_bottom_right.png +0 -0
- data/data/themes/cloudy/button_hover_color.png +0 -0
- data/data/themes/cloudy/button_hover_left.png +0 -0
- data/data/themes/cloudy/button_hover_right.png +0 -0
- data/data/themes/cloudy/button_hover_top.png +0 -0
- data/data/themes/cloudy/button_hover_top_left.png +0 -0
- data/data/themes/cloudy/button_hover_top_right.png +0 -0
- data/data/themes/cloudy/button_normal_bottom.png +0 -0
- data/data/themes/cloudy/button_normal_bottom_left.png +0 -0
- data/data/themes/cloudy/button_normal_bottom_right.png +0 -0
- data/data/themes/cloudy/button_normal_color.png +0 -0
- data/data/themes/cloudy/button_normal_left.png +0 -0
- data/data/themes/cloudy/button_normal_right.png +0 -0
- data/data/themes/cloudy/button_normal_top.png +0 -0
- data/data/themes/cloudy/button_normal_top_left.png +0 -0
- data/data/themes/cloudy/button_normal_top_right.png +0 -0
- data/data/themes/cloudy/radio_empty.png +0 -0
- data/data/themes/cloudy/radio_full.png +0 -0
- data/data/themes/cloudy/scrollbar_vertical_bottom.png +0 -0
- data/data/themes/cloudy/scrollbar_vertical_handle_bottom.png +0 -0
- data/data/themes/cloudy/scrollbar_vertical_handle_middle.png +0 -0
- data/data/themes/cloudy/scrollbar_vertical_handle_top.png +0 -0
- data/data/themes/cloudy/scrollbar_vertical_middle.png +0 -0
- data/data/themes/cloudy/scrollbar_vertical_top.png +0 -0
- data/data/themes/cloudy/slider_handle.png +0 -0
- data/data/themes/cloudy/slider_left_end.png +0 -0
- data/data/themes/cloudy/slider_middle.png +0 -0
- data/data/themes/cloudy/slider_right_end.png +0 -0
- data/data/themes/cloudy/slider_selected_left_end.png +0 -0
- data/data/themes/cloudy/slider_selected_middle.png +0 -0
- data/data/themes/cloudy/slider_selected_right_end.png +0 -0
- data/examples/example.rb +124 -0
- data/lib/cloudy_ui.rb +24 -0
- data/lib/cloudy_ui/button.rb +71 -0
- data/lib/cloudy_ui/dynamic_field.rb +16 -0
- data/lib/cloudy_ui/radio_button.rb +15 -0
- data/lib/cloudy_ui/scrollbar.rb +38 -0
- data/lib/cloudy_ui/slider.rb +29 -0
- data/lib/cloudy_ui/version.rb +3 -0
- data/lib/cloudy_ui/window.rb +14 -0
- data/screenshot.png +0 -0
- metadata +115 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 60c3fdaa2a49dd764df14f7516139c1eb6acfc40
|
4
|
+
data.tar.gz: d0b7eebfaa12a291fa43679c3d8ef64f2b0ac6a8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: fc5531434dbacdd084458e3597fef119b700fb9d8a09a0aba458d118f6b30912266004ff953ce163eab951b236c8f2930f23244de8e50fd1779682a11c7db037
|
7
|
+
data.tar.gz: a525c718208af542e64922d5a8aad5a98716d22ea15e44ed5747eea3d9702381f0de4491e885f0d424d4994600bb3a67580af3b671a138d6c8aa5fbeba62ea37
|
data/LICENSE
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
This is free and unencumbered software released into the public domain.
|
2
|
+
|
3
|
+
Anyone is free to copy, modify, publish, use, compile, sell, or
|
4
|
+
distribute this software, either in source code form or as a compiled
|
5
|
+
binary, for any purpose, commercial or non-commercial, and by any
|
6
|
+
means.
|
7
|
+
|
8
|
+
In jurisdictions that recognize copyright laws, the author or authors
|
9
|
+
of this software dedicate any and all copyright interest in the
|
10
|
+
software to the public domain. We make this dedication for the benefit
|
11
|
+
of the public at large and to the detriment of our heirs and
|
12
|
+
successors. We intend this dedication to be an overt act of
|
13
|
+
relinquishment in perpetuity of all present and future rights to this
|
14
|
+
software under copyright law.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
19
|
+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
20
|
+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
21
|
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
22
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
23
|
+
|
24
|
+
For more information, please refer to <http://unlicense.org/>
|
data/README.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
Gosu-Cloudy-Ui
|
2
|
+
==============
|
3
|
+
|
4
|
+
![Current elements](/screenshot.png)
|
5
|
+
|
6
|
+
Drawing UI Kit based on http://kbsportfolio.com/2011/10/16/resource-for-designer-cloudy-ui-kit/
|
7
|
+
|
8
|
+
Load images before usage
|
9
|
+
|
10
|
+
CloudyUi::load_images window
|
11
|
+
|
12
|
+
Button states are :normal, :hover or :active
|
13
|
+
|
14
|
+
CloudyUi::Button.draw x, y, z, width, height, state
|
15
|
+
|
16
|
+
progress slided on slider in range 0..1
|
17
|
+
|
18
|
+
center of blue selection on slider in range 0..1
|
19
|
+
|
20
|
+
CloudyUi::Slider.draw x, y, z, width, progress, center=0
|
21
|
+
|
22
|
+
RadioButton states are :full and :empty
|
23
|
+
|
24
|
+
CloudyUi::RadioButtondraw x, y, z, state
|
25
|
+
|
26
|
+
A Window, an area for the ui elements
|
27
|
+
|
28
|
+
CloudyUi::Window.draw window, x, y, z, width, height
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/examples/example.rb
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
require 'gosu'
|
2
|
+
require_relative '../lib/cloudy_ui'
|
3
|
+
|
4
|
+
class Window < Gosu::Window
|
5
|
+
def initialize
|
6
|
+
super 800, 600, false
|
7
|
+
CloudyUi.load_images self
|
8
|
+
end
|
9
|
+
|
10
|
+
def draw
|
11
|
+
fill 0xFFFFFFFF
|
12
|
+
draw_window
|
13
|
+
draw_button_normal
|
14
|
+
draw_button_hover
|
15
|
+
draw_button_active
|
16
|
+
draw_slider1
|
17
|
+
draw_slider2
|
18
|
+
draw_slider3
|
19
|
+
draw_radio_full
|
20
|
+
draw_radio_empty
|
21
|
+
draw_dynamic_field
|
22
|
+
draw_scrollbar
|
23
|
+
|
24
|
+
end
|
25
|
+
|
26
|
+
def draw_window
|
27
|
+
CloudyUi::Window.draw self, 10, 10, 0, 305, 435
|
28
|
+
end
|
29
|
+
|
30
|
+
def draw_button_normal
|
31
|
+
x = 20
|
32
|
+
y = 20
|
33
|
+
z = 0
|
34
|
+
width = 100
|
35
|
+
height = 30
|
36
|
+
state = :normal
|
37
|
+
CloudyUi::Button.draw x, y, z, width, height, state
|
38
|
+
end
|
39
|
+
|
40
|
+
def draw_button_hover
|
41
|
+
x = 20
|
42
|
+
y = 60
|
43
|
+
z = 0
|
44
|
+
width = 100
|
45
|
+
height = 30
|
46
|
+
state = :hover
|
47
|
+
CloudyUi::Button.draw x, y, z, width, height, state
|
48
|
+
end
|
49
|
+
|
50
|
+
def draw_button_active
|
51
|
+
x = 20
|
52
|
+
y = 100
|
53
|
+
z = 0
|
54
|
+
width = 100
|
55
|
+
height = 30
|
56
|
+
state = :active
|
57
|
+
CloudyUi::Button.draw x, y, z, width, height, state
|
58
|
+
end
|
59
|
+
|
60
|
+
def draw_slider1
|
61
|
+
x = 150
|
62
|
+
y = 25
|
63
|
+
z = 0
|
64
|
+
width = 150
|
65
|
+
progress = 0.5
|
66
|
+
CloudyUi::Slider.draw x, y, z, width, progress
|
67
|
+
end
|
68
|
+
|
69
|
+
def draw_slider2
|
70
|
+
x = 150
|
71
|
+
y = 55
|
72
|
+
z = 0
|
73
|
+
width = 150
|
74
|
+
progress = 0.2
|
75
|
+
center = 0.5
|
76
|
+
CloudyUi::Slider.draw x, y, z, width, progress, center
|
77
|
+
end
|
78
|
+
|
79
|
+
def draw_slider3
|
80
|
+
x = 150
|
81
|
+
y = 85
|
82
|
+
z = 0
|
83
|
+
width = 150
|
84
|
+
progress = 0.5
|
85
|
+
center = 1
|
86
|
+
CloudyUi::Slider.draw x, y, z, width, progress, center
|
87
|
+
end
|
88
|
+
|
89
|
+
def draw_radio_full
|
90
|
+
x = 145
|
91
|
+
y = 110
|
92
|
+
z = 0
|
93
|
+
CloudyUi::RadioButton.draw x, y, z, :full
|
94
|
+
end
|
95
|
+
|
96
|
+
def draw_radio_empty
|
97
|
+
x = 170
|
98
|
+
y = 110
|
99
|
+
z = 0
|
100
|
+
CloudyUi::RadioButton.draw x, y, z, :empty
|
101
|
+
end
|
102
|
+
|
103
|
+
def draw_dynamic_field
|
104
|
+
CloudyUi::DynamicField.draw self, 150, 150, 0, 148, 280
|
105
|
+
end
|
106
|
+
|
107
|
+
def draw_scrollbar
|
108
|
+
x = 295
|
109
|
+
y = 150
|
110
|
+
z = 0
|
111
|
+
height = 280
|
112
|
+
CloudyUi::Scrollbar.draw x, y, z, height, 0.1, 0.9
|
113
|
+
end
|
114
|
+
|
115
|
+
def fill color, z=0
|
116
|
+
draw_quad 0, 0, color,
|
117
|
+
width, 0, color,
|
118
|
+
0, height, color,
|
119
|
+
width, height, color,
|
120
|
+
z, mode = :default
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
Window.new.show
|
data/lib/cloudy_ui.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'gosu'
|
2
|
+
|
3
|
+
module CloudyUi
|
4
|
+
BUILTIN_THEMES_DIR = File.join(File.dirname(__FILE__), '../data/themes').freeze
|
5
|
+
|
6
|
+
BUILTIN_THEMES = {
|
7
|
+
cloudy: File.join(BUILTIN_THEMES_DIR, 'cloudy').freeze
|
8
|
+
}.freeze
|
9
|
+
|
10
|
+
require_relative 'cloudy_ui/radio_button'
|
11
|
+
require_relative 'cloudy_ui/button'
|
12
|
+
require_relative 'cloudy_ui/slider'
|
13
|
+
require_relative 'cloudy_ui/scrollbar'
|
14
|
+
require_relative 'cloudy_ui/window'
|
15
|
+
require_relative 'cloudy_ui/dynamic_field'
|
16
|
+
|
17
|
+
def self.load_images window, theme = :cloudy
|
18
|
+
load_path = BUILTIN_THEMES.fetch theme, theme.to_s
|
19
|
+
CloudyUi::RadioButton .load_images window, load_path
|
20
|
+
CloudyUi::Button .load_images window, load_path
|
21
|
+
CloudyUi::Slider .load_images window, load_path
|
22
|
+
CloudyUi::Scrollbar .load_images window, load_path
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
class CloudyUi::Button
|
2
|
+
class << self
|
3
|
+
def draw x, y, z, width, height, state
|
4
|
+
#begin
|
5
|
+
# @@images
|
6
|
+
#rescue NameError
|
7
|
+
# raise "Must call #{self}.load_images(window, load_path) before using #{self}"
|
8
|
+
#end
|
9
|
+
|
10
|
+
@@window.draw_quad x+1 ,y+1 ,@@images[state][:color][0],
|
11
|
+
x+width-1 ,y+1 ,@@images[state][:color][0],
|
12
|
+
x+width-1 ,y+height-1 ,@@images[state][:color][1],
|
13
|
+
x+1 ,y+height-1 ,@@images[state][:color][1], z
|
14
|
+
|
15
|
+
height_margin = @@images[state][:top_left].height
|
16
|
+
width_margin = @@images[state][:top_left].width
|
17
|
+
|
18
|
+
|
19
|
+
@@images[state][:top_left] .draw x ,y ,z
|
20
|
+
@@images[state][:top_right] .draw x+width-width_margin ,y ,z
|
21
|
+
@@images[state][:bottom_left] .draw x ,y+height-height_margin ,z
|
22
|
+
@@images[state][:bottom_right] .draw x+width-width_margin ,y+height-height_margin ,z
|
23
|
+
@@images[state][:left] .draw x ,y+height_margin ,z ,1 ,height-height_margin*2
|
24
|
+
@@images[state][:right] .draw x+width-width_margin ,y+height_margin ,z ,1 ,height-height_margin*2
|
25
|
+
@@images[state][:top] .draw x+width_margin ,y ,z ,width-width_margin*2
|
26
|
+
@@images[state][:bottom] .draw x+width_margin ,y+height-height_margin ,z ,width-width_margin*2
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
def load_images window, load_path
|
32
|
+
@@window ||= window
|
33
|
+
@@images ||= {
|
34
|
+
active: {
|
35
|
+
left: Gosu::Image.new( window, File.join(load_path, 'button_active_left.png' ), true),
|
36
|
+
right: Gosu::Image.new( window, File.join(load_path, 'button_active_right.png' ), true),
|
37
|
+
bottom: Gosu::Image.new( window, File.join(load_path, 'button_active_bottom.png' ), true),
|
38
|
+
bottom_right: Gosu::Image.new( window, File.join(load_path, 'button_active_bottom_right.png' ), true),
|
39
|
+
bottom_left: Gosu::Image.new( window, File.join(load_path, 'button_active_bottom_left.png' ), true),
|
40
|
+
top: Gosu::Image.new( window, File.join(load_path, 'button_active_top.png' ), true),
|
41
|
+
top_right: Gosu::Image.new( window, File.join(load_path, 'button_active_top_right.png' ), true),
|
42
|
+
top_left: Gosu::Image.new( window, File.join(load_path, 'button_active_top_left.png' ), true),
|
43
|
+
color: [0xFF6F6F6F, 0xFF666666]
|
44
|
+
},
|
45
|
+
hover: {
|
46
|
+
left: Gosu::Image.new( window, File.join(load_path, 'button_hover_left.png' ), true),
|
47
|
+
right: Gosu::Image.new( window, File.join(load_path, 'button_hover_right.png' ), true),
|
48
|
+
bottom: Gosu::Image.new( window, File.join(load_path, 'button_hover_bottom.png' ), true),
|
49
|
+
bottom_right: Gosu::Image.new( window, File.join(load_path, 'button_hover_bottom_right.png' ), true),
|
50
|
+
bottom_left: Gosu::Image.new( window, File.join(load_path, 'button_hover_bottom_left.png' ), true),
|
51
|
+
top: Gosu::Image.new( window, File.join(load_path, 'button_hover_top.png' ), true),
|
52
|
+
top_right: Gosu::Image.new( window, File.join(load_path, 'button_hover_top_right.png' ), true),
|
53
|
+
top_left: Gosu::Image.new( window, File.join(load_path, 'button_hover_top_left.png' ), true),
|
54
|
+
color: [0xFFFBFBFB, 0xFFE9E9E9]
|
55
|
+
},
|
56
|
+
normal: {
|
57
|
+
left: Gosu::Image.new( window, File.join(load_path, 'button_normal_left.png' ), true),
|
58
|
+
right: Gosu::Image.new( window, File.join(load_path, 'button_normal_right.png' ), true),
|
59
|
+
bottom: Gosu::Image.new( window, File.join(load_path, 'button_normal_bottom.png' ), true),
|
60
|
+
bottom_right: Gosu::Image.new( window, File.join(load_path, 'button_normal_bottom_right.png' ), true),
|
61
|
+
bottom_left: Gosu::Image.new( window, File.join(load_path, 'button_normal_bottom_left.png' ), true),
|
62
|
+
top: Gosu::Image.new( window, File.join(load_path, 'button_normal_top.png' ), true),
|
63
|
+
top_right: Gosu::Image.new( window, File.join(load_path, 'button_normal_top_right.png' ), true),
|
64
|
+
top_left: Gosu::Image.new( window, File.join(load_path, 'button_normal_top_left.png' ), true),
|
65
|
+
color: [0xFFF9F9F9, 0xFFE9E9E9]
|
66
|
+
}
|
67
|
+
}
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class CloudyUi::DynamicField
|
2
|
+
def self.draw window, x, y, z, width, height
|
3
|
+
window.draw_quad x ,y ,0xFFe9e9e9,
|
4
|
+
x+width ,y ,0xFFe9e9e9,
|
5
|
+
x+width ,y+height ,0xFFe9e9e9,
|
6
|
+
x ,y+height ,0xFFe9e9e9, z
|
7
|
+
|
8
|
+
window.draw_line x, y-1 , 0xFFc6c6c6, x+width , y-1 , 0xFFc6c6c6 ,z
|
9
|
+
window.draw_line x, y , 0xFFe0e0e0, x+width , y , 0xFFe0e0e0 ,z
|
10
|
+
window.draw_line x, y+height, 0xFFc9c9c9, x+width , y+height, 0xFFc9c9c9 ,z
|
11
|
+
window.draw_line x, y+height+1, 0xFFf7f7f7, x+width , y+height+1, 0xFFf7f7f7 ,z
|
12
|
+
|
13
|
+
window.draw_line x ,y-1,0xFFcacaca,x ,y+height-1,0xFFd2d2d2,z
|
14
|
+
window.draw_line x+width+1,y-1,0xFFcacaca,x+width+1,y+height-1,0xFFd2d2d2,z
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class CloudyUi::RadioButton
|
2
|
+
class << self
|
3
|
+
def draw x, y, z, state
|
4
|
+
case state
|
5
|
+
when :empty; @@empty.draw x, y, z
|
6
|
+
when :full; @@full .draw x, y, z
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def load_images window, load_path
|
11
|
+
@@empty = Gosu::Image.new window, File.join(load_path, 'radio_empty.png')
|
12
|
+
@@full = Gosu::Image.new window, File.join(load_path, 'radio_full.png')
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
class CloudyUi::Scrollbar
|
2
|
+
class << self
|
3
|
+
## x, y, z, as onscreen coordinates
|
4
|
+
## scrollbar height in pixels
|
5
|
+
## handle_top, handle_bottom in range 0..1
|
6
|
+
def draw x, y, z, height, handle_top, handle_bottom
|
7
|
+
@@scrollbar_middle .draw x, y+@@scrollbar_top.height-2, z, 1, height-@@scrollbar_top.height*2+4
|
8
|
+
@@scrollbar_top .draw x, y-2, z
|
9
|
+
@@scrollbar_bottom .draw x, y+height-@@scrollbar_top.height+1, z
|
10
|
+
|
11
|
+
height -= @@handle_top.height
|
12
|
+
handle_top_y = y + handle_top * height + @@handle_top.height - 2
|
13
|
+
handle_bottom_y = y + handle_bottom * height + 1
|
14
|
+
handle_height = handle_bottom_y - handle_top_y
|
15
|
+
handle_height = 0 if handle_height < 0
|
16
|
+
handle_width = @@scrollbar_middle.width
|
17
|
+
|
18
|
+
@@window.draw_quad x+1 ,handle_top_y-2 ,0xFFfafafa,
|
19
|
+
x-1 + handle_width ,handle_top_y-2 ,0xFFfafafa,
|
20
|
+
x-1 + handle_width ,handle_top_y+1 + handle_height ,0xFFe9e9e9,
|
21
|
+
x+1 ,handle_top_y+1 + handle_height ,0xFFe9e9e9, z
|
22
|
+
|
23
|
+
@@handle_middle .draw x+1, handle_top_y, z, 1, handle_height
|
24
|
+
@@handle_top .draw x+1, handle_top_y - @@handle_top.height, z
|
25
|
+
@@handle_bottom .draw x+1, handle_bottom_y, z
|
26
|
+
end
|
27
|
+
|
28
|
+
def load_images window, load_path
|
29
|
+
@@window = window
|
30
|
+
@@scrollbar_top = Gosu::Image.new window, File.join(load_path, 'scrollbar_vertical_top.png'), true
|
31
|
+
@@scrollbar_middle = Gosu::Image.new window, File.join(load_path, 'scrollbar_vertical_middle.png'), true
|
32
|
+
@@scrollbar_bottom = Gosu::Image.new window, File.join(load_path, 'scrollbar_vertical_bottom.png'), true
|
33
|
+
@@handle_top = Gosu::Image.new window, File.join(load_path, 'scrollbar_vertical_handle_top.png'), true
|
34
|
+
@@handle_middle = Gosu::Image.new window, File.join(load_path, 'scrollbar_vertical_handle_middle.png'), true
|
35
|
+
@@handle_bottom = Gosu::Image.new window, File.join(load_path, 'scrollbar_vertical_handle_bottom.png'), true
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
class CloudyUi::Slider
|
2
|
+
class << self
|
3
|
+
## x, y, z, as onscreen coordinates
|
4
|
+
## slideable width in pixels
|
5
|
+
## progress slided on slider in range 0..1
|
6
|
+
## center of blue selection on slider in range 0..1
|
7
|
+
def draw x, y, z, width, progress, center=0
|
8
|
+
selected = progress * width
|
9
|
+
@@middle .draw_rot x ,y ,z ,0 ,0 ,0 ,width, 1
|
10
|
+
@@left_end .draw_rot x ,y ,z ,0 ,1 ,0
|
11
|
+
@@right_end .draw_rot x+width ,y ,z ,0 ,0 ,0 ,1 , 1
|
12
|
+
@@selected_middle .draw_rot x+center*width ,y ,z ,0 ,0 ,0 ,(progress-center)*width, 1.0
|
13
|
+
if center == 0; @@selected_left_end .draw_rot x ,y ,z ,0 ,1 ,0
|
14
|
+
elsif center == 1; @@selected_right_end .draw_rot x+width ,y ,z ,0 ,0 ,0
|
15
|
+
end
|
16
|
+
@@handle .draw_rot selected + x ,y-7 ,z ,0 ,0.5 ,0
|
17
|
+
end
|
18
|
+
|
19
|
+
def load_images window, load_path
|
20
|
+
@@handle = Gosu::Image.new window, File.join( load_path, 'slider_handle.png' ), true
|
21
|
+
@@middle = Gosu::Image.new window, File.join( load_path, 'slider_middle.png' ), true
|
22
|
+
@@left_end = Gosu::Image.new window, File.join( load_path, 'slider_left_end.png' ), true
|
23
|
+
@@right_end = Gosu::Image.new window, File.join( load_path, 'slider_right_end.png' ), true
|
24
|
+
@@selected_left_end = Gosu::Image.new window, File.join( load_path, 'slider_selected_left_end.png' ), true
|
25
|
+
@@selected_right_end = Gosu::Image.new window, File.join( load_path, 'slider_selected_right_end.png' ), true
|
26
|
+
@@selected_middle = Gosu::Image.new window, File.join( load_path, 'slider_selected_middle.png' ), true
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class CloudyUi::Window
|
2
|
+
def self.draw window, x, y, z, width, height
|
3
|
+
window.draw_quad x ,y ,0xFFFAFAFA,
|
4
|
+
x+width ,y ,0xFFFAFAFA,
|
5
|
+
x+width ,y+height ,0xFFf3f3f3,
|
6
|
+
x ,y+height ,0xFFf3f3f3, z
|
7
|
+
|
8
|
+
window.draw_line x, y , 0xFFe4e4e4, x+width , y , 0xFFe4e4e4 ,z
|
9
|
+
window.draw_line x, y+height, 0xFFCCCCCC, x+width , y+height+1, 0xFFCCCCCC ,z
|
10
|
+
|
11
|
+
window.draw_line x ,y,0xFFe4e4e4,x ,y+height,0xFFCCCCCC,z
|
12
|
+
window.draw_line x+width+1,y,0xFFe4e4e4,x+width+1,y+height,0xFFCCCCCC,z
|
13
|
+
end
|
14
|
+
end
|
data/screenshot.png
ADDED
Binary file
|
metadata
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cloudy_ui
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.1'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Bue Grønlund
|
8
|
+
- erisdev
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-11-09 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: gosu
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ~>
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 0.7.48
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ~>
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 0.7.48
|
28
|
+
description: Cloudy UI is an add-on library for Gosu that handles drawing of user
|
29
|
+
interface elements. Layout and input handling are left up to the programmer. Graphics
|
30
|
+
are sourced from <http://kbsportfolio.com/2011/10/16/resource-for-designer-cloudy-ui-kit/>.
|
31
|
+
email:
|
32
|
+
- aerotune@gmail.com
|
33
|
+
executables: []
|
34
|
+
extensions: []
|
35
|
+
extra_rdoc_files: []
|
36
|
+
files:
|
37
|
+
- data/themes/cloudy/button_active_bottom.png
|
38
|
+
- data/themes/cloudy/button_active_bottom_left.png
|
39
|
+
- data/themes/cloudy/button_active_bottom_right.png
|
40
|
+
- data/themes/cloudy/button_active_color.png
|
41
|
+
- data/themes/cloudy/button_active_left.png
|
42
|
+
- data/themes/cloudy/button_active_right.png
|
43
|
+
- data/themes/cloudy/button_active_top.png
|
44
|
+
- data/themes/cloudy/button_active_top_left.png
|
45
|
+
- data/themes/cloudy/button_active_top_right.png
|
46
|
+
- data/themes/cloudy/button_hover_bottom.png
|
47
|
+
- data/themes/cloudy/button_hover_bottom_left.png
|
48
|
+
- data/themes/cloudy/button_hover_bottom_right.png
|
49
|
+
- data/themes/cloudy/button_hover_color.png
|
50
|
+
- data/themes/cloudy/button_hover_left.png
|
51
|
+
- data/themes/cloudy/button_hover_right.png
|
52
|
+
- data/themes/cloudy/button_hover_top.png
|
53
|
+
- data/themes/cloudy/button_hover_top_left.png
|
54
|
+
- data/themes/cloudy/button_hover_top_right.png
|
55
|
+
- data/themes/cloudy/button_normal_bottom.png
|
56
|
+
- data/themes/cloudy/button_normal_bottom_left.png
|
57
|
+
- data/themes/cloudy/button_normal_bottom_right.png
|
58
|
+
- data/themes/cloudy/button_normal_color.png
|
59
|
+
- data/themes/cloudy/button_normal_left.png
|
60
|
+
- data/themes/cloudy/button_normal_right.png
|
61
|
+
- data/themes/cloudy/button_normal_top.png
|
62
|
+
- data/themes/cloudy/button_normal_top_left.png
|
63
|
+
- data/themes/cloudy/button_normal_top_right.png
|
64
|
+
- data/themes/cloudy/radio_empty.png
|
65
|
+
- data/themes/cloudy/radio_full.png
|
66
|
+
- data/themes/cloudy/scrollbar_vertical_bottom.png
|
67
|
+
- data/themes/cloudy/scrollbar_vertical_handle_bottom.png
|
68
|
+
- data/themes/cloudy/scrollbar_vertical_handle_middle.png
|
69
|
+
- data/themes/cloudy/scrollbar_vertical_handle_top.png
|
70
|
+
- data/themes/cloudy/scrollbar_vertical_middle.png
|
71
|
+
- data/themes/cloudy/scrollbar_vertical_top.png
|
72
|
+
- data/themes/cloudy/slider_handle.png
|
73
|
+
- data/themes/cloudy/slider_left_end.png
|
74
|
+
- data/themes/cloudy/slider_middle.png
|
75
|
+
- data/themes/cloudy/slider_right_end.png
|
76
|
+
- data/themes/cloudy/slider_selected_left_end.png
|
77
|
+
- data/themes/cloudy/slider_selected_middle.png
|
78
|
+
- data/themes/cloudy/slider_selected_right_end.png
|
79
|
+
- examples/example.rb
|
80
|
+
- lib/cloudy_ui/button.rb
|
81
|
+
- lib/cloudy_ui/dynamic_field.rb
|
82
|
+
- lib/cloudy_ui/radio_button.rb
|
83
|
+
- lib/cloudy_ui/scrollbar.rb
|
84
|
+
- lib/cloudy_ui/slider.rb
|
85
|
+
- lib/cloudy_ui/version.rb
|
86
|
+
- lib/cloudy_ui/window.rb
|
87
|
+
- lib/cloudy_ui.rb
|
88
|
+
- LICENSE
|
89
|
+
- README.md
|
90
|
+
- screenshot.png
|
91
|
+
homepage: https://github.com/Aerotune/Gosu-Cloudy-Ui
|
92
|
+
licenses:
|
93
|
+
- public domain
|
94
|
+
metadata: {}
|
95
|
+
post_install_message:
|
96
|
+
rdoc_options: []
|
97
|
+
require_paths:
|
98
|
+
- lib
|
99
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - '>='
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
requirements: []
|
110
|
+
rubyforge_project:
|
111
|
+
rubygems_version: 2.1.5
|
112
|
+
signing_key:
|
113
|
+
specification_version: 4
|
114
|
+
summary: UI drawing kit for Gosu
|
115
|
+
test_files: []
|