Updated pom.xml

This commit is contained in:
Andrea Cavalli 2018-10-14 22:32:08 +02:00
parent 5e1d1dde52
commit 971759a6e7
18 changed files with 502 additions and 512 deletions

2
Flow

@ -1 +1 @@
Subproject commit 4ec16b0e2d49da9771503e713604f5641ef6c414
Subproject commit 9acbcc2e0af4961688490eb3447d990d157a46a8

View File

@ -6,10 +6,9 @@
<parent>
<groupId>it.cavallium</groupId>
<artifactId>warppi</artifactId>
<version>${project.version}</version>
<version>0.9.0a2</version>
</parent>
<artifactId>warppi-core</artifactId>
<packaging>bundle</packaging>
<name>WarpPI Calculator Core</name>
<description>WarpPI Calculator core project</description>
@ -46,16 +45,8 @@
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Import-Package>*</Import-Package>
<Export-Package>it.cavallium.warppi.*</Export-Package>
<Bundle-SymbolicName>warppi-core</Bundle-SymbolicName>
</instructions>
</configuration>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>

View File

@ -1,11 +1,11 @@
package it.cavallium.warppi.extra.tetris;
public enum BlockColor {
RED,
GREEN,
BLUE,
YELLOW,
ORANGE,
PURPLE,
CYAN
}
package it.cavallium.warppi.extra.tetris;
public enum BlockColor {
RED,
GREEN,
BLUE,
YELLOW,
ORANGE,
PURPLE,
CYAN
}

View File

@ -1,126 +1,126 @@
package it.cavallium.warppi.extra.tetris;
public abstract class Tetromino {
private byte x, y, rotation;
private final TetrominoType type;
public final boolean o = false, w = true;
public Tetromino(byte x, byte y, byte rotation, TetrominoType type) {
super();
this.x = x;
this.y = y;
this.rotation = rotation;
this.type = type;
}
public byte getX() {
return x;
}
public void setX(byte x) {
this.x = x;
}
public byte getY() {
return y;
}
public void setY(byte y) {
this.y = y;
}
public byte getRotation() {
return rotation;
}
public void setRotation(byte rotation) {
this.rotation = rotation;
}
public TetrominoType getType() {
return type;
}
public BlockColor getColor() {
switch(type) {
case I_CYAN:
return BlockColor.CYAN;
case J_BLUE:
return BlockColor.BLUE;
case L_ORANGE:
return BlockColor.ORANGE;
case O_YELLOW:
return BlockColor.YELLOW;
case S_GREEN:
return BlockColor.GREEN;
case T_PURPLE:
return BlockColor.PURPLE;
case Z_RED:
return BlockColor.RED;
default:
return BlockColor.RED;
}
}
public void draw(BlockColor[] grid, final int WIDTH) {
boolean[] blockGrid = getRenderedBlock();
final int tetrominoGridSize = getTetrominoGridSize();
final int centerOffset = (int) Math.floor((double)tetrominoGridSize/2d);
final BlockColor type = getColor();
for (int bx = 0; bx < tetrominoGridSize; bx++) {
for (int by = 0; by < tetrominoGridSize; by++) {
if (blockGrid[bx+by*tetrominoGridSize] == w) {
final int index = x+bx-centerOffset + (y+by-centerOffset) * WIDTH;
if (index < grid.length && index >= 0) {
grid[index] = type;
}
}
}
}
}
public void fixInitialPosition() {
this.y -= (byte) (this.getTetrominoGridSize()/2);
}
public abstract int getTetrominoGridSize();
protected abstract boolean[] getRenderedBlock();
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + rotation;
result = prime * result + ((type == null) ? 0 : type.hashCode());
result = prime * result + x;
result = prime * result + y;
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Tetromino other = (Tetromino) obj;
if (rotation != other.rotation)
return false;
if (type != other.type)
return false;
if (x != other.x)
return false;
if (y != other.y)
return false;
return true;
}
@Override
public String toString() {
return "Tetromino = {\n\t\"x\": \"" + x + "\",\n\ty\": \"" + y + "\",\n\trotation\": \"" + rotation + "\",\n\ttype\": \"" + type + "\"\n}";
}
}
package it.cavallium.warppi.extra.tetris;
public abstract class Tetromino {
private byte x, y, rotation;
private final TetrominoType type;
public final boolean o = false, w = true;
public Tetromino(byte x, byte y, byte rotation, TetrominoType type) {
super();
this.x = x;
this.y = y;
this.rotation = rotation;
this.type = type;
}
public byte getX() {
return x;
}
public void setX(byte x) {
this.x = x;
}
public byte getY() {
return y;
}
public void setY(byte y) {
this.y = y;
}
public byte getRotation() {
return rotation;
}
public void setRotation(byte rotation) {
this.rotation = rotation;
}
public TetrominoType getType() {
return type;
}
public BlockColor getColor() {
switch(type) {
case I_CYAN:
return BlockColor.CYAN;
case J_BLUE:
return BlockColor.BLUE;
case L_ORANGE:
return BlockColor.ORANGE;
case O_YELLOW:
return BlockColor.YELLOW;
case S_GREEN:
return BlockColor.GREEN;
case T_PURPLE:
return BlockColor.PURPLE;
case Z_RED:
return BlockColor.RED;
default:
return BlockColor.RED;
}
}
public void draw(BlockColor[] grid, final int WIDTH) {
boolean[] blockGrid = getRenderedBlock();
final int tetrominoGridSize = getTetrominoGridSize();
final int centerOffset = (int) Math.floor((double)tetrominoGridSize/2d);
final BlockColor type = getColor();
for (int bx = 0; bx < tetrominoGridSize; bx++) {
for (int by = 0; by < tetrominoGridSize; by++) {
if (blockGrid[bx+by*tetrominoGridSize] == w) {
final int index = x+bx-centerOffset + (y+by-centerOffset) * WIDTH;
if (index < grid.length && index >= 0) {
grid[index] = type;
}
}
}
}
}
public void fixInitialPosition() {
this.y -= (byte) (this.getTetrominoGridSize()/2);
}
public abstract int getTetrominoGridSize();
protected abstract boolean[] getRenderedBlock();
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + rotation;
result = prime * result + ((type == null) ? 0 : type.hashCode());
result = prime * result + x;
result = prime * result + y;
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Tetromino other = (Tetromino) obj;
if (rotation != other.rotation)
return false;
if (type != other.type)
return false;
if (x != other.x)
return false;
if (y != other.y)
return false;
return true;
}
@Override
public String toString() {
return "Tetromino = {\n\t\"x\": \"" + x + "\",\n\ty\": \"" + y + "\",\n\trotation\": \"" + rotation + "\",\n\ttype\": \"" + type + "\"\n}";
}
}

