added background

This commit is contained in:
2026-06-13 15:49:26 -06:00
parent f629454f45
commit 66c23a39fe
+10
View File
@@ -93,6 +93,15 @@ class NumFactory < Gosu::Window
end end
end # End file loading end # End file loading
@background = Gosu.render(@game_width, @game_height) {
im = Gosu::Image.new('assets/images/background_square.png', {:tileable => true})
(@game_width / 30).to_i.times do |ww|
(@game_height / 30).to_i.times do |hh|
im.draw(ww * 30, hh * 30)
end
end
}
@tick_time = Time.now() @tick_time = Time.now()
@delta_time = 0 @delta_time = 0
@@ -183,6 +192,7 @@ class NumFactory < Gosu::Window
[self.width, (@camera_max_x - @camera_x) * @camera_zoom].min, [self.width, (@camera_max_x - @camera_x) * @camera_zoom].min,
[self.height, (@camera_max_y - @camera_y) * @camera_zoom].min, [self.height, (@camera_max_y - @camera_y) * @camera_zoom].min,
@background_color, 0) @background_color, 0)
@background.draw(0, 0, 0, @camera_zoom, @camera_zoom)
@producers.each do |producer| @producers.each do |producer|
if producer.x <= @camera_max_x && producer.x >= @camera_min_x if producer.x <= @camera_max_x && producer.x >= @camera_min_x
if producer.y <= @camera_max_y && producer.y >= @camera_min_y if producer.y <= @camera_max_y && producer.y >= @camera_min_y