Page 1 of 1

[SOLVED] Can I open Löve2D with .bat

Posted: Thu Mar 07, 2013 7:38 pm
by Ryno
Hi!
I am watching this tutorial http://www.youtube.com/watch?v=6ZBAxKoJ ... B05A624D91
and he makes a .bat file which opens löve2D and runs the lua files.
I have made the same .bat file.
The first time i launched the .bat file it worked fine.
The second (and some more) time(s) when i launched the .bat file it opened Löve2D it showed a picture of a pig and som hearts rotating.
So I googled and found out to zip the files and drag them to the Löve2D program.
But the .bat would so much easier.

So the question is; Can I open my Lua files in Löve2D with a .bat file?
-Ryno

Re: Can I open Löve2D with .bat

Posted: Thu Mar 07, 2013 8:46 pm
by Taehl
You just need to call Love with your game's folder as the first parameter. For example:

Code: Select all

C:\Games\Love\love.exe "C:\Games\Love\my game"

Re: Can I open Löve2D with .bat

Posted: Thu Mar 07, 2013 9:39 pm
by monsieur_h
Personally I have two files in every project I make:

love32.bat, containing:

Code: Select all

"C:\Program Files\LOVE\love.exe" "%CD%"
love64.bat, containing:

Code: Select all

"C:\Program Files (x86)\LOVE\love.exe" "%CD%"
It allows my fellows from art and sound to run the project from any windows computer they have, with love installed.

Re: Can I open Löve2D with .bat

Posted: Thu Mar 07, 2013 10:34 pm
by slime
Ryno wrote: So I googled and found out to zip the files and drag them to the Löve2D program.
But the .bat would so much easier.
You don't have to zip the files, you can just drag the folder containing your main.lua onto the LÖVE executable.

Re: Can I open Löve2D with .bat

Posted: Thu Mar 07, 2013 11:39 pm
by Jasoco
Conversely, if you're on OS X you can create a .command file to do the same thing. It even opens the Terminal for debugging.
Put this in an empty text file with a .command extension:

Code: Select all

#!/bin/bash

/Path/to/love.app/Contents/MacOS/love /Path/to/Love/Project/File/
Then use the Terminal to make it executable:

Code: Select all

chmod 755 YourCommandFile.command
(Easier if you type the chmod 755 part first with a trailing space then drag the file in the Finder into the window and press Enter.)

Then you can just double-click it to launch it.

[The More You Know...]

Re: Can I open Löve2D with .bat

Posted: Fri Mar 08, 2013 11:26 am
by monsieur_h
We should have a FAQ tackling this on the wiki, it's asked often enough to justify a page imo.

Re: Can I open Löve2D with .bat

Posted: Fri Mar 08, 2013 2:39 pm
by josefnpat
monsieur_h wrote:We should have a FAQ tackling this on the wiki, it's asked often enough to justify a page imo.
I think this would be a good idea actually.

How about a page like this?

https://www.love2d.org/wiki/Development_Scripting

It could contain;
  • Windows .bat setup
  • OS X bash
  • Linux bash
  • Makefile
  • Build Script
  • IDE configs (e.g. Geany custom build commands.)

Re: Can I open Löve2D with .bat

Posted: Fri Mar 08, 2013 3:25 pm
by Ryno
So what is it I have to put into my .bat file instead of

Code: Select all

@Echo off
start "" "C:\Program Files (x86)\LOVE\love.exe"


-Ryno

Re: Can I open Löve2D with .bat

Posted: Fri Mar 08, 2013 3:28 pm
by Robin
Doesn't this work:

Code: Select all

@echo off
"C:\Program Files (x86)\LOVE\love.exe" .
?

Re: Can I open Löve2D with .bat

Posted: Fri Mar 08, 2013 3:39 pm
by Ryno
Thank you alot Robin.
Thougt I had tried that, but now it works.

-Ryno