Added test dialouge boxes

This commit is contained in:
2026-06-14 16:03:31 -06:00
parent 693f5b83e9
commit c099fd5a19
2 changed files with 63 additions and 0 deletions
+13
View File
@@ -7,6 +7,7 @@ require 'yaml'
require './producer.rb'
require './consumer.rb'
require './dialouge_box.rb'
# Viewport resolution
WIDTH = Gosu::screen_width
@@ -42,6 +43,9 @@ class NumFactory < Gosu::Window
@camera_x_zoom_offset = WIDTH.to_f / (@camera_boxes * BOX_SIZE * 2).to_f
@camera_y_zoom_offset = HEIGHT.to_f / (@camera_boxes * BOX_SIZE * 2).to_f
@dd = DialougeBox.new(0, 0, WIDTH, HEIGHT, "This is a really really really really really really really really really really string\nof test text!")
@dialouges = [@dd]
# Load from file or initialize a new game
begin
game_save_data = YAML.load_file("#{GAME_SAVE_DIRECTORY}/positions.yaml")
@@ -193,6 +197,10 @@ class NumFactory < Gosu::Window
@consumers.each do |consumer|
consumer.update(delta_mult, @camera_x, @camera_y, @camera_zoom)
end
@dialouges.each do |dialouge|
dialouge.update(newtext: "My new text is: #{delta_mult}")
end
end
## Called when OS wants to update window.
@@ -225,6 +233,11 @@ class NumFactory < Gosu::Window
end
end
end
@dialouges.each do |dialouge|
dialouge.draw()
end
Gosu::Image.from_text("#{width}, #{height}", 20).draw(1600, 0, 1)
Gosu::Image.from_text("#{mouse_x}, #{mouse_y}", 20).draw(1600, 100, 1)
Gosu::Image.from_text("Tick time: #{((Time.now() - @tick_time).to_f * 1000).to_i}", 20).draw(1600, 25, 1)