#pragma once

#include "ofxPoint2f.h"
#include "ofMain.h"

#include "cardDef.h"
#include "bouncerShape.h"
#include "arFakeMarker.h"
#include "ofxMidi.h"
#include "notes.h"
#include "arPlane.h"

#define SPLIT_OCTAVES true
#define ACES_TELEPORT true
#define REFLECT_FACES true

class testApp;

class singleBouncer{

	public:
		singleBouncer();		
		
		void playNoteFromCard(card & theCard);
		void stopNote();
		void stopAllNotes();

		ofxPoint2f randomOutofFrame();
		
		bool findClosestCardMatchingAngle(vector <card> & cards);
		bool findNextNearestCard(vector <card> & cards);
		void setup(int camW, int camH, int markerSizeMM, int midiChannel, int setCardMode = 0);
		void update(vector <card> & cards, float bounceSpeed, float levitateSpeed);
				
		void drawBounce();
		
		void draw(arPlane * planePtrIn);
		
		void drawNumber();
		void drawNumberShadow();
		
		void drawTeleportOut();
		void drawTeleportOutShadow();

		void drawTeleportIn();
		void drawTeleportInShadow();
		
		void drawReflectOut();
		void drawReflectOutShadow();

		void drawReflectIn();
		void drawReflectInShadow();
		
		arPlane * planePtr;
		
		ofImage ballShadow;
		
		bouncerShape shape;
		card srcCard;
		card dstCard;
		card playingCard;	
		card telePortOutCard;
		card reflectCard;
		
		int playingNumber;
		int currentNote;
		int currentChannel;
		int numCards;
		int theChannel;
		
		bool incomingTeleport;
		bool incomingReflect;
		
		int animationType;
		float levitationAmnt;
		bool hide;
		bool bComingIn;
		
		float hitTime;
		float hitLevel;
		float hitTarget;
		ofPoint target[10];
	
	
		
		int cardMode;
		
		int cameraW;
		int cameraH;
	
		int drawWidth, drawHeight;
	
	
		
		arFakeMarker fakeMarker;
		arFakeMarker telePortMarker;
		arFakeMarker reflectMarker;
		
		ofTrueTypeFont Akzidenz;
		ofxMidiOut midi;	
	
	testApp * theApp;
		
};
