Skip to content

fenix-hub/qrnative-cpp

Repository files navigation

QRNative C++

C++ Source Code for Godot Engine 4.x GDExtension module exposing interfaces to encode and decode QRCodes in GDScript.

Usage

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))

Getting started / 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.

Manual Compilation

To compile the extension you need to follow these steps:

  1. 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--)
  1. Make sure you are in the top level of the repository
pwd
.../qrnative
  1. Go inside the godot-cpp folder
cd godot-cpp
  1. 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
  1. Go back to the top level of the directory
cd ..
  1. Compile the extension
scons

Resources

About

Godot Engine 4.x GDExtension module exposing interfaces to encode and decode QRCodes in GDScript

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published