/**
 * Launcher Sketch for ParVaguesViz
 * 
 * This simple sketch launches the main ParVaguesViz directly,
 * bypassing the GUI launcher issues.
 */

// Array of files to import
String[] fileList = {
  "ParVaguesViz.pde",
  "TrackManager.pde",
  "BreakbeatEvent.pde",
  "Background.pde",
  "Grid.pde",
  "ParticleSystem.pde",
  "GlitchEffect.pde",
  "MetadataSystem.pde",
  "SampleAnalyzer.pde",
  "Processing4Compatibility.pde"
};

void setup() {
  size(400, 300);
  background(0);
  fill(255);
  textAlign(CENTER, CENTER);
  textSize(16);
  text("Launching ParVaguesViz...\nPress any key to begin.", width/2, height/2);
}

void draw() {
  // Just wait for keypress
}

void keyPressed() {
  background(0);
  text("Loading sketch...", width/2, height/2);
  
  // Try to directly launch the main sketch
  try {
    String sketchPath = sketchPath("");
    println("Sketch path: " + sketchPath);
    
    // Inform the user
    println("Attempting to launch ParVaguesViz...");
    println("If there are any errors, they will appear below:");
    
    // Launch the main sketch in this JVM
    PApplet.main("ParVaguesViz");
    
    // Success message
    background(0, 100, 0);
    text("ParVaguesViz launched successfully!\nYou can close this window.", width/2, height/2);
  } 
  catch (Exception e) {
    // Error handling
    background(100, 0, 0);
    text("Error launching sketch:\n" + e.getMessage(), width/2, height/2);
    println("Error: " + e.getMessage());
    e.printStackTrace();
  }
}
