04.04.2013 Views

Processing: Creative Coding and Computational Art

Processing: Creative Coding and Computational Art

Processing: Creative Coding and Computational Art

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

single, double, quad pane<br />

int style = 0;<br />

//constants<br />

final static int SINGLE = 0;<br />

final static int DOUBLE = 1;<br />

final static int QUAD = 2;<br />

// constructor 1<br />

Window(int w, int h){<br />

this.w = w;<br />

this.h = h;<br />

}<br />

// constructor 2<br />

Window(int w, int h, int style){<br />

this.w = w;<br />

this.h = h;<br />

this.style = style;<br />

}<br />

// constructor 3<br />

Window(int w, int h, boolean hasSash, int style){<br />

this.w = w;<br />

this.h = h;<br />

this.hasSash = hasSash;<br />

this.style = style;<br />

}<br />

// draw the window<br />

void drawWindow(int x, int y) {<br />

//local variables<br />

int margin = 0;<br />

int winHt = 0;<br />

int winWdth = 0;<br />

if (hasSash){<br />

margin = w/15;<br />

}<br />

switch(style){<br />

case 0:<br />

//outer window (sash)<br />

rect(x, y, w, h);<br />

//inner window<br />

rect(x+margin, y+margin, w-margin*2, h-margin*2);<br />

break;<br />

case 1:<br />

winHt = (h-margin*3)/2;<br />

//outer window (sash)<br />

rect(x, y, w, h);<br />

SHAPES<br />

387<br />

9

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!