59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
# File 'lib/reight/app/sprite/editor.rb', line 59
def window_resized()
super
[chip_sizes, tools, colors, brush_sizes].flatten.map(&:sprite)
.each {|sp| sp.w = sp.h = BUTTON_SIZE}
chips_index.sprite.tap do |sp|
sp.w, sp.h = INDEX_SIZE, BUTTON_SIZE
sp.x = SPACE
sp.y = NAVIGATOR_HEIGHT + SPACE
end
chip_sizes.reverse.map {_1.sprite}.each.with_index do |sp, index|
sp.x = SPACE + CHIPS_WIDTH - (sp.w + (sp.w + 1) * index)
sp.y = chips_index.sprite.y
end
chips.sprite.tap do |sp|
sp.x = SPACE
sp.y = chip_sizes.last.sprite.bottom + SPACE
sp.right = chip_sizes.last.sprite.right
sp.bottom = height - SPACE
end
colors.map {_1.sprite}.each.with_index do |sp, index|
sp.h *= 0.8
sp.x = chips.sprite.right + SPACE + sp.w * (index % 8)
sp.y = height - (SPACE + sp.h * (4 - index / 8))
end
tools.map {_1.sprite}.each.with_index do |sp, index|
sp.x = colors.first.sprite.x + (sp.w + 1) * index
sp.y = colors.first.sprite.y - (SPACE / 2 + sp.h)
end
canvas.sprite.tap do |sp|
sp.x = chip_sizes.last.sprite.right + SPACE
sp.y = chip_sizes.last.sprite.y
sp.bottom = tools.first.sprite.top - SPACE / 2
sp.w = sp.h
end
brush_sizes.map {_1.sprite}.each.with_index do |sp, index|
sp.x = canvas.sprite.right + SPACE + (sp.w + 1) * index
sp.y = canvas.sprite.y
end
shapes.map {_1.sprite}.each.with_index do |sp, index|
sp.w = 30
sp.h = BUTTON_SIZE
sp.x = brush_sizes.first.sprite.x + (sp.w + 1) * index
sp.y = brush_sizes.last.sprite.bottom + SPACE
end
types.map {_1.sprite}.each.with_index do |sp, index|
sp.w = 50
sp.h = BUTTON_SIZE
sp.x = shapes.first.sprite.x + (sp.w + 1) * index
sp.y = shapes.last.sprite.bottom + SPACE
end
end
|