View File

@ -1,48 +1,48 @@
package it.cavallium.warppi.extra.tetris;
public class TetrominoICyan extends Tetromino {
public TetrominoICyan(byte x, byte y, byte rotation) {
super(x, y, rotation, TetrominoType.I_CYAN);
}
@Override
public int getTetrominoGridSize() {
return 4;
}
@Override
public boolean[] getRenderedBlock() {
switch(getRotation()) {
case 0:
return new boolean[] {
o,o,o,o,
w,w,w,w,
o,o,o,o,
o,o,o,o
};
case 1:
return new boolean[] {
o,o,w,o,
o,o,w,o,
o,o,w,o,
o,o,w,o
};
case 2:
return new boolean[] {
o,o,o,o,
o,o,o,o,
w,w,w,w,
o,o,o,o
};
case 3:
return new boolean[] {
o,w,o,o,
o,w,o,o,
o,w,o,o,
o,w,o,o
};
default:
throw new NullPointerException();
}
}
}
package it.cavallium.warppi.extra.tetris;
public class TetrominoICyan extends Tetromino {
public TetrominoICyan(byte x, byte y, byte rotation) {
super(x, y, rotation, TetrominoType.I_CYAN);
}
@Override
public int getTetrominoGridSize() {
return 4;
}
@Override
public boolean[] getRenderedBlock() {
switch(getRotation()) {
case 0:
return new boolean[] {
o,o,o,o,
w,w,w,w,
o,o,o,o,
o,o,o,o
};
case 1:
return new boolean[] {
o,o,w,o,
o,o,w,o,
o,o,w,o,
o,o,w,o
};
case 2:
return new boolean[] {
o,o,o,o,
o,o,o,o,
w,w,w,w,
o,o,o,o
};
case 3:
return new boolean[] {
o,w,o,o,
o,w,o,o,
o,w,o,o,
o,w,o,o
};
default:
throw new NullPointerException();
}
}
}

