Orders are now de/serializable, and scheduleable, Entities now show a circle around themselves when selected and draw a line to their target

This commit is contained in:
2019-10-09 11:32:59 -05:00
parent 2a179ed935
commit d6615872ba
15 changed files with 246 additions and 33 deletions

View File

@@ -8,8 +8,8 @@ class IMICRTS
@velocity = CyberarmEngine::Vector.new(0.0, 0.0)
@zoom = 1.0
@min_zoom = 0.25
@max_zoom = 4.0
@min_zoom = 0.50
@max_zoom = 5.0
@drag = 0.8 # Used to arrest velocity
@grab_drag = 0.5 # Used when camera is panned using middle mouse button
@@ -22,8 +22,6 @@ class IMICRTS
Gosu.clip_to(@viewport.min.x, @viewport.min.y, @viewport.max.x, @viewport.max.y) do
Gosu.transform(*worldspace.elements) do
block.call
Gosu.draw_line(@drag_start.x, @drag_start.y, Gosu::Color::RED, window.mouse.x, window.mouse_x, Gosu::Color::RED, Float::INFINITY) if @drag_start
end
end
end
@@ -98,6 +96,11 @@ class IMICRTS
end
end
def move_to(x, y, zoom)
@position.x, @position.y = x, y
@zoom = zoom
end
def button_down(id)
case id
when Gosu::KB_H
@@ -118,5 +121,9 @@ class IMICRTS
@drag_start = nil
end
end
def to_a
[@position.x, @position.y, @zoom]
end
end
end