Drag and drop files/pictures onto a love2d window?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
xThomas
Prole
Posts: 10
Joined: Tue May 02, 2017 2:43 am

Drag and drop files/pictures onto a love2d window?

Post by xThomas » Mon Jul 16, 2018 10:57 am

lets say for the sake of argument, the user would drag and drop a picture, or video, or text file onto a love2d window. like how in imgur or many other programs you can drag and drop files/pictures. same thing here

Possible?

User avatar
Link
Prole
Posts: 14
Joined: Tue Jun 19, 2018 4:09 am

Re: Drag and drop files/pictures onto a love2d window?

Post by Link » Mon Jul 16, 2018 11:47 am

I've not used it personally (I'm using an older version), but since Love 0.10.0 there are 2 new callback functions for this functionality:

https://www.love2d.org/wiki/love.filedropped
https://www.love2d.org/wiki/love.directorydropped

User avatar
zorg
Party member
Posts: 2325
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Drag and drop files/pictures onto a love2d window?

Post by zorg » Mon Jul 16, 2018 3:13 pm

I can attest to it, those two functions do indeed work. Tested on Windows, at least.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.

User avatar
pgimeno
Party member
Posts: 1177
Joined: Sun Oct 18, 2015 2:58 pm

Re: Drag and drop files/pictures onto a love2d window?

Post by pgimeno » Mon Jul 16, 2018 8:08 pm

Works on Linux as well. Here's a project that relies on drag-and-drop of a video: viewtopic.php?t=82429

It happens to work unmodified in 11.1.
Thrust II Reloaded - GifLoad for Löve - GSpöt GUI - My NotABug.org repositories
The Microsoft Github repositories I had have been closed after the acquisition announcement and will be removed in the near future.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 10 guests