Friday 14 November 2008

Vague outline

Mouse Events

Explain mouse events

explain how processing deals with mouse events
- methods - mousePressed()
- example
- inside the draw method using if statements - mousePressed
- example

variables:
- mouseButton
- example
- mouseX
- mouseY
- example
- pmouseX
- pmouseY
- example

mouseDragged()
- example

mouseMoved()
- example

mouseReleased()
- example

putting it all together
- big example

Sunday 9 November 2008

Chunk 82 Description

CHUNK 82
TITLE Mouse events
DESCRIPTION This is the first part of the book that looks at mouse events. Happily Processing handles such events easily
OUTCOMES
  • Be able to understand how Processing is able to detect and act on mouse events.
  • Be able to develop a program up to 120 lines which relies on mouse events bein caught.
REFERENCE Greenberg 564--570
HINT Don't worry about showing how complex the mouse event code in Java is (Greenberg 564--565) just go straight into a description of the Processing code. Don't use any motion code unless its very simple as we have not covered this in the book
PROGRAM Develop a program similar to the one that you describe in this part of the book.

Monday 3 November 2008

Processing IDEs

Having had a play with the Processing IDE, I started to wonder if I could use Eclipse or NetBeans instead, in order to use the more powerful features of these IDEs. Turns out, you can and it's very easy.

All you need to do is:
  • create a project to work on
  • add the processing core.jar to the project classpath by selecting it, from the downloaded processing directory, in the project's properties
  • create a class that extends processing.core.PApplet
The Processing code then be written as normal, with 1 small exception (so far!) - the inherited setup and draw methods appear to be public, so the overriden methods need to be public as well, ie



import processing.core.PApplet;

public class Main extends PApplet{

public void setup() {
size(200,200);
background(0);
}

public void draw() {

}

Book arrived and chunk order

The processing book finally arrived so I can finally start playing with the IDE. As I'm doing 2 chunks (13 and 82) I've decided to do chunk 82 first, as it looks like fun. I'm hoping I can create something that will react to mouse clicks by displaying some graphics or other