DEV Community

conjurer
conjurer

Posted on • Edited on

1

Geometric art | C++

Some geometric art today!
Just some clicks and voila! A great pattern!

Libraries

  • SDL2
  • iostream
  • vector

int main()

User can choose between 2 modes, hence type.
sdl init

main while(1)

Detect if user wants to quit and exit;

Detect a left click on the screen to add edges in the vector, and hence on the screen. Event handler sets the coordinates (x, y).

Mouse movements are tracked on screen for location pointers.

user events
On keypress:

  • c : clear
  • m : connect 2 most recent clicks (type 1)
  • l : connect every point to every other point in vector (type 0)
  • u : undo the last line(s)

Types of connections

Set bg, drawing colors.
Decide pattern according to type.
Update the screen on render.
Wait 1s before returning.
art render

Output

output
The Builder rocks it!

Image of Datadog

How to Diagram Your Cloud Architecture

Cloud architecture diagrams provide critical visibility into the resources in your environment and how they’re connected. In our latest eBook, AWS Solution Architects Jason Mimick and James Wenzel walk through best practices on how to build effective and professional diagrams.

Download the Free eBook

Top comments (0)

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay