-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Add GDExtension C++ code snippets to GettingStarted #9821
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
base: master
Are you sure you want to change the base?
Conversation
Should be all good now. I worked through everything you mentioned, thanks for the detailed feedback! I am going to try to finish up the "Listening to player input" section over the weekend. Also will add a info box to the top of the "Using Signals" article with a link to the bottom of the "GDExtension Example" documentation that discussed signals. This seems like it will be sufficient since the articles are both basically identical, I don't see a point in filling out the "Using Signals" article with C++ snippets when the same info is in another place. Looking forward I don't really see a point in adding C++ snippets to either of the "Your first X game" sections because if it is a users first attempt at using Godot they really shouldn't use C++ (in my opinion) since they will need to know a good amount of gdscript to effectively use GDExtension anyway. So I'm thinking this will be good to merge once I finish up "Listening to player input" and "Using Signals". |
Will go over the code and test it but looks good!
This is absolutely lovely, I wish knew about this and #9837 when learning GDExtension! I wonder how to link this best from the GDExtension tutorial? I only found out by browsing PR list, after I already went through the path of reading source code and error traces. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
For the most part this looks really good, and would be nice to have, just to show people it's possible and what it looks like.
Merged in your changes and squashed, should be good to go now. |
I have been writing a project entirely in GDExtension C++ and I noticed the Godot 3.6 documentation had C++ snippets all over but there are still not any C++ snippets for anything in the 4.0 docs.
So I'd like to start an effort to get all of these filled out because GDExtension is extremely usable at this point in my opinion. Unfortunately it is not very accessible to most due to the current lack of documentation (unless you are sadistic and actually enjoy reading C++ source code to find out how to do things like me).
I figured it would be best to start at the beginning of the docs with the first place code blocks found in
scripting_first_script.rst
. I want to get some feedback on this and if the way I am doing it is acceptable I can go through and do a lot more of them, transcribing Gdscript to C++ is a pretty trivial and mindless task for me at this point so I can get through a lot of them pretty quickly I feel, especially with some help from other C++ fellas.To ensure the documentation I am writing is both consistently formatted and actually correct. I have a specific setup to make sure I'm not writing nonsense code that doesn't work.
Setting up a basic GDExtension project to write the documentation in so I can use
clangd
to ensure all the code I'm writing and adding to the docs will actually compile without benign easy to find errors.Compiling my code, testing it in the editor (if possible) and making sure it is actually doing what the documentation describes.
Before I add any of my code to the documentation blocks I run
clang-format -i ./File.cpp
from inside the Godot repository to ensure the formatting uses the exact same rules Godot source code would. There are some formatting things clang-format won't enforce, so I'm also comparing my style to the code style of godot-cpp's header files and trying to make sure they are always the exact same.Building the docs and testing that my changes actually did what they were supposed to.
If I am doing anything wrong here or you think my process could be improved let me know! If everything here looks good let me know and I'll keep working through these to add C++ code blocks everywhere.