Last active
April 19, 2021 20:10
-
-
Save Sheepolution/d02012982078e0539e2bf582df334af9 to your computer and use it in GitHub Desktop.
LÖVE Build script
This file contains hidden or 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 | |
cls | |
echo Building! | |
set "gameName=%1" | |
set "gameNameLower=%2" | |
set "companyName=%3" | |
if "!gameName!"=="" ( | |
set /p gameName="Game name: " | |
set /p gameNameLower="Game name lowercase: " | |
set /p companyName="Company name: " | |
) | |
if not exist icon.ico ( | |
if exist game\icon.png ( | |
echo icon.png found. Making icon.ico. | |
ffmpeg -i game\icon.png icon.ico > nul | |
) else ( | |
echo No icon.png found, skip. | |
) | |
) else ( | |
echo icon.ico found. | |
) | |
rmdir /Q /S bin > nul | |
mkdir bin > nul | |
echo Making .love | |
echo Zipping... | |
CScript %~dp0zipper.vbs "game" "bin\game.zip" "%cd%" > nul | |
timeout /t 1 > nul | |
echo Zipped! | |
cd bin | |
move "game.zip" "%gameNameLower%.love" > nul | |
echo Building Windows | |
ResourceHacker.exe -open "%~dp0love.exe" -save "love-copy.exe" -action addoverwrite -res "..\icon.ico" -mask ICONGROUP,MAINICON, > nul | |
copy /b love-copy.exe+%gameNameLower%.love "%gameNameLower%.exe" > nul | |
del love-copy.exe | |
mkdir windows | |
copy %~dp0dlls windows > nul | |
move "%gameNameLower%.exe" "windows\%gameNameLower%.exe" > nul | |
if exist ..\info robocopy /s ..\info\ windows > nul | |
echo Zipping Windows | |
CScript %~dp0zipper.vbs windows %gameNameLower%_windows.zip "%cd%" > nul | |
timeout /t 1 > nul | |
echo Zipped! | |
echo Building Mac | |
mkdir mac | |
if exist ..\info robocopy /s ..\info\ mac > nul | |
robocopy "%~dp0love.app" "mac\%gameNameLower%.app" /E > nul | |
copy "%gameNameLower%.love" "mac\%gameNameLower%.app\Contents\Resources\%gameNameLower%.love" > nul | |
powershell -Command "(Get-Content mac\%gameNameLower%.app\Contents\Info.plist) -replace 'GAME_LOWER', '%gameNameLower%' | Out-File -encoding ASCII mac\%gameNameLower%.app\Contents\Info.plst" | |
powershell -Command "(Get-Content mac\%gameNameLower%.app\Contents\Info.plist) -replace 'GAME_NAME', '%gameName%' | Out-File -encoding ASCII mac\%gameNameLower%.app\Contents\Info.plst" | |
powershell -Command "(Get-Content mac\%gameNameLower%.app\Contents\Info.plist) -replace 'COMPANY_NAME', '%companyName%' | Out-File -encoding ASCII mac\%gameNameLower%.app\Contents\Info.plst" | |
echo Zipping... | |
CScript %~dp0zipper.vbs mac %gameNameLower%_mac.zip "%cd%" > nul | |
timeout /t 1 > nul | |
echo Zipped! | |
echo Building Web | |
echo web | call love-js %gameNameLower%.love web > nul | |
echo Done! |
This file contains hidden or 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
Set objArgs = WScript.Arguments | |
FullPath = objArgs(2) | |
InputFolder = FullPath + "\" + objArgs(0) | |
ZipFile = FullPath + "\" + objArgs(1) | |
CreateObject("Scripting.FileSystemObject").CreateTextFile(ZipFile, True).Write "PK" & Chr(5) & Chr(6) & String(18, vbNullChar) | |
Set objShell = CreateObject("Shell.Application") | |
Set source = objShell.NameSpace(InputFolder).Items | |
objShell.NameSpace(ZipFile).CopyHere(source) | |
wScript.Sleep 2000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment