Last active
November 20, 2022 03:38
-
-
Save gphg/36ca9d0a8b52d84a923e91317010f4e1 to your computer and use it in GitHub Desktop.
launch Love2D game basically. Without fused. In different method. See versions for worse.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ECHO off | |
@SET PATH=%~dp0vendor\love-11.4-win32;%PATH% | |
@SET PATH=%~dp0vendor\love-11.4-win64;%PATH% | |
@love %~dp0game.love %* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Basical execute external program based on script's relative path. | |
-- It's written in Nelua, it meant to be compiled as an executable. | |
require 'os' | |
require 'arg' | |
local thisdir = arg[0]:gsub('[/\\][^/\\]*$', '') | |
-- on cmd.exe, the valie is same if on same cwd | |
if arg[0] == thisdir then thisdir = "." end | |
-- exclusively Windows only (Powershell). | |
local command = "powershell.exe" | |
local target = thisdir .. "\\launch.ps1" | |
-- Is target file exist? | |
local fs_ok, fs_err, fs_code = os.rename(target, target) | |
if (not fs_ok) and (fs_code ~= 13) then error(fs_err) end | |
-- What this do is basically invoke command string (powershell) | |
local exec_cmd = command .. " " .. target .. " ".. string.concat(arg) | |
local exec_ok, exec_err, exec_code = os.execute(exec_cmd) | |
if not exec_ok then error(exec_err) end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$scriptPath = split-path -parent $MyInvocation.MyCommand.Definition | |
# List of archs | |
$achiList = "win32", "win64" | |
# Loop over then poluted $env:PATH of defined list | |
Foreach ($arci in $achiList) { $env:Path = "$scriptPath\vendor\love-11.4-$arci;" + $env:Path } | |
if($MyInvocation.expectingInput) { $input | & love $scriptPath\game.love @args } else { & love $scriptPath\game.love @args } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
LOVE=love | |
VERSION=11.4 | |
SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd) | |
# Prioritize "vendor", then system installed | |
PATH=$SCRIPT_DIR/vendor;$PATH | |
if ! command -v $LOVE &> /dev/null; then | |
echo "Unable to locate: $LOVE." | |
if [ -z ${WINDIR+x} ]; then | |
# Not on Windows | |
echo "Assuming Linux. Checking for AppImage under vendor..." | |
LOVE=love-$VERSION-x86_64.AppImage | |
chmod +x $SCRIPT_DIR/$LOVE | |
if ! command -v $LOVE &> /dev/null; then | |
echo "Unable to locate: $LOVE." | |
echo 'Go to "https://love2d.org/", then download the framework.' | |
fi | |
else | |
# On Windows (POSIX) | |
PATH=$SCRIPT_DIR/vendor/love-$VERSION-win32;$PATH | |
PATH=$SCRIPT_DIR/vendor/love-$VERSION-win64;$PATH | |
fi | |
fi | |
# Exec | |
$LOVE $SCRIPT_DIR/game.love $@ & |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment