C++ Source Code for Godot Engine 4.x GDExtension module exposing interfaces to encode and decode QRCodes in GDScript.
func _ready() -> void:
# Decoding
var qr: Image = Image.load_from_file("res://qrcode.png")
var qr_decode_result: QRDecodeResult = QRNative.decode_image(qr)
if qr_decode_result.is_valid():
print(qr_decode_result.get_content())
# Encoding
var qr_content: String = "This is the content of my QR Code!"
var qr_code: Image = QRNative.encode_string(qr_content, 100, 100, 5)
$QRCode.set_texture(ImageTexture.create_from_image(qr_code))
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
.
To compile the extension you need to follow these steps:
- Clone the extension recursively from this repository
# --recursive to automatically load the submodule godot-cpp
# The git adress can be found under the green "Code" dropdown menu
git clone --recursive (--GITHUB ADRESS--)
- Make sure you are in the top level of the repository
pwd
.../qrnative
- Go inside the godot-cpp folder
cd godot-cpp
- Compile godot-cpp and generate bindings (only need to do this once when starting development or when there is an update of the submodule)
scons #by default will use your target and template_debug
- Go back to the top level of the directory
cd ..
- Compile the extension
scons
- GDSummatorExample by @paddy-exe
- GDExtension by @nathanfranke