Add drag & drop game to start into nogame

This commit is contained in:
John Doe
2025-10-25 21:12:51 +01:00
parent 2afa36ffb8
commit 9e55b14695
3 changed files with 45 additions and 0 deletions
+11
View File
@@ -48,6 +48,17 @@ function love.boot()
-- Having love.system loaded before conf.lua is run can be useful for accessing love.system.getOS.
require("love.system")
-- nogame.lua returns noGameRestartInfo when
-- dropping a file or directory on to its window.
if love.restart and type(love.restart) == "table" then
local was_no_game = love.restart.noGameRestartInfo
if was_no_game and type(was_no_game) == "table" then
if was_no_game.gamepath then
table.insert(arg, 1, was_no_game.gamepath)
end
end
end
love.rawGameArguments = arg
local arg0 = love.arg.getLow(love.rawGameArguments)
+12
View File
@@ -3285,6 +3285,18 @@ function love.nogame()
t.window.borderless = true
end
end
function restartWithNewGame(path)
love.event.quit("restart", {noGameRestartInfo = {gamepath = path}})
end
function love.filedropped(file)
restartWithNewGame(file:getFilename())
end
function love.directorydropped(path)
restartWithNewGame(path)
end
end
return love.nogame
+22
View File
@@ -12129,6 +12129,28 @@ const unsigned char nogame_lua[] =
0x6c, 0x65, 0x73, 0x73, 0x20, 0x3d, 0x20, 0x74, 0x72, 0x75, 0x65, 0x0a,
0x09, 0x09, 0x65, 0x6e, 0x64, 0x0a,
0x09, 0x65, 0x6e, 0x64, 0x0a,
0x0a,
0x09, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x72, 0x65, 0x73, 0x74, 0x61, 0x72, 0x74, 0x57,
0x69, 0x74, 0x68, 0x4e, 0x65, 0x77, 0x47, 0x61, 0x6d, 0x65, 0x28, 0x70, 0x61, 0x74, 0x68, 0x29, 0x0a,
0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x71, 0x75, 0x69, 0x74, 0x28,
0x22, 0x72, 0x65, 0x73, 0x74, 0x61, 0x72, 0x74, 0x22, 0x2c, 0x20, 0x7b, 0x6e, 0x6f, 0x47, 0x61, 0x6d, 0x65,
0x52, 0x65, 0x73, 0x74, 0x61, 0x72, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x20, 0x3d, 0x20, 0x7b, 0x67, 0x61, 0x6d,
0x65, 0x70, 0x61, 0x74, 0x68, 0x20, 0x3d, 0x20, 0x70, 0x61, 0x74, 0x68, 0x7d, 0x7d, 0x29, 0x0a,
0x09, 0x65, 0x6e, 0x64, 0x0a,
0x0a,
0x09, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x66, 0x69, 0x6c,
0x65, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x28, 0x66, 0x69, 0x6c, 0x65, 0x29, 0x0a,
0x09, 0x09, 0x72, 0x65, 0x73, 0x74, 0x61, 0x72, 0x74, 0x57, 0x69, 0x74, 0x68, 0x4e, 0x65, 0x77, 0x47, 0x61,
0x6d, 0x65, 0x28, 0x66, 0x69, 0x6c, 0x65, 0x3a, 0x67, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d,
0x65, 0x28, 0x29, 0x29, 0x0a,
0x09, 0x65, 0x6e, 0x64, 0x0a,
0x0a,
0x09, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x64, 0x69, 0x72,
0x65, 0x63, 0x74, 0x6f, 0x72, 0x79, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x28, 0x70, 0x61, 0x74, 0x68,
0x29, 0x0a,
0x09, 0x09, 0x72, 0x65, 0x73, 0x74, 0x61, 0x72, 0x74, 0x57, 0x69, 0x74, 0x68, 0x4e, 0x65, 0x77, 0x47, 0x61,
0x6d, 0x65, 0x28, 0x70, 0x61, 0x74, 0x68, 0x29, 0x0a,
0x09, 0x65, 0x6e, 0x64, 0x0a,
0x65, 0x6e, 0x64, 0x0a,
0x0a,
0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x6e, 0x6f, 0x67, 0x61, 0x6d, 0x65, 0x0a,