diff xyView.cpp @ 0:a223551fdc1f

First commit - copy from tweakathlon.
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Fri, 10 Oct 2014 11:46:42 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xyView.cpp	Fri Oct 10 11:46:42 2014 +0100
@@ -0,0 +1,39 @@
+//
+//  xyView.cpp
+//  soundspeed
+//
+//  Created by Robert Tubb on 20/05/2013.
+//
+//
+
+#include "xyView.h"
+
+void XYView::draw(){
+    
+    ofFill();
+    ofNoFill();
+    ofSetColor(0,0,155);
+    
+    ofRect(screenX, screenY, width, height);
+    ofCircle(screenX+ctrlX, screenY+ctrlY, 60);
+    // cross hairs
+
+    ofLine(screenX+ctrlX - 30, screenY+ctrlY, screenX+ctrlX + 30, screenY+ctrlY);
+    ofLine(screenX+ctrlX,screenY+ctrlY - 30,screenX+ctrlX,screenY+ctrlY+30);
+    
+}
+
+bool XYView::handleTouch(double x, double y){
+    if(isInMyArea(x,y)){
+        ctrlX = x;
+        ctrlY = y;
+    
+        return true;
+    }else{
+        return false;
+    }
+    
+}
+bool XYView::isInMyArea(int x, int y){
+    return (x > screenX && x < screenX + width && y > screenY && y < screenY + height);
+}
\ No newline at end of file