2025-05-24 12:27:45 -04:00
2025-05-24 12:26:54 -04:00
2025-05-24 12:27:45 -04:00
2025-05-24 12:26:54 -04:00
2025-05-24 12:15:03 -04:00
2025-05-24 16:01:36 +00:00
2025-05-24 12:15:03 -04:00
2025-05-24 12:26:54 -04:00

Shape Pattern Generator

Description

A simple C++ application that generates an animated grid of colorful shapes (circles, squares, triangles). The patterns are designed to be visually engaging, with repeating but variable sequences, shifting colors, and periodic regeneration of the entire grid.

This project uses Raylib for graphics rendering and CMake for the build system. It's intended as a fun visual toy, particularly inspired by a request for an autistic child who enjoys such patterns.

Features

  • Displays a dynamic grid of shapes (circles, rectangles, triangles).
  • Randomized shape types and base colors for variety.
  • Smooth hue-shifting color animation for each shape.
  • Periodic regeneration of the entire pattern for continuous visual interest.
  • Cross-platform (thanks to Raylib and CMake).
  • Simple to compile and run.

Dependencies

To build and run this project, you'll need the following:

  1. Raylib: A recent version (e.g., 4.5, 5.0).
    • The CMakeLists.txt is configured to find Raylib via find_package (if installed system-wide or CMAKE_PREFIX_PATH is set) or by building it from a raylib subdirectory (e.g., added as a Git submodule).
  2. CMake: Version 3.15 or higher.
  3. C++ Compiler: A C++17 compatible compiler (e.g., Clang, GCC, MSVC).
  4. System Libraries (Mainly for Linux):
    • On Linux, Raylib has dependencies on various X11 and OpenGL libraries. Based on experience and common requirements, you might need to install development packages such as:
      • libx11-dev
      • libxrandr-dev
      • libxinerama-dev
      • libxcursor-dev
      • libxi-dev
      • libgl1-mesa-dev (or equivalent for your OpenGL drivers)
      • libasound2-dev (for audio, though not used in this specific version, Raylib might link it)
      • For Wayland-based systems, dependencies might differ (libwayland-dev, etc.).
    • Please refer to the official Raylib documentation for the most up-to-date and comprehensive list of dependencies for your specific operating system and distribution.

Build Instructions

  1. Clone the Repository: If you have this project in a Git repository, clone it. Otherwise, ensure main.cpp and CMakeLists.txt are in your project's root directory.

  2. Get Raylib:

    • If using find_package: Ensure Raylib is installed where CMake can find it (e.g., system-wide, or by setting CMAKE_PREFIX_PATH during CMake configuration).
    • If building Raylib as a subdirectory: Clone the Raylib library into a subdirectory named raylib within your project root:
      git submodule add [https://github.com/raysan5/raylib.git](https://github.com/raysan5/raylib.git) raylib
      # Or download and extract Raylib source into a 'raylib' folder.
      
  3. Configure with CMake: Create a build directory and run CMake from there. To use Clang:

    mkdir build
    cd build
    cmake .. -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
    
    • If Raylib is installed in a custom location and you're not using the subdirectory method, you might need to tell CMake where to find it:
      cmake .. -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_PREFIX_PATH=/path/to/your/raylib_install_directory
      
  4. Compile the Project: While still in the build directory:

    cmake --build .
    

    Or, you can use make (or ninja, etc., depending on the generator CMake used):

    make
    
  5. Run the Application: The executable will be generated in the build directory (e.g., ShapeGenerator on Linux/macOS, ShapeGenerator.exe on Windows).

    ./ShapeGenerator
    

How to Use

  • Launch the application after building it.
  • A window will appear displaying the animated shape patterns.
  • Press the ESC key to close the application window.

Tinkering

Feel free to modify the source code (main.cpp) to:

  • Change color palettes or animation speeds.
  • Add new shapes or behaviors.
  • Adjust grid size or regeneration timings.
  • Experiment with different Raylib features.

This project was inspired by a desire to create a simple, visually engaging application.

Description
No description provided
Readme GPL-3.0 49 KiB
Languages
C++ 62.8%
CMake 37.2%