View File

@ -1,44 +1,44 @@
package it.cavallium.warppi.extra.tetris;
public class TetrominoJBlue extends Tetromino {
public TetrominoJBlue(byte x, byte y, byte rotation) {
super(x, y, rotation, TetrominoType.J_BLUE);
}
@Override
public int getTetrominoGridSize() {
return 3;
}
@Override
public boolean[] getRenderedBlock() {
switch(getRotation()) {
case 0:
return new boolean[] {
w,o,o,
w,w,w,
o,o,o
};
case 1:
return new boolean[] {
o,w,w,
o,w,o,
o,w,o
};
case 2:
return new boolean[] {
o,o,o,
w,w,w,
o,o,w
};
case 3:
return new boolean[] {
o,w,o,
o,w,o,
w,w,o
};
default:
throw new NullPointerException();
}
}
}
package it.cavallium.warppi.extra.tetris;
public class TetrominoJBlue extends Tetromino {
public TetrominoJBlue(byte x, byte y, byte rotation) {
super(x, y, rotation, TetrominoType.J_BLUE);
}
@Override
public int getTetrominoGridSize() {
return 3;
}
@Override
public boolean[] getRenderedBlock() {
switch(getRotation()) {
case 0:
return new boolean[] {
w,o,o,
w,w,w,
o,o,o
};
case 1:
return new boolean[] {
o,w,w,
o,w,o,
o,w,o
};
case 2:
return new boolean[] {
o,o,o,
w,w,w,
o,o,w
};
case 3:
return new boolean[] {
o,w,o,
o,w,o,
w,w,o
};
default:
throw new NullPointerException();
}
}
}

View File

@ -1,44 +1,44 @@
package it.cavallium.warppi.extra.tetris;
public class TetrominoLOrange extends Tetromino {
public TetrominoLOrange(byte x, byte y, byte rotation) {
super(x, y, rotation, TetrominoType.L_ORANGE);
}
@Override
public int getTetrominoGridSize() {
return 3;
}
@Override
public boolean[] getRenderedBlock() {
switch(getRotation()) {
case 0:
return new boolean[] {
o,o,w,
w,w,w,
o,o,o
};
case 1:
return new boolean[] {
o,w,o,
o,w,o,
o,w,w
};
case 2:
return new boolean[] {
o,o,o,
w,w,w,
w,o,o
};
case 3:
return new boolean[] {
w,w,o,
o,w,o,
o,w,o
};
default:
throw new NullPointerException();
}
}
}
package it.cavallium.warppi.extra.tetris;
public class TetrominoLOrange extends Tetromino {
public TetrominoLOrange(byte x, byte y, byte rotation) {
super(x, y, rotation, TetrominoType.L_ORANGE);
}
@Override
public int getTetrominoGridSize() {
return 3;
}
@Override
public boolean[] getRenderedBlock() {
switch(getRotation()) {
case 0:
return new boolean[] {
o,o,w,
w,w,w,
o,o,o
};
case 1:
return new boolean[] {
o,w,o,
o,w,o,
o,w,w
};
case 2:
return new boolean[] {
o,o,o,
w,w,w,
w,o,o
};
case 3:
return new boolean[] {
w,w,o,
o,w,o,
o,w,o
};
default:
throw new NullPointerException();
}
}
}

View File

@ -1,19 +1,19 @@
package it.cavallium.warppi.extra.tetris;
public class TetrominoOYellow extends Tetromino {
public TetrominoOYellow(byte x, byte y, byte rotation) {
super(x, y, rotation, TetrominoType.O_YELLOW);
}
@Override
public int getTetrominoGridSize() {
return 2;
}
@Override
public boolean[] getRenderedBlock() {
return new boolean[] {
w,w,
w,w,
};
}
}
package it.cavallium.warppi.extra.tetris;
public class TetrominoOYellow extends Tetromino {
public TetrominoOYellow(byte x, byte y, byte rotation) {
super(x, y, rotation, TetrominoType.O_YELLOW);
}
@Override
public int getTetrominoGridSize() {
return 2;
}
@Override
public boolean[] getRenderedBlock() {
return new boolean[] {
w,w,
w,w,
};
}
}

View File

