Pilou wrote:Have you somewhere the link for "how use your stuff" with Verve?
Concrete use of Processing (?) inside Verve! A complete tuto even very simple! From A to Z!
Hi Pilou, what i do with Processing is basically programming moves of the mouse pointer and mouse clicks, it works with Verve but would work above any painting program or other application with a GUI. Also I know from a friend that you could do the same with Python instead of Processing if you prefer.
In order to make a stroke on a painting application, you just need to program this :
1. A mouse move to where you want to begin the stroke
2. A left mouse button click ON
3. A mouse move to where you want to end your stroke
4. A left mouse button click OFF
Et voilĂ .
The first post of this thread gives the trick on how to use the JAVA Robot Class in Processing, this class has all the necessary to control the mouse (moves, clicks) and also the keyboard (e.g. Ctrl key to erase in Verve) :
viewtopic.php?p=11070#p11070Note that unlike the circle example, you don't need to code into the draw(), coding into setup() is what we want most of the time.
For a single stroke in 4 steps as explained above, this is the corresponding code in Processing :
- Code:
import java.awt.Robot; // for mouse moves
import java.awt.event.InputEvent; // for mouse clics
import java.awt.event.KeyEvent; // for keyboard e.g. rbt.keyPress(KeyEvent.VK_CONTROL);
Robot rbt;
void setup(){
try {
rbt = new Robot();
} catch(Exception e) {
e.printStackTrace();
}
// start :
rbt.delay(3000); // wait 3 seconds to give the time to Alt+TAB to Verve
rbt.setAutoDelay(60); // set some delay between every Robot action
// 1. move the mouse to the center of the HD screen
rbt.mouseMove(1920/2, 1080/2);
// 2. press left mouse button to begin painting
rbt.mousePress(InputEvent.BUTTON1_MASK);
// 3. move the mouse to the end of wanted line
rbt.mouseMove(1920/2 + 100, 1080/2 - 100);
// 4. release left mouse button to stop painting
rbt.mouseRelease(InputEvent.BUTTON1_MASK);
}
Don't forget to switch to Verve once the Processing sketch is launched (Alt+TAB), otherwise the mouse pointer will go and click on... whatever is on your window !
Of course having a knowledge of Processing programming is a prerequisite to go beyond, for those who don't know programming or Processing I can advice a really good book*, and after that I can guide for the specifics (e.g. a way to change color on Verve GUI, the stroke size, and so on). Please let me know when you are at this stage.
Regards,
GBoGBo
(*)
http://learningprocessing.com/You may find the first edition when searching "learning processing pdf" on google to have a glance, but i recommend to buy the book of course, to retribute the author for this great resource to learn programming and OOP basics