# xtremeaaa/testing architecture

> Architecture diagram of the GitHub repository xtremeaaa/testing, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/xtremeaaa/testing
- Repository: https://github.com/xtremeaaa/testing

## Overview

##### Project Type and Purpose
- This is a multimedia interactive Processing sketch (Java-based) for a COMP1050 assignment.
- Purpose: simulate a courtroom scene where clicking on jury members triggers singing/dancing animations, clicking on the Judge stops music and plays a gavel sound, and the Barrister holds a magic wand that follows the cursor.

##### File-Structure Analysis
- Top-level “Main” folder contains .pde source files organized by feature (Barrister, Instrument, Main).
- Main/Barrister – classes for the wand-wielding barrister.
- Main/Instrument – singer/dancer sketch and properties.
- Main/Main – core entities: Judge, Jury, Singer, main sketch.
- sketch.properties configure Processing runtime.

##### Key Architecture Insights from README
- Entities: Barrister, Judge, Jury/Singer.
- Interactions: Mouse events → audio playback & animations.
- Requirements emphasize event handling, state reset, and real-time cursor tracking.

##### Main Components
A. Processing Core (PApplet)
B. AssetManager
– Loads audio files & images at startup.
C. InputHandler
– Captures mouse movements & clicks.
D. Entity Modules
1. Barrister
- Wand orientation logic (follows cursor).
2. Judge
- On‐click: calls AudioSystem.stopAll(); AudioSystem.play(gavel).
3. Jury/Singer
- On‐click: play assigned song; trigger AnimationSystem.wave().
E. AudioSystem
– play(), stop(), manage channels.
F. AnimationSystem
– state machines for wave animation; reset to idle.
G. Render Loop

##### Relationships & Data Flow
- AssetManager → loads media → supplies AudioSystem & Entity modules.
- InputHandler → dispatches events → Entity Modules.
- Entity Modules ↔ AudioSystem & AnimationSystem.

##### Architectural Patterns & Principles
- Single responsibility per module (loading, input, audio, animation, rendering).
- Event-driven architecture (mouse events → handlers).
- Separation of concerns: Asset loading vs. logic vs. rendering.

##### ASCII Sketch

┌─────────────────────────────┐
│        (PApplet)            │
└───────────┬─────────────────┘
│
mouseMove│     mouseClick
▼
┌─────────────────────────────┐           ┌───────────────────┐
│      InputHandler          │──────────▶│  Entity Modules   │
└───────────┬─────────────────┘           └───┬─────────┬─────┘
│                                  │         │
load assets│                                  │         │
▼                                  │         │
┌─────────────────────────────┐                 │         │
│        AssetManager        │◀────────────────┘         │
└───────────┬─────────────────┘                           │
│                                          invoke
provides   │                                          │
audio/images  ▼                                          ▼
┌─────────────────────────────┐        ┌─────────────────────────┐
│      AudioSystem           │        │    AnimationSystem      │
└─────────────────────────────┘        └─────────────────────────┘

Entity Modules expand to:
┌───────────┬────────┬───────────┐
│Barrister  │ Judge  │ Jury/Singer│
└───────────┴────────┴───────────┘

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Framework Layer
    subgraph "Framework"
        ProcessingCore["Processing Core<br>(PApplet)"]:::framework
        RenderLoop["Render Loop<br>(setup(), draw())"]:::framework
    end

    %% Event Handling
    subgraph "Event Handling"
        InputHandler["InputHandler<br>(mousePressed(), mouseMoved())"]:::event
    end

    %% Shared Services
    subgraph "Shared Services"
        AssetManager["AssetManager<br>(loads audio/images)"]:::service
        AudioSystem["AudioSystem<br>(play(), stop())"]:::service
        AnimationSystem["AnimationSystem<br>(animate(), reset())"]:::service
    end

    %% Entity Modules
    subgraph "Entities"
        Barrister["Barrister Module"]:::entity
        Judge["Judge Module"]:::entity
        JurySinger["Jury/Singer Module"]:::entity
    end

    %% Legend
    Legend["Legend:\nYellow: Framework\nOrange: Event Handling\nBlue: Shared Services\nGreen: Entities"]:::legend

    %% Connections
    ProcessingCore -->|"loadAssets"| AssetManager
    ProcessingCore -->|"initialize loop"| RenderLoop
    ProcessingCore -->|"mouse events"| InputHandler
    RenderLoop -->|"draw() calls"| Barrister
    RenderLoop -->|"draw() calls"| Judge
    RenderLoop -->|"draw() calls"| JurySinger

    InputHandler -->|"mouseMove / mouseClick"| Barrister
    InputHandler -->|"mouseClick"| Judge
    InputHandler -->|"mouseClick"| JurySinger

    AssetManager -->|"provides media"| AudioSystem
    AssetManager -->|"provides media"| AnimationSystem

    Barrister -->|"uses"| AudioSystem
    Barrister -->|"uses"| AnimationSystem
    Judge -->|"uses"| AudioSystem
    Judge -->|"uses"| AnimationSystem
    JurySinger -->|"uses"| AudioSystem
    JurySinger -->|"uses"| AnimationSystem

    classDef framework fill:#ffffcc,stroke:#333,stroke-width:1px
    classDef event fill:#ffeb99,stroke:#333,stroke-width:1px
    classDef service fill:#cce5ff,stroke:#333,stroke-width:1px
    classDef entity fill:#d4edda,stroke:#333,stroke-width:1px
    classDef legend fill:#ffffff,stroke:#000,stroke-width:1px,font-size:10px

    %% Click Events
    click ProcessingCore "https://github.com/xtremeaaa/testing/blob/main/Main/main.pde"
    click ProcessingCore "https://github.com/xtremeaaa/testing/blob/main/Main/Main/Main_File.pde"
    click RenderLoop "https://github.com/xtremeaaa/testing/blob/main/Main/Main/Main_File.pde"
    click AssetManager "https://github.com/xtremeaaa/testing/tree/main/Media/"
    click AssetManager "https://github.com/xtremeaaa/testing/blob/main/Media/Barrister/Audio/gavel.mp3"
    click AssetManager "https://github.com/xtremeaaa/testing/tree/main/Media/Instrument/Audio/"
    click AssetManager "https://github.com/xtremeaaa/testing/tree/main/Media/Instrument/GIF/"
    click AssetManager "https://github.com/xtremeaaa/testing/tree/main/Media/Instrument/PNG/"
    click AssetManager "https://github.com/xtremeaaa/testing/tree/main/Media/Instrument/SVG/"
    click InputHandler "https://github.com/xtremeaaa/testing/blob/main/Main/Main/Main_File.pde"
    click Barrister "https://github.com/xtremeaaa/testing/blob/main/Main/Barrister/Barrister.pde"
    click Barrister "https://github.com/xtremeaaa/testing/blob/main/Main/Barrister/main_Barrister.pde"
    click Judge "https://github.com/xtremeaaa/testing/blob/main/Main/Main/Judge.pde"
    click JurySinger "https://github.com/xtremeaaa/testing/blob/main/Main/Main/Jury.pde"
    click JurySinger "https://github.com/xtremeaaa/testing/blob/main/Main/Main/Singer.pde"
```
