|
Author |
Topic: Class loop problems (Read 1686 times) |
|
timjaeger
|
Class loop problems
« on: Apr 7th, 2005, 3:04am » |
|
Hi, I'm trying to get some mouse response from an object of a class I created...It displays properly on the screen, but will not respond to the mouseOver activity (meaning it doesn't change color upon hovering over the center ellipse..) I tried debugging, but can't quite make it do what I want. I'm also not sure whether to call the object from within the void loop() function. Any help or pointers would be great! The example (with sample code) is up at: http://research.calit2.net/solaris/tests/INFO_AESTHETICS_4_6_05c/applet/ index.html
|
|
|
|
eskimoblood
|
Re: Class loop problems
« Reply #1 on: Apr 7th, 2005, 9:38am » |
|
Use the dist() methode to check the distance between the mouse and the center of the your ellipse: Code: if(dist(mouseX,mouseY,x,y)<r) instead of if(overEllipse(X, Y, R, R)) |
|
|
|
|
|
eskimoblood
|
Re: Class loop problems
« Reply #2 on: Apr 7th, 2005, 10:06am » |
|
Some hints: it would be easyer to wrote Node[] chaperts=new Node[14]; void setup(){ String[] ck={"a","b","c","d","e","f","g","h"}; int[] ckCount={3,6,5...}//the number of sections for each course for(int i=0;i<chapters.length;i++){ int courseNumber=i+1; number of the course String s="chapter"+courseNumber;//create the couse name(chapter1, chapter2 ....) String[] c=new String[ckCount[i]]; for(int j=0;j<c.length;j++){//create the sektion array(a course with 3 sektion got an array{"a","b","c"} c[j]=ck[j]; } chapters[i]=new Node(s,c); } } void loop(){ for (int i=0;i<chapters.length;i++){ chaters[i].toWhatyouwnt(); } }
|
|
|
|
|