Added Glitch Room Source code to Gitty
This commit is contained in:
commit
1ac9eb5644
505 files changed
+28504
No files matched your search
@@ -0,0 +1,19 @@
|
||||
@tool
|
||||
extends Node2D
|
||||
const LOGICAL := Vector2(224,256)
|
||||
var destination := Rect2(0,0,672,768)
|
||||
func _process(_delta: float) -> void:
|
||||
var available := get_viewport_rect().size if not Engine.is_editor_hint() else Vector2(672,768)
|
||||
var factor := minf(available.x/7.0,available.y/8.0)
|
||||
var size := Vector2(7,8)*factor
|
||||
destination = Rect2((available-size)*.5,size)
|
||||
queue_redraw()
|
||||
func to_logical(point: Vector2) -> Vector2:
|
||||
return (point-destination.position)/destination.size*LOGICAL
|
||||
func to_logical_delta(delta: Vector2) -> Vector2:
|
||||
return delta/destination.size*LOGICAL
|
||||
func _draw() -> void:
|
||||
draw_rect(Rect2(Vector2.ZERO,get_viewport_rect().size),Color.BLACK)
|
||||
if has_node("../PixelScreen"):
|
||||
draw_texture_rect(get_node("../PixelScreen").get_texture(),destination,false)
|
||||
|
||||
Reference in new issue
Block a user