Created
January 11, 2012 13:10
-
-
Save osdrv/1594588 to your computer and use it in GitHub Desktop.
processing document object model
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import processing.opengl.*; | |
import document_object.*; | |
Window window; | |
void setup() { | |
this.window = new Window( this, 640, 480, OPENGL ); | |
background( 0 ); | |
MyDocumentObject o = new MyDocumentObject( this ); | |
window.appendChild( o ); | |
} | |
void draw() { | |
window.render(); | |
} | |
class MyDocumentObject extends DocumentObject { | |
public MyDocumentObject( PApplet p ) { | |
super( p ); | |
this.setDim( 50, 50 ); | |
this.setPos( 10, 10 ); | |
} | |
void render() { | |
getApplet().rect( this.getPosX(), this.getPosY(), | |
this.getWidth(), this.getHeight() | |
); | |
super.render(); | |
} | |
void onMouseClick( CatchableMouseEvent e ) { | |
println( "child element captured click!" ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment