move source files to separate folders
This commit is contained in:
parent
e619b9a6df
commit
99b28ecfa3
23 changed files with 34 additions and 34 deletions
34
source/uilayer/CameraMarker.gd
Normal file
34
source/uilayer/CameraMarker.gd
Normal file
|
@ -0,0 +1,34 @@
|
|||
class_name CameraMarker
|
||||
extends Sprite2D
|
||||
|
||||
var size_multiplier:float
|
||||
var w_s:Vector2
|
||||
|
||||
|
||||
# Draws a box represnting the camera view in minimap
|
||||
func _draw():
|
||||
draw_rect(Rect2(-w_s.x/2, -w_s.y/2, w_s.x, w_s.y), Color.GREEN, false, -3.0)
|
||||
|
||||
|
||||
# Rotates the box if camera is rotated
|
||||
func _on_camera_zoom_2d_camera_rotation_changed(new_rotation):
|
||||
self.rotation = new_rotation
|
||||
|
||||
|
||||
# Redraws the box to a different size if camera is zoomed
|
||||
func _on_camera_zoom_2d_camera_zoom_changed(new_zoom_factor):
|
||||
w_s = DisplayServer.window_get_size(0) / size_multiplier
|
||||
w_s.x /= new_zoom_factor
|
||||
w_s.y /= new_zoom_factor
|
||||
queue_redraw()
|
||||
|
||||
|
||||
# Sets the initial size of the camera box, after game is loaded
|
||||
func set_camera_marker() -> void:
|
||||
size_multiplier = Globals.map_size / 32
|
||||
w_s = DisplayServer.window_get_size(0) / size_multiplier
|
||||
|
||||
|
||||
func set_camera_marker_position(pos:Vector2) -> void:
|
||||
#print("marker pos: ", pos)
|
||||
self.position = pos
|
Loading…
Add table
Add a link
Reference in a new issue