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.
Page Index Toggle Pages: 1
what is p5? (Read 1538 times)
what is p5?
Jan 9th, 2010, 8:59pm
 
Hello.

This may sound like a silly question to some of you. But I've seen lots of example code on here that uses p5. I've heard of the library Control P5. but I am looking for an explination just p5?

Also, I want to build a layout class that can take other classes as input such as buttons sliders. I'm still learning the whole OOP thnig so go easy. But I'm wondering if some can point me to an example that just uses processing syntax.

I always come across cool gui examples but they all seem to be doing clever java tricks that I can't yet grasp. I'm looking to bridge the gap.

thanks in advance,

Dan.
Re: what is p5?
Reply #1 - Jan 9th, 2010, 9:31pm
 
P5 actually just means processing. The name proce55ing was used in the early days, some people still use P5 when they talk about processing. read the FAQ :

Quote:
“Proce55ing” is the spelling we originally used for the URL of the web site, because "Processing" was already taken. Even though it's a combination of numbers and letters, it was always pronounced “processing.” Since then, we saved our pennies, had a can drive, and used the funds to acquire the processing.org domain name. As a result we are no longer using the name “Proce55ing.”

When we see it with the 55's it annoys us and we want to punch people in the face. Or punch ourselves in the face for using it in the first place. Actually, we try not to be that emotional about it but we're trying to avoid the previous naming. However, to make it more confusing, we sometimes still use “p5” (but not p55!) as a shortened version of the name.


Regarding your other question i guess most of what you want to do could be done with controlP5. its a great GUI Library.
If not, what do you mean by "cool gui examples  & clever java tricks" ?
Re: what is p5?
Reply #2 - Jan 10th, 2010, 1:39am
 
Note: some people still use Proce55ing in Web pages, out of habit, or just because it is a clever way to help Google searches... Since the word "processing" is extremely common in computer science, it makes hard to find info about our beloved environment. Using Proce55ing might help in narrowing down the searches. But only when the authors used this name... Smiley
Re: what is p5?
Reply #3 - Jan 10th, 2010, 3:55am
 
Quote:
Regarding your other question i guess most of what you want to do could be done with controlP5. its a great GUI Library.
If not, what do you mean by "cool gui examples  & clever java tricks" ?


Here's one I am interesting in reverse engineering:
http://www.openprocessing.org/visuals/?visualID=6744

I have asked the author but I think he's a bit reluctant to hold my hand as I wade through it (fair enough too).

There are a lots of p5. prefixes through this code. Now that I know the back story, maybe it's just his way of denoting what is java and what is processing in the sketch?

About controlP5. I'm going for quite a custom look. I like the functionaly in Control P5 but I'm not sure if the look and feel (fonts,buttons,ect.) can be customised? I will have a look and see.

Thanks.
Re: what is p5?
Reply #4 - Jan 10th, 2010, 4:32am
 
Quote:
There are a lots of p5. prefixes through this code.
I haven't looked at the code, but I guess it is a variable name holding an instance of ControlP5 instance. You can name it whatever you want, of course.

Quote:
what is java and what is processing
Processing is written in Java, and Processing code is actually Java code with some syntax sugar, so the frontier is quite fuzzy!

Quote:
I'm going for quite a custom look
I don't know well ControlP5 but I think customization isn't its strong point, beside some color changes. Making pluggable look is not trivial, I suppose most control library authors concentrate first on making functionality OK and offering a wide range of controls.
Now, you have the source, so if you are courageous enough, you can hack it until you get the look you want... Smiley
Re: what is p5?
Reply #5 - Jan 10th, 2010, 4:48am
 
Thanks, I had a quick look at the control p5 source. Yikes, I think I need to learn some non-sugar coated Java to move beyond this point. Smiley

As for the functionallity, yes I plan to test functionallity first before making code and visuals look pretty. I've never written a library before, I think I'll just try to sketch it all out first.

Thanks,

Dan.

Re: what is p5?
Reply #6 - Jan 10th, 2010, 5:00am
 
Hello,

I had a look at the example in question.

It uses p5 as a reference to the PApplet.

Its got quite a bit of inheritance in there so it might be worth reading up on inheritance if your new to OOP.

In the main class you make new keyButtons and add them to the WidgetLayout object

e.g  (line 80)
layout.add(new KeyButton(this, tf, '2', "2", baseImage_02, pressImage_02));

the keybutton class inherits from the button class and the button class inherits from the Widget class.

If you look at the constructor inside the widget class

(line 46)
 public Widget(PApplet parent, String label)
 {
   this.p5 = parent;

You can see its assigning a reference to the main PApplet as a local variable.

which is declared on line 5.
public PApplet p5;


Hope this help.
Abe
Smiley


Re: what is p5?
Reply #7 - Jan 10th, 2010, 5:12am
 
Wow thanks Abe,

This helps a lot! It's bed time for me now, but I will mull over this during the week and try to learn more about inheritance.

Thanks again!
Re: what is p5?
Reply #8 - Jan 10th, 2010, 6:29am
 
Here is another GUI library by Quark http://www.lagers.org.uk/g4p/index.html
Re: what is p5?
Reply #9 - Jan 10th, 2010, 6:43am
 
danielt wrote on Jan 10th, 2010, 3:55am:
Here's one I am interesting in reverse engineering:
http://www.openprocessing.org/visuals/?visualID=6744

I have asked the author but I think he's a bit reluctant to hold my hand as I wade through it (fair enough too).

There are a lots of p5. prefixes through this code. Now that I know the back story, maybe it's just his way of denoting what is java and what is processing in the sketch


Hi Dan, sorry for not getting back to you sooner. My dad passed away about 24 hours after my last email, which somewhat changed my focus.

Thanks to others poking around my (naughty) undocumented code to explain how it works.

Indeed, "p5" is a reference to "the sketch" (the main PApplet object), which I think is silly to call "parent", and is used to access the handy functionality provided in the "processing environment", such as all the drawing methods. As .pde files compiled using Processing (the PDE) itself, the classes all end up as "inner classes", and therefore have access to this functionality (since it is in the "outer class" created by Processing for setup(), draw() and so on), but this isn't the case for "normal" Java.

I don't know if this is a non-terrible way to do things, and since I haven't mapped out a plan for other types of related objects (widgets), it's really hard to say whether the object relationship I have is appropriate, and I hope I'm not leading you down a dodgy path! Having said that, I was relatively pleased with what I'd made without any additional research outside of your original program (except for the registerDraw() and similar parts, which I'd only just seen used myself).

-spxl
Page Index Toggle Pages: 1