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)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more