@ -1,44 +1,44 @@
package it.cavallium.warppi.extra.tetris;
public class TetrominoSGreen extends Tetromino {
public TetrominoSGreen(byte x, byte y, byte rotation) {
super(x, y, rotation, TetrominoType.S_GREEN);
}
@Override
public int getTetrominoGridSize() {
return 3;
}
@Override
public boolean[] getRenderedBlock() {
switch(getRotation()) {
case 0:
return new boolean[] {
o,w,w,
w,w,o,
o,o,o
};
case 1:
return new boolean[] {
o,w,o,
o,w,w,
o,o,w
};
case 2:
return new boolean[] {
o,o,o,
o,w,w,
w,w,o
};
case 3:
return new boolean[] {
w,o,o,
w,w,o,
o,w,o
};
default:
throw new NullPointerException();
}
}
}
package it.cavallium.warppi.extra.tetris;
public class TetrominoSGreen extends Tetromino {
public TetrominoSGreen(byte x, byte y, byte rotation) {
super(x, y, rotation, TetrominoType.S_GREEN);
}
@Override
public int getTetrominoGridSize() {
return 3;
}
@Override
public boolean[] getRenderedBlock() {
switch(getRotation()) {
case 0:
return new boolean[] {
o,w,w,
w,w,o,
o,o,o
};
case 1:
return new boolean[] {
o,w,o,
o,w,w,
o,o,w
};
case 2:
return new boolean[] {
o,o,o,
o,w,w,
w,w,o
};
case 3:
return new boolean[] {
w,o,o,
w,w,o,
o,w,o
};
default:
throw new NullPointerException();
}
}
}

View File

@ -1,44 +1,44 @@
package it.cavallium.warppi.extra.tetris;
public class TetrominoTPurple extends Tetromino {
public TetrominoTPurple(byte x, byte y, byte rotation) {
super(x, y, rotation, TetrominoType.I_CYAN);
}
@Override
public int getTetrominoGridSize() {
return 3;
}
@Override
public boolean[] getRenderedBlock() {
switch(getRotation()) {
case 0:
return new boolean[] {
o,w,o,
w,w,w,
o,o,o
};
case 1:
return new boolean[] {
o,w,o,
o,w,w,
o,w,o
};
case 2:
return new boolean[] {
o,o,o,
w,w,w,
o,w,o
};
case 3:
return new boolean[] {
o,w,o,
w,w,o,
o,w,o
};
default:
throw new NullPointerException();
}
}
}
package it.cavallium.warppi.extra.tetris;
public class TetrominoTPurple extends Tetromino {
public TetrominoTPurple(byte x, byte y, byte rotation) {
super(x, y, rotation, TetrominoType.I_CYAN);
}
@Override
public int getTetrominoGridSize() {
return 3;
}
@Override
public boolean[] getRenderedBlock() {
switch(getRotation()) {
case 0:
return new boolean[] {
o,w,o,
w,w,w,
o,o,o
};
case 1:
return new boolean[] {
o,w,o,
o,w,w,
o,w,o
};
case 2:
return new boolean[] {
o,o,o,
w,w,w,
o,w,o
};
case 3:
return new boolean[] {
o,w,o,
w,w,o,
o,w,o
};
default:
throw new NullPointerException();
}
}
}

View File

@ -1,11 +1,11 @@
package it.cavallium.warppi.extra.tetris;
public enum TetrominoType {
I_CYAN,
O_YELLOW,
T_PURPLE,
S_GREEN,
Z_RED,
J_BLUE,
L_ORANGE
}
package it.cavallium.warppi.extra.tetris;
public enum TetrominoType {
I_CYAN,
O_YELLOW,
T_PURPLE,
S_GREEN,
Z_RED,
J_BLUE,
L_ORANGE
}

View File

