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.
IndexProgramming Questions & HelpOther Libraries › HELP:Jbox2d-custom render through ruby-processing
Page Index Toggle Pages: 1
HELP:Jbox2d-custom render through ruby-processing (Read 1454 times)
HELP:Jbox2d-custom render through ruby-processing
Oct 15th, 2009, 2:07am
 
opened the same in more ruby related area:here
Good day experts,

My goal is simply to change the color , or even better to get the shapes transparent.
As the topic says already: I can’t get the custom rendering method work with ruby-processing.
When I try to override the method I get an error like: become sure that you have an argument “World” in the method.
Now I definded the method simply like this:
def custom_rendering(world)
..stuff
end

Now I think the problem is because in ruby you usually do not type arguments(or I don’t know how to do that) and world is not clearly typed as an World class.
Hope somebody can help me and many thanks in advance.

br
Re: HELP:Jbox2d-custom render through ruby-processing
Reply #1 - Oct 15th, 2009, 2:48am
 
You should ask the question in Processing Implementations, that's where most Ruby-related questions are asked.
Re: HELP:Jbox2d-custom render through ruby-processing
Reply #2 - Oct 15th, 2009, 3:07am
 
kay, i will...do you know if there is another way to change the color instead of the custom rendering ?
Re: HELP:Jbox2d-custom render through ruby-processing
Reply #3 - Oct 15th, 2009, 5:07am
 
Well, custom rendering is precisely made for that, to change color (or texture, border, etc.).
That's either that, or hack BoxWrap2D's default rendering...
Re: HELP:Jbox2d-custom render through ruby-processing
Reply #4 - Oct 15th, 2009, 5:34am
 
Sure..but why the hack there’s no atribute for that ? would be so extremly easy to just add the color to an shape…
Re: HELP:Jbox2d-custom render through ruby-processing
Reply #5 - Oct 15th, 2009, 6:03am
 
Well, it is a question of library design...
It is made to be flexible, at the cost of some sweat from the developer: you can do half the shapes of one color, the other half with another color, etc.
Your problem is that setCustomRenderingMethod method takes a method name, then use Java reflection to get the reference of this function.
I don't know if you can make in Ruby a function with the right Java signature.

If you cannot, you can try an alternative (untested!):
- define a class extending Physics;
- override there the method defaultDraw() which takes a World parameter, with your custom rendering routine.
Re: HELP:Jbox2d-custom render through ruby-processing
Reply #6 - Oct 15th, 2009, 8:27am
 
cool man, I will try that.btw:what are you working on right now and for what competition ? just interested Wink
Re: HELP:Jbox2d-custom render through ruby-processing
Reply #7 - Oct 15th, 2009, 9:18am
 
Oh, the competition has ended, and I didn't won... Smiley
See JavaFX: 3000 Chars for a Crystal Clock for some details.
Page Index Toggle Pages: 1