Mercurial > hg > tweakathon2ios
comparison 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 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:a223551fdc1f |
---|---|
1 // | |
2 // xyView.cpp | |
3 // soundspeed | |
4 // | |
5 // Created by Robert Tubb on 20/05/2013. | |
6 // | |
7 // | |
8 | |
9 #include "xyView.h" | |
10 | |
11 void XYView::draw(){ | |
12 | |
13 ofFill(); | |
14 ofNoFill(); | |
15 ofSetColor(0,0,155); | |
16 | |
17 ofRect(screenX, screenY, width, height); | |
18 ofCircle(screenX+ctrlX, screenY+ctrlY, 60); | |
19 // cross hairs | |
20 | |
21 ofLine(screenX+ctrlX - 30, screenY+ctrlY, screenX+ctrlX + 30, screenY+ctrlY); | |
22 ofLine(screenX+ctrlX,screenY+ctrlY - 30,screenX+ctrlX,screenY+ctrlY+30); | |
23 | |
24 } | |
25 | |
26 bool XYView::handleTouch(double x, double y){ | |
27 if(isInMyArea(x,y)){ | |
28 ctrlX = x; | |
29 ctrlY = y; | |
30 | |
31 return true; | |
32 }else{ | |
33 return false; | |
34 } | |
35 | |
36 } | |
37 bool XYView::isInMyArea(int x, int y){ | |
38 return (x > screenX && x < screenX + width && y > screenY && y < screenY + height); | |
39 } |