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

Code & Build Cleanup & Enhancements #18

Open
wants to merge 20 commits into
base: master
Choose a base branch
from

Conversation

mheller575
Copy link

Hello, I stumbled on your Snake and GameMenu projects while learning SFML and thought it was an excellent introduction and I wanted to contribute if possible.

I am happy to discuss and address any and all feedback you have for me. Thank you for putting these projects together!

Pull request includes changes for:

  • Fix to CmakeLists.txt that prevented build from running properly. Target under Win32 if statement in CmakeLists was targetting "CMakeSFMLProject" which is from the SFML CMake template file. Changing this to the "gamemenu" target fixed the build for WIndows. (Found this while attempting to build the Snake project.

  • Updated code formatting for a more typical 4 space tab indenting scheme. this makes the code easier to read in my opinion. (I understand if you don't agree with this spacing scheme. I can undo if you prefer.)

  • Removed the old style header guard #ifndef in favor of "#pragma once" which is the C++14 and later handling.

  • Removed any use of non-portable base types in favor of "cstdint" typedefs for portability.

  • Changed names of files for the types contained within.

  • Added missing internal impl header file to the build process for "cmakelists.txt". Header isn't built but for users using Visual Studio it adds the header to the project file.

  • Changed standalone C functions to a utilize a factory builder factory function that returns a shared pointer. Shared pointer is preferred as it automatically handles cleanup of the raw memory. It is also clearer to the client that the returned object is a pointer that requires management. The returned pointer is then an interface to the menu. This hides the internal implementation of the menu from the client and gives them explicit management/use functions they can call and reference on the pointer.

  • Updated internal implementation to simplify the creation of the menu. Also simplified the logic for layout and drawing.

  • Changed Example code to not use the struct initializer. The struct initializer required C++20 but no other C++20 features were being used in the core project. Removed the use so the Example and the core code can both use C++14. (Users of the project are welcome to use C++20 if they want, but it is not required.)

  • Added comments and documentation to public functions and the example.

  • Added mouse support to the menu.

@ParadoxZero
Copy link
Owner

Thank you so much for the PR. This looks like a lot of changes. I am currently traveling right now. Would love to review it once I am back.

Thanks again for the effort!

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