[011] Primitive Pixels

[17h] Line & Circle using _draw() & SubViewport

Simple project while trying to learn C++ & Rust
At least it was simple when I started, 
got a lot more complicated than anticipated.

[Sep 28, 2023] 3h
- create lines & circles using _draw()
- creation of my PixelGrid node

[Sep 29, 2023] 5h
- SubViewport image to Bitmap
- creating a Line with only an angle & length
- creating a Circle with only the radius

[Sep 30, 2023] 5h
- individual SubViewport for each shape
- adding colors to each shape
- UI & fixes

[Oct 01, 2023] 4h
- more UI & fixes
- Aseprite Circle
- ItchIO upload


line_angle = rad_to_deg(center_position.angle_to_point(mouse_position))

circle_radius = ceili(center_position.distance_to(mouse_position) / cell_size)

func _draw_line(start_position: Vector2, degree: int, length: int, color: Color) -> void:
    var direction: Vector2 = Vector2.RIGHT.rotated(deg_to_rad(degree))
    var target_pos: Vector2 = start_pos + (direction * length)
    draw_line(start_pos, target_pos, color)

func _draw_circle_line(center_pos: Vector2, radius: int, color: Color) -> void:
    draw_arc(center_pos, radius, 0, TAU, 1000, color) # square-ish circle

_image = _sub_viewport.get_texture().get_image()
_bitmap.create_from_image_alpha(_image, 0.1)
StatusReleased
PlatformsHTML5
AuthorQuietGodot
Made withGodot

Leave a comment

Log in with itch.io to leave a comment.