Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
IonutParau committed Aug 18, 2023
1 parent b061395 commit fcfe094
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions lib/layout/game_ui.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ TextStyle fontSize(double fontSize) {
}

Map<String, bool> keys = {};
Map<String ,bool> lastTickKeys = {};

const halfPi = pi / 2;

Expand Down
1 change: 1 addition & 0 deletions lib/layout/other/version.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ final List<String> changes = [
"QuickFix: Made the modding API not add subticks AFTER time reset",
"Reworked rendering and the background image to make it extremely much faster",
"QuickFix: Fixed several modding API problems",
"Reworked how TPC puzzle movement are computed",
];

IconData getTrailing(String change) {
Expand Down
4 changes: 2 additions & 2 deletions lib/layout/tools/saving.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1371,7 +1371,7 @@ class P6 {
}
}

final encodedList = <String>[];
final encodedList = [];

for (var compressedCellList in cellList) {
final (cell, bg, count) = compressedCellList;
Expand Down Expand Up @@ -1758,7 +1758,7 @@ class VX {
str += "${base64.encode(zlib.encode(utf8.encode(json.encode(gridData))))};";

str += (grid.width == 100) ? ";" : "${grid.width};";
str += (grid.width == grid.height) ? ";" : "${grid.width};";
str += (grid.width == grid.height) ? ";" : "${grid.height};";

return str;
}
Expand Down
3 changes: 3 additions & 0 deletions lib/logic/core/game.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1632,6 +1632,8 @@ class PuzzleGame extends FlameGame with TapDetector, KeyboardEvents {
if (worldIndex != null) {
gridTabIndex = worldIndex!;
}

lastTickKeys.clear();

await loadAllButtonTextures();

Expand Down Expand Up @@ -2627,6 +2629,7 @@ class PuzzleGame extends FlameGame with TapDetector, KeyboardEvents {
itime = 0;
} else {
grid.update(); // Update the cells boizz
lastTickKeys = {...keys}; // not good for GC
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions lib/logic/update/puzzle.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ part of logic;
bool isPuzzleKeyDown(int d) {
d %= 4;
if (d == 0) {
return keys[LogicalKeyboardKey.arrowRight.keyLabel] == true;
return keys[LogicalKeyboardKey.arrowRight.keyLabel] == true || lastTickKeys[LogicalKeyboardKey.arrowRight.keyLabel] == false;
}
if (d == 2) {
return keys[LogicalKeyboardKey.arrowLeft.keyLabel] == true;
return keys[LogicalKeyboardKey.arrowLeft.keyLabel] == true || lastTickKeys[LogicalKeyboardKey.arrowLeft.keyLabel] == false;
}
if (d == 1) {
return keys[LogicalKeyboardKey.arrowDown.keyLabel] == true;
return keys[LogicalKeyboardKey.arrowDown.keyLabel] == true || lastTickKeys[LogicalKeyboardKey.arrowDown.keyLabel] == false;
}
if (d == 3) {
return keys[LogicalKeyboardKey.arrowUp.keyLabel] == true;
return keys[LogicalKeyboardKey.arrowUp.keyLabel] == true || lastTickKeys[LogicalKeyboardKey.arrowUp.keyLabel] == false;
}
return false;
}
Expand Down

0 comments on commit fcfe094

Please sign in to comment.