summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorFrederico Linhares <fred@linhares.blue>2025-06-21 16:51:22 -0300
committerFrederico Linhares <fred@linhares.blue>2025-06-21 16:51:22 -0300
commit8bedf8a366cb6c1179bc89678c863517b9356d48 (patch)
tree4a285592f804802d59f2af090113f607344ffdce /lib
parentb3428170ac0a1837d3568f7b49312cbb01179f5d (diff)
refa Remove View2DHEADmaster
View2D is almost useless and add too much complexity for the engine, so I am removing it.
Diffstat (limited to 'lib')
-rw-r--r--lib/menu.rb23
1 files changed, 7 insertions, 16 deletions
diff --git a/lib/menu.rb b/lib/menu.rb
index 801b5a7..47e9646 100644
--- a/lib/menu.rb
+++ b/lib/menu.rb
@@ -1,4 +1,4 @@
-# Copyright 2022-2024 Frederico de Oliveira Linhares
+# Copyright 2022-2025 Frederico de Oliveira Linhares
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -89,24 +89,21 @@ module CandyGear
}
end
- def draw(view, x, y, width, height)
+ def draw(x, y, width, height)
num_horizontal_sprites = width / @border_width + 1;
num_horizontal_sprites += 1 if width % @border_width > 0;
num_vertical_sprites = height / @border_height;
num_vertical_sprites += 1 if height % @border_height > 0;
# Draw the corners.
- @sprites[:box_top_left].draw(view, x, y, border_width, border_height);
+ @sprites[:box_top_left].draw(x, y, border_width, border_height);
@sprites[:box_top_right].draw(
- view,
@border_width * (num_horizontal_sprites + 1) + x, y,
border_width, border_height);
@sprites[:box_bottom_left].draw(
- view,
x, @border_height * (num_vertical_sprites + 1) + y,
border_width, border_height);
@sprites[:box_bottom_right].draw(
- view,
@border_width * (num_horizontal_sprites + 1) + x,
@border_height * (num_vertical_sprites + 1) + y,
border_width, border_height);
@@ -115,22 +112,19 @@ module CandyGear
num_horizontal_sprites.times do |i|
# Top
@sprites[:box_top].draw(
- view, @border_width * (i + 1) + x, y,
- border_width, border_height);
+ @border_width * (i + 1) + x, y, border_width, border_height);
# Bottom
@sprites[:box_bottom].draw(
- view, @border_width * (i + 1) + x,
+ @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,
x, @border_height * (i + 1) + y, border_width, border_height);
# Right
@sprites[:box_right].draw(
- view,
@border_width * (num_horizontal_sprites + 1) + x,
@border_height * (i + 1) + y,
border_width, border_height);
@@ -152,8 +146,7 @@ module CandyGear
attr_reader(:width, :height);
- def initialize(view, menu_view, pos_x, pos_y, options)
- @view = view;
+ def initialize(menu_view, pos_x, pos_y, options)
@menu_view = menu_view;
@pos_x = pos_x;
@@ -205,11 +198,10 @@ module CandyGear
end
def draw()
- @menu_view.draw(@view, @pos_x, @pos_y, @width, @height);
+ @menu_view.draw(@pos_x, @pos_y, @width, @height);
@options.each_with_index do |opt, i|
opt.text.draw(
- @view,
@pos_x + @menu_view.border_width +
@menu_view.border_width,
@pos_y + @menu_view.border_height +
@@ -218,7 +210,6 @@ module CandyGear
end
@menu_view.sprites[:arrow_select].draw(
- @view,
@pos_x + @menu_view.border_width,
@pos_y + @menu_view.border_height +
@option_max_height * @current_option,