Add tetrix examples - #349
Open
rcalixte wants to merge 3 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This started out without much reason but then it became a little more! The examples are a bit larger than I think is ideal but they do flow mostly logically well. This does introduce QSignalMapper as an alternative to the C++ equivalent of class-based C++ signals which I thought was a good exercise and there's also one instance of QRandomGenerator. I'm still finding my way around the maps so currently there's one per QLCDNumber object. I think we could maybe consolidate them into a single QSignalMapper object with a unique ID per object but that escaped me for the moment and the per-object overhead isn't that severe.
This example was the first time I got bit doing
defer object.Delete()for manual cleanups. It happened with the QColor and QRect objects so I removed thosedefercalls. A reminder course on the fact that closures can heap allocate also led to some minor refactors. The Qt 5 version still has some sporadic garbage collection crashes that I haven't been able to resolve or even consistently trigger. Other than that, everything mapped over cleanly.A fair warning: it starts out enjoyable... and then... you understand why there is no win state implemented. 😅