britzl / extension-filedrop

This extension provides a unified, simple to use interface to handle drag and drop of files onto a Defold application
MIT License
8 stars 2 forks source link

FileDrop API for Defold

This extension provides a unified, simple to use interface to handle drag and drop of files onto a Defold application. The extension supports the following platforms:

Usage

To use this library in your Defold project, add the following URL to your game.project dependencies:

https://github.com/britzl/extension-filedrop/archive/master.zip

It is recommended to use a link to the zip file of a specific release.

Example

function init(self)
    filedrop.set_listener(function(self, event, filename, data)
        if event == "dragover" then
            print("Drag over")
        elseif event == "dragleave" then
            print("Drag leave")
        elseif event == "drop" then
            print("Dropped ", filename, data)
        end
    end
end