-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCodeGene.pde
More file actions
44 lines (35 loc) · 815 Bytes
/
Copy pathCodeGene.pde
File metadata and controls
44 lines (35 loc) · 815 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
class CodeGene extends Gene {
CodeGene(int wd, int ht) {
super(wd, ht);
}
SimpleStack returnStack = new SimpleStack();
SimpleStack paramStack = new SimpleStack();
void reset() {
returnStack.reset();
paramStack.reset();
}
void step() {
}
// renders to internal buffer
void render() {
// reset the graphics state
pg.beginDraw();
pg.background( 0 );
pg.smooth();
pg.stroke( 255 );
pg.strokeWeight( 3 );
pg.fill( 80 );
pg.beginShape();
resetGeneCounter();
for (int i=0; i < this.active_length; i += 3) {
float x = getNextValue( );
float y = getNextValue( );
x = x * pg.width;
y = y * pg.height;
pg.curveVertex(x, y);
}
pg.endShape(CLOSE);
pg.endDraw();
reflect();
}
}