prepare for hexagon display & other models

- display cell as hexagon is Display.mHexagon if set ( not default )
will need a checkbox to set this
- various new models preparation...
This commit is contained in:
philippe lhardy
2020-12-27 15:40:22 +01:00
parent e146199ba0
commit afbe26065b
15 changed files with 403 additions and 26 deletions

View File

@@ -4,8 +4,13 @@ import org.artisanlogiciel.games.maze.LabyModel;
import java.io.*;
/**
* raw model with short table inner of LabyModel
*/
public class MazePersistRaw
{
private static byte HEADER[] = new byte[]{(byte) 'L', (byte) 'A', (byte) 'B', (byte) '0'};
private LabyModel model;
public MazePersistRaw(LabyModel model)
@@ -24,7 +29,7 @@ public class MazePersistRaw
// first raw format, not smart.
DataOutputStream dataOut = new DataOutputStream(pOut);
// should dump this to stream.
dataOut.write(new byte[]{(byte) 'L', (byte) 'A', (byte) 'B', (byte) '0'});
dataOut.write(HEADER);
dataOut.writeInt(model.getWidth());
dataOut.writeInt(model.getHeight());
dataOut.flush();
@@ -46,6 +51,7 @@ public class MazePersistRaw
byte[] header = new byte[4];
DataInputStream in = new DataInputStream(pIn);
in.read(header);
// TODO check header == HEADER
int rwidth = in.readInt();
int rheight = in.readInt();
if ((rwidth > 0) && (rheight > 0)) {