com.jtransc.game.util.IntArray2 Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jtransc-media-game Show documentation
Show all versions of jtransc-media-game Show documentation
JVM AOT compiler currently generating Javascript and Haxe, with initial focus on Kotlin and games.
package com.jtransc.game.util;
public class IntArray2 {
public final int width;
public final int height;
public final int[] values;
public interface Generator {
T generate();
}
public IntArray2(int width, int height) {
this.width = width;
this.height = height;
this.values = new int[width * height];
}
private int index(int x, int y) {
return y * width + x;
}
public int get(int x, int y) {
return values[index(x, y)];
}
public void set(int x, int y, int value) {
values[index(x, y)] = value;
}
}