Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bunch of minor bugfixes and code cleanup #2

Merged
merged 16 commits into from Oct 22, 2023

Conversation

romanthekat
Copy link
Contributor

@romanthekat romanthekat commented Oct 22, 2023

This PR is a continuation of #1 and supersedes it , provides other bugfixes I added in the fork:

  • fix: lags on device due to font object recreation (from fix: create possible number font only once #1 )
  • fix: notation doesn't stop working in certain cases
  • fix: congratulations timer effect won't be triggered when you manually return to home
  • fix: minor typos in methods names
  • feat: simple icon

@romanthekat
Copy link
Contributor Author

Latest build: sudoku.pdx.zip

@@ -10,6 +10,7 @@ import "checkBoxButtons"
local gfx <const> = playdate.graphics
local menu = playdate.getSystemMenu()

local congratulationsTimer = nil
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't really like global vars, but if exit to menu w/o waiting for the timer finish, then it will still be triggered once 10 seconds pass.
We do remove the sprites later down the load, but the timer will still exist and will trigger the logic behind 'congratulations sprite'.

@@ -86,6 +86,12 @@ end
function setUpTitleScreen()
menu:removeAllMenuItems()
gfx.sprite.removeAll()

if congratulationsTimer ~= nil then
removeGameData()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so that if we go to title screen, and there was a congratulation screen before, we clean saved state (e.g. button Continue will disappear since we finished the play)

@@ -416,6 +415,7 @@ function turnOnNotingMode(bool, board)
board.boardData.isNoting = true
if board.boardData.selected ~= nil and board.boardData.selected.status ~= status.Given then
board.boardData.selected.number = 0
board.boardData.selected.status = status["Empty"]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when we initiate notation mode we clean the previous status in addition to resetting the number.
so that, if there was a number provided by user, then status won't be left equal to Given or Guessed.
otherwise, if we initiate notation mode, togglePossibleNumber won't work because it checks if status is Empty.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rather low quality, I just cropped the launchImage file to 32x32

@@ -4,6 +4,7 @@ import "CoreLibs/sprites"
import "CoreLibs/timer"

local gfx <const> = playdate.graphics
local possibleNumberFont = gfx.font.new("font-Bitmore")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so we only read the font once, and then reuse it. this particular update fixed the lag on my device

@mattie-dev
Copy link
Owner

Thank you so much for helping and fixing so many problems in the codebase!

@mattie-dev mattie-dev merged commit fc32a88 into mattie-dev:main Oct 22, 2023
function removeGameData()
playdate.datastore.delete("board_table")
end
function useless()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed it, since it's useless :)

@romanthekat
Copy link
Contributor Author

Thank you for creating such a nice game =^__^=
One of the most played for me 😸

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants