Having Trouble with the get() Function
in
Contributed Library Questions
•
2 years ago
I'm writing a color blending program that will run on my university's multi-touch surface. I first wrote it to run on a computer, with the intention of implementing TUIO later. Currently, it runs perfectly using a mouse, but I'm having some weird problems after implementing TUIO.
In my original program (using the mouse), I've got this code:
Now, I had to change it up a bit when implementing TUIO, but it's essentially the same code:
Now, the problem I'm running into, is that the second piece of code I posted returns black every time (a really big negative integer, around -16777xx or something like that.)
I've checked, and the X and Y values are correct in the second code (no weird values), so I'm really stumped here.
Sorry if that was unclear at all, I can clarify if needed. Does anyone have any idea of what I should do?
In my original program (using the mouse), I've got this code:
- // Executes if the mouse is over one of the circles
- if (overCircle){
- // If so, gets the color of that circle
- c.circleColor = get(mouseX, screen.height-mouseY);
- }
Now, I had to change it up a bit when implementing TUIO, but it's essentially the same code:
- // tcur is the TuioCursor, and the X and Y must be multiplied by the width and height of the screen to get the correct values
- float curX = tcur.getX()*wid;
- float curY = tcur.getY()*hgt;
- // This for loop checks if the current TUIO cursor is over any of the circles
- // This functions the same as the above "if (overCircle)" code
- for (int i = 0; i < circles.size(); i++){
- Circle d = (Circle)circles.get(i);
- // If the TUIO cursor was over one of the circles, gets the color of that circle
- if (d.isOver(curX, curY)){
- c.circleColor = get((int)curX, (int)curY); // These must be cast to int because get() doesn't take float
- break;
- }
- }
Now, the problem I'm running into, is that the second piece of code I posted returns black every time (a really big negative integer, around -16777xx or something like that.)
I've checked, and the X and Y values are correct in the second code (no weird values), so I'm really stumped here.
Sorry if that was unclear at all, I can clarify if needed. Does anyone have any idea of what I should do?
1