mirror of
https://github.com/cyberarm/i-mic-rts.git
synced 2025-12-14 07:12:34 +00:00
Almost have mouse picking working when zoomed
This commit is contained in:
@@ -35,7 +35,7 @@ class IMICRTS
|
||||
end
|
||||
|
||||
def mouse_pick(x, y)
|
||||
mouse = CyberarmEngine::Vector.new(x, y)
|
||||
mouse = CyberarmEngine::Vector.new(x, y) / @zoom
|
||||
|
||||
normalized = (mouse / @zoom - @position / @zoom) * @zoom
|
||||
normalized.x = normalized.x.floor
|
||||
@@ -58,6 +58,10 @@ class IMICRTS
|
||||
(vec1 - vec2) * factor.clamp(0.0, 1.0)
|
||||
end
|
||||
|
||||
def aspect_ratio
|
||||
window.height / window.width.to_f
|
||||
end
|
||||
|
||||
def move
|
||||
@velocity.x += @scroll_speed * window.dt if Gosu.button_down?(Gosu::KB_LEFT) || window.mouse_x < 15
|
||||
@velocity.x -= @scroll_speed * window.dt if Gosu.button_down?(Gosu::KB_RIGHT) || window.mouse_x > window.width - 15
|
||||
|
||||
Reference in New Issue
Block a user