Added actual images and prepared to add extractors

This commit is contained in:
2026-06-16 21:58:05 -06:00
parent 46d45783f3
commit 564c600150
16 changed files with 121 additions and 20 deletions
+11 -13
View File
@@ -7,7 +7,7 @@ require 'yaml'
require './producer.rb'
require './consumer.rb'
require './dialouge_box.rb'
require './ui.rb'
FONT_PATH = 'assets/font/Cousine-Regular.ttf'
@@ -45,9 +45,8 @@ 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 = []
@ui = UI.new(WIDTH, HEIGHT)
# Load from file or initialize a new game
begin
game_save_data = YAML.load_file("#{GAME_SAVE_DIRECTORY}/positions.yaml")
@@ -188,8 +187,10 @@ class NumFactory < Gosu::Window
@camera_y = [@camera_y, @game_width].min
### ITEMS ###
mouse_used = @ui.update(self.mouse_x, self.mouse_y)
@producers.each do |producer|
producer.update(delta_mult, @camera_x, @camera_y, @camera_zoom, self.mouse_x, self.mouse_y)
producer.update(delta_mult, @camera_x, @camera_y, @camera_zoom, self.mouse_x, self.mouse_y, mouse_used)
end
@belts.each do |belt|
@@ -197,10 +198,7 @@ class NumFactory < Gosu::Window
end
@consumers.each do |consumer|
consumer.update(delta_mult, @camera_x, @camera_y, @camera_zoom, self.mouse_x, self.mouse_y)
end
@dialouges.each do |dialouge|
dialouge.update(0, 0, newtext: "My new text is: #{delta_mult}")
consumer.update(delta_mult, @camera_x, @camera_y, @camera_zoom, self.mouse_x, self.mouse_y, mouse_used)
end
end
@@ -209,9 +207,11 @@ class NumFactory < Gosu::Window
def draw
# Draw mouse coords:
onscreen_items = 0
# TODO: The background does *not* actually need to move. It can just stay
# in one spot and scale... This would make the program load so much faster
# as well as allow for larger maps.
@background.draw(
(((((WIDTH / BOX_SIZE.to_f) / 2.0) - (@camera_x * @camera_zoom)) * (BOX_SIZE))),
((((HEIGHT / BOX_SIZE.to_f) / 2.0) - (@camera_y * @camera_zoom)) * (BOX_SIZE)),
0,
@camera_zoom,
@@ -236,9 +236,7 @@ class NumFactory < Gosu::Window
end
end
@dialouges.each do |dialouge|
dialouge.draw()
end
@ui.draw()
Gosu::Image.from_text("#{width}, #{height}", 20, font: FONT_PATH).draw(1600, 0, 1)
Gosu::Image.from_text("#{mouse_x}, #{mouse_y}", 20, font: FONT_PATH).draw(1600, 100, 1)