mirror of
https://github.com/jneug/zeichenmaschine.git
synced 2026-10-12 09:56:33 +02:00
Beispielprojekte
This commit is contained in:
64
examples/zm_tixy/TIXY.java
Normal file
64
examples/zm_tixy/TIXY.java
Normal file
@@ -0,0 +1,64 @@
|
||||
import schule.ngb.zm.DrawableLayer;
|
||||
import schule.ngb.zm.Zeichenmaschine;
|
||||
|
||||
public class TIXY extends Zeichenmaschine {
|
||||
|
||||
public static final int FIELD_SIZE = 16;
|
||||
|
||||
public static final int DOT_SIZE = 16;
|
||||
|
||||
public static final int DOT_GAP = 4;
|
||||
|
||||
|
||||
private Dot[][] dots;
|
||||
|
||||
private MyTIXY tixy;
|
||||
|
||||
public TIXY() {
|
||||
super(
|
||||
DOT_GAP + FIELD_SIZE * (DOT_SIZE + DOT_GAP),
|
||||
DOT_GAP + FIELD_SIZE * (DOT_SIZE + DOT_GAP),
|
||||
"tixy"
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
background.setColor(BLACK);
|
||||
|
||||
addLayer(new DrawableLayer());
|
||||
DrawableLayer dl = canvas.getLayer(DrawableLayer.class);
|
||||
|
||||
tixy = new MyTIXY();
|
||||
|
||||
dots = new Dot[FIELD_SIZE][FIELD_SIZE];
|
||||
for( int i = 0; i < FIELD_SIZE; i++ ) {
|
||||
for( int j = 0; j < FIELD_SIZE; j++ ) {
|
||||
dots[i][j] = new Dot(i, j, i*FIELD_SIZE + j);
|
||||
dl.add(dots[i][j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update( double delta ) {
|
||||
for( int i = 0; i < FIELD_SIZE; i++ ) {
|
||||
for( int j = 0; j < FIELD_SIZE; j++ ) {
|
||||
Dot d = dots[i][j];
|
||||
double value = tixy.update(runtime/1000.0, d.i, d.x, d.y);
|
||||
dots[i][j].setValue(value);
|
||||
|
||||
tixy.update(runtime/1000.0, dots[i][j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void main( String[] args ) {
|
||||
new TIXY();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user