Giter VIP home page Giter VIP logo

gdextensionsummator's Introduction

GDExtension-Summator

This repository is for showcasing the new GDExtension system in Godot 4. The C++ code is from the Custom modules example of the Godot docs.

----> Feel free to use this repository as a template for your GDExtensions

🎉 Using the extension

After compiling the extension successfully, you can now use the Summator Class inside Godot

func _ready() -> void:
	var s = Summator.new()
	s.add(10)
	s.add(20)
	s.add(30)
	print(s.get_total())
        # outputs 60 in the console
	s.reset()

đŸ”ĸ Versioning

This repository is being updated regularly to work with the latest point release of the Godot branches. If you can't compile the extension, please open an issue.

The releases are structured as GODOT_VERSION-EXTENSION_VERSION to clarify which version to use for which Godot version.

❓ What? How? Why?

If you are not sure what each file in this project does or if you want to know in detail: I wrote a blog post about the purpose of each file on my Ko-Fi page.

Alternative templates

If you want to work with the latest master and godot-cpp version, check out this GDExtension template by Nathan Franke. If you are more used to CMake than Scons you can use this template here by asmalone

ℹī¸ Contributing

If you can't compile the extension, please open an issue with the error log in your terminal and/or the error log in the editor (if you can't run the example scene).

PRs for improvements are very welcome!

⚙ī¸ Building the extension

VSCode Compilation (only applicable if you are using VSCode as your code editor)

For the initial build you can run the vscode task initial-build-extension. This compiles both godot-cpp and the extension. For all subsequent builds, you only need to run the task build-extension.

Debugging via VSCode

To debug your extension you can run the build-extension [dev build] command. To use this command you need to also modify your specific Godot paths inside the .vscode/tasks.json file. For further information see here.

Manual Compilation

To compile the extension you need to follow these steps:

  1. Click on the green "Use this template" button to generate the repository for you

  2. Clone the extension recursively from this repository

# The git adress can be found under the green "Code" dropdown menu
git clone (--GITHUB ADRESS--) # --recursive to automatically load the submodule godot-cpp
  1. Make sure you are on the right commit of the godot-cpp repository
git status # this show's you the commit. Make sure that it has the correct commit for the release you are targeting

To make sure you have the right commit, here the link to the pinned updated issue with the commit hashes

  1. Make sure you are in the top level of the repository so pwd returns the following
pwd
.../GDExtensionSummator
  1. Go inside the godot-cpp folder
cd godot-cpp
  1. Compile godot-cpp and generate the bindings (only needed once when starting development or when there is an update of the submodule)
scons # this will use the default values such as target=template_debug
  1. Go back to the top level of the directory
cd ..
  1. Compile the extension
scons # this will use the default values such as target=template_debug

gdextensionsummator's People

Contributors

paddy-exe avatar ughuuu avatar karmavil avatar matthewhilton avatar ozzr avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤ī¸ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.