We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexSuggestions & BugsSoftware,  Documentation,  Website Suggestions › Have Simpler Array Object Calling
Page Index Toggle Pages: 1
Have Simpler Array Object Calling (Read 805 times)
Have Simpler Array Object Calling
Jun 9th, 2007, 1:52am
 
I don't know if you can already do this but it would be simpler if you could call objects from within arrays. For example:


int[] box = {int x = 0, int y = 0, int width = 40}

pushMatrix();
translate(box.x, box.y, 0; //and then call it like this
box(bow.width);
popMatrix();


If that is possible please enlighten me, I've been teswting for a while now.
Re: Have Simpler Array Object Calling
Reply #1 - Jun 9th, 2007, 10:28am
 
No, you can't do that.

You can however create a wrapper class:

Code:
myClass
{
int x,y,width;
myClass int_x, int _y, int _width)
{
x=_x;
y=_y;
width=_width;
}
}

void draw()
{
myClass box=new myClass(0,0,40);
pushMatrix();
translate(box.x,box.y);
box(box.width);
popMatrix();
}
Re: Have Simpler Array Object Calling
Reply #2 - Jun 21st, 2007, 7:09am
 
Nope, that doesn't work, well let me mod it some....
Page Index Toggle Pages: 1