diff --git a/core/src/io/github/lonamiwebs/klooni/GameSerializer.java b/core/src/io/github/lonamiwebs/klooni/GameSerializer.java new file mode 100644 index 0000000..1d64aa9 --- /dev/null +++ b/core/src/io/github/lonamiwebs/klooni/GameSerializer.java @@ -0,0 +1,51 @@ +package io.github.lonamiwebs.klooni; + +import java.io.DataOutputStream; +import java.io.IOException; +import java.io.OutputStream; + +public class GameSerializer { + // integer version + // integer game mode: + // integer current/high score + // + // TODO: Scorer specific + // Board on row major order: + // true color if cell is filled + // false if cell is empty + // 3 held pieces IDs (-1 if null) + + // Modify this if the saving scheme changes + private static final int VERSION = 1; + + public static void serialize(final int /*GameScreen*/ game, final OutputStream output) + throws IOException { + DataOutputStream out = new DataOutputStream(output); + try { + out.writeInt(VERSION); + } finally { + out.close(); + } + + // todo uhm maybe make the classes serializable? like telethon, kinda, idk, bye. + + + /* + DataInputStream d = new DataInputStream(new FileInputStream("test.txt")); + + DataOutputStream out = new DataOutputStream(new FileOutputStream("test1.txt")); + + String count; + d.readFully(); + while((count = d.readLine()) != null){ + String u = count.toUpperCase(); + System.out.println(u); + out.writeBytes(u + " ,"); + } + d.close(); + out.close(); + */ + + + } +} diff --git a/core/src/io/github/lonamiwebs/klooni/game/PieceHolder.java b/core/src/io/github/lonamiwebs/klooni/game/PieceHolder.java index b199423..831eb6f 100644 --- a/core/src/io/github/lonamiwebs/klooni/game/PieceHolder.java +++ b/core/src/io/github/lonamiwebs/klooni/game/PieceHolder.java @@ -90,12 +90,12 @@ public class PieceHolder { pieces[i] = Piece.random(); // Set the absolute position on screen and the cells' cellSize - // Also clamp the cell size to be the picked * 2 as maximum, or + // Also clamp the cell size to be the picked size as maximum, or // it would be too big in some cases. pieces[i].pos.set(area.x + i * perPieceWidth, area.y); pieces[i].cellSize = Math.min(Math.min( perPieceWidth / pieces[i].cellCols, - area.height / pieces[i].cellRows), pickedCellSize * 2f); + area.height / pieces[i].cellRows), pickedCellSize); // Center the piece on the X and Y axes. For this we see how // much up we can go, this is, (area.height - piece.height) / 2