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

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
Ryno
Prole
Posts: 3
Joined: Thu Mar 07, 2013 5:52 pm

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

Post 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
Last edited by Ryno on Fri Mar 08, 2013 3:41 pm, edited 1 time in total.
User avatar
Taehl
Dreaming in associative arrays
Posts: 1025
Joined: Mon Jan 11, 2010 5:07 am
Location: CA, USA
Contact:

Re: Can I open Löve2D with .bat

Post 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"
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
User avatar
monsieur_h
Citizen
Posts: 65
Joined: Tue Oct 30, 2012 4:43 pm

Re: Can I open Löve2D with .bat

Post 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.
User avatar
slime
Solid Snayke
Posts: 3131
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Can I open Löve2D with .bat

Post 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.
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Can I open Löve2D with .bat

Post 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...]
User avatar
monsieur_h
Citizen
Posts: 65
Joined: Tue Oct 30, 2012 4:43 pm

Re: Can I open Löve2D with .bat

Post by monsieur_h »

We should have a FAQ tackling this on the wiki, it's asked often enough to justify a page imo.
User avatar
josefnpat
Inner party member
Posts: 955
Joined: Wed Oct 05, 2011 1:36 am
Location: your basement
Contact:

Re: Can I open Löve2D with .bat

Post 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.)
Missing Sentinel Software | Twitter

FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push
Ryno
Prole
Posts: 3
Joined: Thu Mar 07, 2013 5:52 pm

Re: Can I open Löve2D with .bat

Post 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
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Can I open Löve2D with .bat

Post by Robin »

Doesn't this work:

Code: Select all

@echo off
"C:\Program Files (x86)\LOVE\love.exe" .
?
Help us help you: attach a .love.
Ryno
Prole
Posts: 3
Joined: Thu Mar 07, 2013 5:52 pm

Re: Can I open Löve2D with .bat

Post by Ryno »

Thank you alot Robin.
Thougt I had tried that, but now it works.

-Ryno
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 45 guests