Cleaning
-Cleaned up offsets to make it look like a cube and not 6 squares. -Fixed error where regions would incorrectly reset files -Some additions to try to match the intended look. I really dont understand layouts.
This commit is contained in:
parent
51bcca1499
commit
0f0a94811f
@ -60,6 +60,7 @@ public class Region {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
||||||
RegionWorldContainer.LOG.debug("Uh the file broke");
|
RegionWorldContainer.LOG.debug("Uh the file broke");
|
||||||
|
RegionWorldContainer.LOG.debug(e.getLocalizedMessage());
|
||||||
if (RESET_CORRUPTED) {
|
if (RESET_CORRUPTED) {
|
||||||
this.file.makeHeader(regionCoords);
|
this.file.makeHeader(regionCoords);
|
||||||
}
|
}
|
||||||
|
@ -63,9 +63,10 @@ public class RegionFile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char prog;
|
byte prog;
|
||||||
|
file.seek(0);
|
||||||
for (int i=0;i<4;i++) {
|
for (int i=0;i<4;i++) {
|
||||||
prog = file.readChar();
|
prog = file.readByte();
|
||||||
if (prog != HEADER_ID[i])
|
if (prog != HEADER_ID[i])
|
||||||
{
|
{
|
||||||
throw new IOException("File is not a .progressia_chunk file");
|
throw new IOException("File is not a .progressia_chunk file");
|
||||||
@ -131,14 +132,15 @@ public class RegionFile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void makeHeader(Vec3i regionCoords) throws IOException {
|
public void makeHeader(Vec3i regionCoords) throws IOException {
|
||||||
|
file.seek(0);
|
||||||
|
for (int i = 0; i < HEADER_SIZE; i++) {
|
||||||
|
file.write(0);
|
||||||
|
}
|
||||||
file.seek(0);
|
file.seek(0);
|
||||||
file.write(HEADER_ID);
|
file.write(HEADER_ID);
|
||||||
file.writeInt(regionCoords.x);
|
file.writeInt(regionCoords.x);
|
||||||
file.writeInt(regionCoords.y);
|
file.writeInt(regionCoords.y);
|
||||||
file.writeInt(regionCoords.z);
|
file.writeInt(regionCoords.z);
|
||||||
for (int i = 0; i < HEADER_SIZE; i++) {
|
|
||||||
file.write(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeBuffer(byte[] buffer, int dataOffset, Vec3i pos) throws IOException {
|
public void writeBuffer(byte[] buffer, int dataOffset, Vec3i pos) throws IOException {
|
||||||
|
@ -20,7 +20,7 @@ public class CubeComponent extends Component {
|
|||||||
|
|
||||||
private ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
|
private ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
|
||||||
|
|
||||||
private int size = 250;
|
private int size = 400;
|
||||||
|
|
||||||
public CubeComponent(String name) {
|
public CubeComponent(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
@ -59,12 +59,12 @@ public class CubeComponent extends Component {
|
|||||||
normals[i] = transforms[i].rotate((float) (time%(6000*6.28) )/ 6000, new Vec3(0,1,0)).rotate((float) 24, new Vec3(1,.5,0)).mul_(normals[i]);
|
normals[i] = transforms[i].rotate((float) (time%(6000*6.28) )/ 6000, new Vec3(0,1,0)).rotate((float) 24, new Vec3(1,.5,0)).mul_(normals[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
transforms[0].translate(new Vec3(-size/2,-size/2,size/2+13));
|
transforms[0].translate(new Vec3(-size/2,-size/2,size/2+11));
|
||||||
transforms[1].translate(new Vec3(-size/2,-size/2-13,-size/2)).rotate((float) pi2, new Vec3(1,0,0));
|
transforms[1].translate(new Vec3(-size/2,-size/2-12,-size/2)).rotate((float) pi2, new Vec3(1,0,0));
|
||||||
transforms[2].translate(new Vec3(-size/2+13,-size/2,size/2)).rotate((float) pi2, new Vec3(0,1,0));
|
transforms[2].translate(new Vec3(-size/2+13,-size/2,size/2)).rotate((float) pi2, new Vec3(0,1,0));
|
||||||
transforms[3].translate(new Vec3(-size/2,-size/2,-size/2+13));
|
transforms[3].translate(new Vec3(-size/2,-size/2,-size/2+14));
|
||||||
transforms[4].translate(new Vec3(-size/2,size/2-13,-size/2)).rotate((float) pi2, new Vec3(1,0,0));
|
transforms[4].translate(new Vec3(-size/2,size/2-15.5,-size/2)).rotate((float) pi2, new Vec3(1,0,0));
|
||||||
transforms[5].translate(new Vec3(size/2+13,-size/2,size/2)).rotate((float) pi2, new Vec3(0,1,0));
|
transforms[5].translate(new Vec3(size/2+15.5,-size/2,size/2)).rotate((float) pi2, new Vec3(0,1,0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -72,7 +72,9 @@ public class CubeComponent extends Component {
|
|||||||
{
|
{
|
||||||
computeTransforms();
|
computeTransforms();
|
||||||
|
|
||||||
target.pushTransform(new Mat4(1).translate(new Vec3(getX()+size*r3/2,getY()+size*r3/2,0)));
|
setPosition(750,780);
|
||||||
|
|
||||||
|
target.pushTransform(new Mat4(1).translate(new Vec3(getX()+size*r3/2,getY()-size*r3/2,0))); //-size*r3/2
|
||||||
|
|
||||||
for (int b=0; b<6;b++)
|
for (int b=0; b<6;b++)
|
||||||
{
|
{
|
||||||
|
@ -31,30 +31,35 @@ public class LayerTitle extends Background {
|
|||||||
private final BasicButton resetButton;
|
private final BasicButton resetButton;
|
||||||
|
|
||||||
public LayerTitle(String name) {
|
public LayerTitle(String name) {
|
||||||
super(name, new LayoutAlign(0.5f, 0.7f, 15), SimpleTextures.get("title/background"));
|
super(name, new LayoutAlign(0, 1f, 15), SimpleTextures.get("title/background"));
|
||||||
Group content = new Group("Layer" + name + ".Group", new LayoutVertical(15));
|
Group content = new Group("Layer" + name + ".Group", new LayoutVertical(15));
|
||||||
|
Group buttonContent = new Group("Layer" + name + ".ButtonGroup", new LayoutVertical(15));
|
||||||
|
|
||||||
Font titleFont = new Font().deriveBold().withColor(Colors.BLUE).withAlign(0.5f);
|
Font titleFont = new Font().deriveBold().withColor(Colors.BLUE).withAlign(0.5f);
|
||||||
content.addChild(new TextureComponent(name + ".Title", SimpleTextures.get("title/progressia")));
|
content.addChild(new TextureComponent(name + ".Title", SimpleTextures.get("title/progressia")));
|
||||||
|
|
||||||
Font buttonFont = titleFont.deriveNotBold();
|
Font buttonFont = titleFont.deriveNotBold();
|
||||||
MutableString playText = new MutableStringLocalized("Layer" + name + ".Play");
|
MutableString playText = new MutableStringLocalized("Layer" + name + ".Play");
|
||||||
content.addChild(new Button(name + ".Play", new Label(name + ".Play", buttonFont, playText)).addAction(this::startGame));
|
buttonContent.addChild(new Button(name + ".Play", new Label(name + ".Play", buttonFont, playText)).addAction(this::startGame));
|
||||||
|
|
||||||
MutableString resetText = new MutableStringLocalized("Layer" + name + ".Reset");
|
MutableString resetText = new MutableStringLocalized("Layer" + name + ".Reset");
|
||||||
this.resetButton = new Button(name + ".Reset", new Label(name + ".Reset", buttonFont, resetText)).addAction(this::resetWorld);
|
this.resetButton = new Button(name + ".Reset", new Label(name + ".Reset", buttonFont, resetText)).addAction(this::resetWorld);
|
||||||
content.addChild(resetButton);
|
buttonContent.addChild(resetButton);
|
||||||
|
|
||||||
updateResetButton();
|
updateResetButton();
|
||||||
|
|
||||||
MutableString quitText = new MutableStringLocalized("Layer" + name + ".Quit");
|
MutableString quitText = new MutableStringLocalized("Layer" + name + ".Quit");
|
||||||
content.addChild(new Button(name + "Quit", new Label(name + ".Quit", buttonFont, quitText)).addAction(b -> {
|
buttonContent.addChild(new Button(name + "Quit", new Label(name + ".Quit", buttonFont, quitText)).addAction(b -> {
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
content.addChild(new CubeComponent(name+".Cube"));
|
content.addChild(buttonContent);
|
||||||
|
|
||||||
getRoot().addChild(content);
|
getRoot().addChild(content);
|
||||||
|
buttonContent.setPreferredSize(500, 1000);
|
||||||
|
|
||||||
|
CubeComponent cube = new CubeComponent(name+".Cube");
|
||||||
|
|
||||||
|
getRoot().addChild(cube);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateResetButton() {
|
private void updateResetButton() {
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 12 KiB |
Reference in New Issue
Block a user