summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/menu.rb89
1 files changed, 44 insertions, 45 deletions
diff --git a/lib/menu.rb b/lib/menu.rb
index 9f4c55c..3921147 100644
--- a/lib/menu.rb
+++ b/lib/menu.rb
@@ -41,7 +41,7 @@ module CandyGear
@sprites = {
arrow_select: Sprite.new(
- @texture, Vector4D.new(1.0/3.0, 1.0/3.0, 2.0/3.0, 2.0/3.0))
+ @texture, 1.0/3.0, 1.0/3.0, 2.0/3.0, 2.0/3.0)
}
end
@@ -64,23 +64,23 @@ module CandyGear
@sprites = {
arrow_select: Sprite.new(
- @texture, Vector4D.new(1.0/3.0, 1.0/3.0, 2.0/3.0, 2.0/3.0)),
+ @texture, 1.0/3.0, 1.0/3.0, 2.0/3.0, 2.0/3.0),
box_top_left: Sprite.new(
- @texture, Vector4D.new(0.0, 0.0, 1.0/3.0, 1.0/3.0)),
+ @texture, 0.0, 0.0, 1.0/3.0, 1.0/3.0),
box_top: Sprite.new(
- @texture, Vector4D.new(1.1/3.0, 0.0, 1.9/3.0, 1.0/3.0)),
+ @texture, 1.1/3.0, 0.0, 1.9/3.0, 1.0/3.0),
box_top_right: Sprite.new(
- @texture, Vector4D.new(2.0/3.0, 0.0, 1.0, 1.0/3.0)),
+ @texture, 2.0/3.0, 0.0, 1.0, 1.0/3.0),
box_left: Sprite.new(
- @texture, Vector4D.new(0.0, 1.1/3.0, 1.0/3.0, 1.9/3.0)),
+ @texture, 0.0, 1.1/3.0, 1.0/3.0, 1.9/3.0),
box_right: Sprite.new(
- @texture, Vector4D.new(2.0/3.0, 1.1/3.0, 1.0, 1.9/3.0)),
+ @texture, 2.0/3.0, 1.1/3.0, 1.0, 1.9/3.0),
box_bottom_left: Sprite.new(
- @texture, Vector4D.new(0.0, 2.0/3.0, 1.0/3.0, 1.0)),
+ @texture, 0.0, 2.0/3.0, 1.0/3.0, 1.0),
box_bottom: Sprite.new(
- @texture, Vector4D.new(1.1/3.0, 2.0/3.0, 1.9/3.0, 1.0)),
+ @texture, 1.1/3.0, 2.0/3.0, 1.9/3.0, 1.0),
box_bottom_right: Sprite.new(
- @texture, Vector4D.new(2.0/3.0, 2.0/3.0, 1.0, 1.0))
+ @texture, 2.0/3.0, 2.0/3.0, 1.0, 1.0)
}
end
@@ -91,45 +91,44 @@ module CandyGear
num_vertical_sprites += 1 if height % @border_height > 0;
# Draw the corners.
- @sprites[:box_top_left].draw(
- view, Vector4D.new(x, y, border_width, border_height));
+ @sprites[:box_top_left].draw(view, x, y, border_width, border_height);
@sprites[:box_top_right].draw(
- view, Vector4D.new(
- @border_width * (num_horizontal_sprites + 1) + x, y,
- border_width, border_height));
+ view,
+ @border_width * (num_horizontal_sprites + 1) + x, y,
+ border_width, border_height);
@sprites[:box_bottom_left].draw(
- view, Vector4D.new(
- x, @border_height * (num_vertical_sprites + 1) + y,
- border_width, border_height));
+ view,
+ x, @border_height * (num_vertical_sprites + 1) + y,
+ border_width, border_height);
@sprites[:box_bottom_right].draw(
- view, Vector4D.new(
- @border_width * (num_horizontal_sprites + 1) + x,
- @border_height * (num_vertical_sprites + 1) + y,
- border_width, border_height));
+ view,
+ @border_width * (num_horizontal_sprites + 1) + x,
+ @border_height * (num_vertical_sprites + 1) + y,
+ border_width, border_height);
# Draw the edges.
num_horizontal_sprites.times do |i|
# Top
@sprites[:box_top].draw(
- view, Vector4D.new(@border_width * (i + 1) + x, y,
- border_width, border_height));
+ view, @border_width * (i + 1) + x, y,
+ border_width, border_height);
# Bottom
@sprites[:box_bottom].draw(
- view, Vector4D.new(@border_width * (i + 1) + x,
- @border_height * (num_vertical_sprites + 1) + y,
- border_width, border_height));
+ view, @border_width * (i + 1) + x,
+ @border_height * (num_vertical_sprites + 1) + y,
+ border_width, border_height);
end
num_vertical_sprites.times do |i|
# Left
@sprites[:box_left].draw(
- view, Vector4D.new(
- x, @border_height * (i + 1) + y, border_width, border_height));
+ view,
+ x, @border_height * (i + 1) + y, border_width, border_height);
# Right
@sprites[:box_right].draw(
- view, Vector4D.new(
- @border_width * (num_horizontal_sprites + 1) + x,
- @border_height * (i + 1) + y,
- border_width, border_height));
+ view,
+ @border_width * (num_horizontal_sprites + 1) + x,
+ @border_height * (i + 1) + y,
+ border_width, border_height);
end
end
end
@@ -157,7 +156,7 @@ module CandyGear
@options = options.map do |opt|
texture = Texture.from_text(menu_view.font, opt[:text])
Option.new(
- Sprite.new(texture, CandyGear::Vector4D.new(0, 0, 1.0, 1.0)),
+ Sprite.new(texture, 0, 0, 1.0, 1.0),
opt[:action],
texture.width,
texture.height);
@@ -201,20 +200,20 @@ module CandyGear
@options.each_with_index do |opt, i|
opt.text.draw(
- @view, Vector4D.new(
- @pos_x + @menu_view.border_width +
- @menu_view.border_width,
- @pos_y + @menu_view.border_height +
- @option_max_height * i,
- opt.width, opt.height));
+ @view,
+ @pos_x + @menu_view.border_width +
+ @menu_view.border_width,
+ @pos_y + @menu_view.border_height +
+ @option_max_height * i,
+ opt.width, opt.height);
end
@menu_view.sprites[:arrow_select].draw(
- @view, Vector4D.new(
- @pos_x + @menu_view.border_width,
- @pos_y + @menu_view.border_height +
- @option_max_height * @current_option,
- @menu_view.border_width, @menu_view.border_height));
+ @view,
+ @pos_x + @menu_view.border_width,
+ @pos_y + @menu_view.border_height +
+ @option_max_height * @current_option,
+ @menu_view.border_width, @menu_view.border_height);
end
end
end