@ -1,44 +1,44 @@
package it.cavallium.warppi.extra.tetris;
public class TetrominoZRed extends Tetromino {
public TetrominoZRed(byte x, byte y, byte rotation) {
super(x, y, rotation, TetrominoType.Z_RED);
}
@Override
public int getTetrominoGridSize() {
return 3;
}
@Override
public boolean[] getRenderedBlock() {
switch(getRotation()) {
case 0:
return new boolean[] {
w,w,o,
o,w,w,
o,o,o
};
case 1:
return new boolean[] {
o,o,w,
o,w,w,
o,w,o
};
case 2:
return new boolean[] {
o,o,o,
w,w,o,
o,w,w
};
case 3:
return new boolean[] {
o,w,o,
w,w,o,
w,o,o
};
default:
throw new NullPointerException();
}
}
}
package it.cavallium.warppi.extra.tetris;
public class TetrominoZRed extends Tetromino {
public TetrominoZRed(byte x, byte y, byte rotation) {
super(x, y, rotation, TetrominoType.Z_RED);
}
@Override
public int getTetrominoGridSize() {
return 3;
}
@Override
public boolean[] getRenderedBlock() {
switch(getRotation()) {
case 0:
return new boolean[] {
w,w,o,
o,w,w,
o,o,o
};
case 1:
return new boolean[] {
o,o,w,
o,w,w,
o,w,o
};
case 2:
return new boolean[] {
o,o,o,
w,w,o,
o,w,w
};
case 3:
return new boolean[] {
o,w,o,
w,w,o,
w,o,o
};
default:
throw new NullPointerException();
}
}
}

View File

@ -6,7 +6,7 @@
<parent>
<groupId>it.cavallium</groupId>
<artifactId>warppi</artifactId>
<version>${project.version}</version>
<version>0.9.0a2</version>
</parent>
<artifactId>warppi-desktop</artifactId>

View File

@ -1,58 +1,58 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>it.cavallium</groupId>
<artifactId>warppi</artifactId>
<version>${project.version}</version>
</parent>
<artifactId>warppi-engine-jogl</artifactId>
<packaging>bundle</packaging>
<name>WarpPI Calculator JOGL Engine</name>
<description>WarpPI Calculator engine-jogl project</description>
<dependencies>
<dependency>
<groupId>it.cavallium</groupId>
<artifactId>warppi-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jogamp.jogl</groupId>
<artifactId>jogl-all-main</artifactId>
<version>2.3.2</version>
</dependency>
<dependency>
<groupId>org.jogamp.gluegen</groupId>
<artifactId>gluegen-rt-main</artifactId>
<version>2.3.2</version>
</dependency>
<dependency>
<groupId>ar.com.hjg</groupId>
<artifactId>pngj</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Import-Package>*</Import-Package>
<Export-Package>it.cavallium.warppi.*</Export-Package>
<Bundle-SymbolicName>warppi-engine-jogl</Bundle-SymbolicName>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>it.cavallium</groupId>
<artifactId>warppi</artifactId>
<version>0.9.0a2</version>
</parent>
<artifactId>warppi-engine-jogl</artifactId>
<packaging>bundle</packaging>
<name>WarpPI Calculator JOGL Engine</name>
<description>WarpPI Calculator engine-jogl project</description>
<dependencies>
<dependency>
<groupId>it.cavallium</groupId>
<artifactId>warppi-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jogamp.jogl</groupId>
<artifactId>jogl-all-main</artifactId>
<version>2.3.2</version>
</dependency>
<dependency>
<groupId>org.jogamp.gluegen</groupId>
<artifactId>gluegen-rt-main</artifactId>
<version>2.3.2</version>
</dependency>
<dependency>
<groupId>ar.com.hjg</groupId>
<artifactId>pngj</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Import-Package>*</Import-Package>
<Export-Package>it.cavallium.warppi.*</Export-Package>
<Bundle-SymbolicName>warppi-engine-jogl</Bundle-SymbolicName>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>it.cavallium</groupId>
<artifactId>warppi</artifactId>
<version>${project.version}</version>
<version>0.9.0a2</version>
</parent>
<artifactId>warppi-hardware</artifactId>

View File

@ -5,7 +5,7 @@
<groupId>it.cavallium</groupId>
<artifactId>warppi</artifactId>
<version>${project.version}</version>
<version>0.9.0a2</version>
<packaging>pom</packaging>
<name>WarpPI Calculator</name>
@ -27,7 +27,6 @@
</scm>
<properties>
<project.version>0.9.0a0</project.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>it.cavallium</groupId>
<artifactId>warppi</artifactId>
<version>${project.version}</version>
<version>0.9.0a2</version>
</parent>
<artifactId>warppi-rules</artifactId>
<packaging>bundle</packaging>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>it.cavallium</groupId>
<artifactId>warppi</artifactId>
<version>${project.version}</version>
<version>0.9.0a2</version>
</parent>
<artifactId>warppi-teavm</artifactId>
<packaging>jar</packaging>