Coordinates in Processing #
Processing similarly to Godot uses pixels for coordinates. The origin (0, 0) is also in the upper left of the window and the coordinate in the lower right is (width-1, height-1).
Coordinates in Godot #
To replicate the same example in Godot, set the window size to 640 by 360 pixels:
Godot > menu Project > Project Settings… > tab General > Display > Window > Width: 640, Height: 360

Set the background to black color.
Godot > menu Project > Project Settings… > tab General > Rendering > Environment > Define Clear Color

Create Node2D called Main with the script attached:
extends Node2D
# Converted from https://processing.org/examples/coordinates.html
# Set the window size to 640 by 360 pixels in
# Godot > menu Project > Project Settings... > tab General > Display > Window > Width: 640, Height: 360
# Set the background to black color in
# Godot > menu Project > Project Settings... > tab General > Rendering > Environment > Define Clear Color
func _draw():
draw_line(Vector2(320,180), Vector2(321,180),Color.white, 1, false)
draw_line(Vector2(320,90), Vector2(321,90),Color.white, 1, false)
draw_line(Vector2(0, 120), Vector2(640, 120), color256(0, 153, 255), 1, false)
var points = [
Vector2(160,36),
Vector2(160+320,36),
Vector2(160+320,288),
Vector2(160,288),
Vector2(160,36)
]
draw_rect(Rect2(160,36,320,288), color256(255,153,0), false)
func color256(r,g,b):
return Color(r/255.0, g/255.0, b/255.0)
You can download the whole zipped Godot project here: 01-Coordinates.zip.