I don't know, but good question. (I use processing 3)
Since you use PS3 then you could test it out by trying the code above.
For something as complex as a 'multi-line text input control' implemented as a function is as likely as finding a snowball in the Hell. Classes may seem complicated at first glance but are well worth the effort to learn. In the above code you are not required to create the class it already exists so why not give it a try?
I suggest you start with the tutorials, there is one on objects.
Classes an objects (object orientation) is not something you can learn in 5 minutes but in many instances they can make it easier for you later, especially in large or complex sketches.
just to add take your time with that object tutorial as i did find it very convoluted at first. example is that in the writing the cookie cutter section i didn't realize that they were putting the class data(shown on right side of the picture) in an actual class. it might have just been my eyesight and the yellow throwing me off but i had to move to another language to learn about class based objects because i didn't take my time to read the above link he pointed to.
EDIT: rather i did look through it but i didn't slow down enough.
also think of a class as a blueprint. it's like what it would be like to have a function that has function declarations in it rather than a function that has more function calls. example.
void foo(){
static int x; //static values don't get discarded
void bar(){
}
}
if you could do the above in programming... well that's what a class is like. accept that you can access the inner functions of said class and you have to make an object out of it before you can use it. but this is the general way i had to picture it before i understood what it's purpose was. good luck cause like quark said it takes a while to grasp.
EDIT: i recommend looking up the following to create arrays of objects.
https://processing.org/discourse/beta/num_1243792004.html
and search this in google. "processing multiple objects"
and in case it's not clear an object of a class is like a product coming out of a factory. class being the factory.
and sorry to add another comment but i just remembered something. this is something you might not find out for a very long time cause it's not very much talked about. but "after" you understand the basics of how arrays of class based objects are made (and how child/parent relationships work) than i HIGHLY recommend looking up the following.
"abstract classes" and "instanceof" for java. note instanceof is the same as c++'s dynamic_cast.
Classes an objects (object orientation) is not something you can learn in 5 minutes but in many instances they can make it easier for you later, especially in large or complex sketches.
after a long time, I am now comfortable using classes. Khan Academy (although they modified how some of the coding works) taught me the basics. Then by viewing other classes, I got it! Yay! :P
Answers
http://studio.ProcessingTogether.com/sp/pad/export/ro.9Zo$UbIWYZEDR
This code I copied from the old forum. IT'S NOT MINE. As you can see it is from @calsign
As a side note, can you still use java.awt.event.KeyEvent in Processing 3? If not how would you do it?
thanks, but I'm looking for a function (if possible?) (I don't use classes, the can get to complicated)
thanks, though!
@colouredmirrorball I don't know, but good question. (I use processing 3)
edit: yes.
Since you use PS3 then you could test it out by trying the code above.
For something as complex as a 'multi-line text input control' implemented as a function is as likely as finding a snowball in the Hell. Classes may seem complicated at first glance but are well worth the effort to learn. In the above code you are not required to create the class it already exists so why not give it a try?
@quark ok, how do I?
How do I what?
you can see how the class is used from the code above
all above line 48 is the usage.....
you can't have one function alone because you have to monitor
mousePressed()
andkeyPressed()
and also you have to do stuff indraw()
....use a class. @quark
I suggest you start with the tutorials, there is one on objects.
Classes an objects (object orientation) is not something you can learn in 5 minutes but in many instances they can make it easier for you later, especially in large or complex sketches.
just to add take your time with that object tutorial as i did find it very convoluted at first. example is that in the writing the cookie cutter section i didn't realize that they were putting the class data(shown on right side of the picture) in an actual class. it might have just been my eyesight and the yellow throwing me off but i had to move to another language to learn about class based objects because i didn't take my time to read the above link he pointed to.
EDIT: rather i did look through it but i didn't slow down enough.
also think of a class as a blueprint. it's like what it would be like to have a function that has function declarations in it rather than a function that has more function calls. example.
if you could do the above in programming... well that's what a class is like. accept that you can access the inner functions of said class and you have to make an object out of it before you can use it. but this is the general way i had to picture it before i understood what it's purpose was. good luck cause like quark said it takes a while to grasp. EDIT: i recommend looking up the following to create arrays of objects. https://processing.org/discourse/beta/num_1243792004.html and search this in google. "processing multiple objects" and in case it's not clear an object of a class is like a product coming out of a factory. class being the factory.
and sorry to add another comment but i just remembered something. this is something you might not find out for a very long time cause it's not very much talked about. but "after" you understand the basics of how arrays of class based objects are made (and how child/parent relationships work) than i HIGHLY recommend looking up the following. "abstract classes" and "instanceof" for java. note instanceof is the same as c++'s dynamic_cast.
k, thanks.
after a long time, I am now comfortable using classes. Khan Academy (although they modified how some of the coding works) taught me the basics. Then by viewing other classes, I got it! Yay! :P