package com.d2fn.passage.cards;

import com.d2fn.passage.Sketch;
import processing.event.KeyEvent;
import processing.event.MouseEvent;

import java.awt.event.MouseWheelEvent;

/**
 * CardSketch
 * @author Dietrich Featherston
 */
public abstract class CardSketch extends Sketch {

    protected Card<?, ?> card;

    @Override
    public void renderFrame() {
        if(card.done()) {
            card = card.next();
        }
        card.renderFrame();
    }

    @Override
    public void mouseWheelMoved(MouseWheelEvent e) {
        card.mouseWheelMoved(e);
    }

    @Override
    public void mousePressed() {
        card.mousePressed();
    }

    @Override
    public void mousePressed(MouseEvent event) {
        card.mousePressed(event);
    }

    @Override
    public void mouseReleased() {
        card.mouseReleased();
    }

    @Override
    public void mouseReleased(MouseEvent event) {
        card.mouseReleased(event);
    }

    @Override
    public void mouseClicked() {
        card.mouseClicked();
    }

    @Override
    public void mouseClicked(MouseEvent event) {
        card.mouseClicked(event);
    }

    @Override
    public void mouseDragged() {
        card.mouseDragged();
    }

    @Override
    public void mouseDragged(MouseEvent event) {
        card.mouseDragged(event);
    }

    @Override
    public void mouseMoved() {
        card.mouseMoved();
    }

    @Override
    public void mouseMoved(MouseEvent event) {
        card.mouseMoved(event);
    }

    @Override
    public void mouseEntered() {
        card.mouseEntered();
    }

    @Override
    public void mouseEntered(MouseEvent event) {
        card.mouseEntered(event);
    }

    @Override
    public void mouseExited() {
        card.mouseExited();
    }

    @Override
    public void mouseExited(MouseEvent event) {
        card.mouseExited(event);
    }

    @Override
    public void mouseWheel() {
        card.mouseWheel();
    }

    @Override
    public void mouseWheel(MouseEvent event) {
        card.mouseWheel(event);
    }

    @Override
    public void keyPressed(KeyEvent e) {
        card.keyPressed(e);
    }
}

@@ -296,21 +296,15 @@
 Card
-%3C?, ?%3E
  card;%0A
+
 %0A   
@@ -508,32 +508,66 @@
 WheelEvent e) %7B%0A
+        super.mouseWheelMoved(e);%0A
         card.mou
@@ -629,32 +629,62 @@
 ousePressed() %7B%0A
+        super.mousePressed();%0A
         card.mou
@@ -758,32 +758,67 @@
 eEvent event) %7B%0A
+        super.mousePressed(event);%0A
         card.mou
@@ -882,32 +882,63 @@
 useReleased() %7B%0A
+        super.mouseReleased();%0A
         card.mou
@@ -1014,32 +1014,68 @@
 eEvent event) %7B%0A
+        super.mouseReleased(event);%0A
         card.mou
@@ -1143,24 +1143,54 @@
 Clicked() %7B%0A
+        super.mouseClicked();%0A
         card
@@ -1268,32 +1268,67 @@
 eEvent event) %7B%0A
+        super.mouseClicked(event);%0A
         card.mou
@@ -1395,24 +1395,54 @@
 Dragged() %7B%0A
+        super.mouseDragged();%0A
         card
@@ -1520,32 +1520,67 @@
 eEvent event) %7B%0A
+        super.mouseDragged(event);%0A
         card.mou
@@ -1645,24 +1645,52 @@
 seMoved() %7B%0A
+        super.mouseMoved();%0A
         card
@@ -1764,32 +1764,65 @@
 eEvent event) %7B%0A
+        super.mouseMoved(event);%0A
         card.mou
@@ -1887,24 +1887,54 @@
 Entered() %7B%0A
+        super.mouseEntered();%0A
         card
@@ -2012,32 +2012,67 @@
 eEvent event) %7B%0A
+        super.mouseEntered(event);%0A
         card.mou
@@ -2138,24 +2138,53 @@
 eExited() %7B%0A
+        super.mouseExited();%0A
         card
@@ -2260,32 +2260,66 @@
 eEvent event) %7B%0A
+        super.mouseExited(event);%0A
         card.mou
@@ -2383,24 +2383,52 @@
 seWheel() %7B%0A
+        super.mouseWheel();%0A
         card
@@ -2502,32 +2502,65 @@
 eEvent event) %7B%0A
+        super.mouseWheel(event);%0A
         card.mou
@@ -2588,32 +2588,32 @@
 %0A%0A    @Override%0A
-
     public void 
@@ -2629,32 +2629,61 @@
 d(KeyEvent e) %7B%0A
+        super.keyPressed(e);%0A
         card.key

call base interaction events before delegating to current card