How xtremeaaa/testing works
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│
└───────────┴────────┴───────────┘