Updated consumer with text

This commit is contained in:
2026-06-14 22:11:20 -06:00
parent 7aea94c224
commit 8bf6b14446
3 changed files with 26 additions and 6 deletions
+1 -3
View File
@@ -3,7 +3,6 @@
require './dialouge_box.rb'
PRODUCER_DEBUG = false
BORDER = 2
HOVER_TIME = 500 # ms
@@ -31,7 +30,6 @@ class Producer
}
@tooltip = DialougeBox.new(@x, @y, WIDTH, HEIGHT, "Produces #{@rate} number per second")
puts @tooltip.methods.sort
end
# Creates numbers depending on the rate. This is done with knowing that the
@@ -46,8 +44,8 @@ class Producer
@draw_y = (((((@screen_height / @box_size.to_f) / 2.0) + (@y - camera_y) * camera_zoom) * @box_size) + BORDER * camera_zoom)
@camera_zoom = camera_zoom
if 0 < mouse_x - @draw_x && mouse_x - @draw_x < (@box_size * @camera_zoom) && 0 < mouse_y - @draw_y && mouse_y - @draw_y < (@box_size * @camera_zoom)
puts 'mouse in consumer'
@tooltip_timer += 60.0 * delta_mult
puts @tooltip_timer
if @tooltip_timer > HOVER_TIME
@tooltip.show = true
@tooltip.update(@draw_x, @draw_y, @camera_zoom)