Difference between revisions of "Getting Started (Romanian)"

(Crearea unui Joc)
Line 18: Line 18:
 
end
 
end
 
</source>
 
</source>
 +
 +
== Rularea Jocurilor ==
 +
 +
LÖVE poate porni un joc în două feluri:
 +
* Dintr-un director care conține un fișier main.lua.
 +
* Dintr-un fișier [[Fișier de joc LÖVE|fișier .love]] care are un fișier main.lua în directorul rădăcină
 +
 +
Pentru a crea fișiere .love vezi [[Distribuirea Jocurilor]].
 +
 +
----
 +
===Windows===
 +
 +
[http://studio.zerobrane.com ZeroBrane Studio], [[Sublime Text 2]], [[Notepad++]], și [[SciTE]] permit rularea jocurilor dinăuntrul editoarelor lor.
 +
 +
Altfel, cea mai ușoară cale de a rula jocul este să trasați directorul pe love.exe sau o scurtătură a lui love.exe. Țineți minte să trasați directorul care conține fișierul <code>main.lua</code> și nu fișierul <code>main.lua</code> în sine.
 +
 +
Poți să rulezi jocul și din linia de comandă:
 +
 +
<source lang="powershell">
 +
"C:\Program Files\LOVE\love.exe" "C:\games\mygame"
 +
"C:\Program Files\LOVE\love.exe" "C:\games\joc-împachetat.love"
 +
</source>
 +
 +
Poți crea și o scurtătură pentru asta; crează o simplă scurtătură către love.exe, click stânga pe ea și selectează „Proprietăți”(Properties), iar apoi pune linia de comandă pe care o vrei în câmpul „Țintă”(Target) pentru scurtătură.
 +
 +
Pe Windows, există o opțiune a liniei de comandă care va atașa o consolă ferestrei, ceea ce îți permite să vezi rezultatele apelurilor <code>print</code> (echivalent cu setarea <code>t.console=true</code> în [[conf.lua]]):
 +
<source lang="bash">
 +
"C:\Program Files\LOVE\love.exe" --console
 +
</source>
 +
 +
----
 +
===Linux===
 +
 +
On Linux, you can use one of these command lines:
 +
 +
<source lang="bash">
 +
love /home/path/to/gamedir/
 +
love /home/path/to/packagedgame.love
 +
</source>
 +
 +
If you installed LÖVE system-wide, you can double click on .love files in your file manager as well.
 +
 +
----
 +
=== Mac OS X ===
 +
 +
On Mac OS X, a folder or .love file can be dropped onto the love application bundle. On the Mac Terminal (command line), you can use love like this (assuming it's installed to the Applications directory):
 +
 +
<source lang="bash">open -n -a love "~/path/to/mygame"</source>
 +
 +
However, the above method will not output printed text to the terminal window. To do that, you will need to execute the love binary inside the application bundle directly:
 +
 +
<source lang="bash">/Applications/love.app/Contents/MacOS/love ~/path/to/mygame</source>
 +
 +
You can set up an alias in your Terminal session to call the binary when you use <code>love</code> by adding an alias to your <code>~/.bash_profile</code>.
 +
 +
Open the file with
 +
<source lang="bash">open -a TextEdit ~/.bash_profile</source>
 +
 +
You may have to run
 +
<source lang="bash">touch ~/.bash_profile</source>
 +
first if the file does not yet exist.
 +
 +
Then paste in the following code and save the file:
 +
<source lang="bash">
 +
# alias to love
 +
alias love="/Applications/love.app/Contents/MacOS/love"
 +
</source>
 +
 +
Now you can call love from the command line like Linux and Windows:
 +
 +
<source lang="bash">
 +
love ~/path/to/mygame
 +
</source>
 +
 +
----
 +
=== Android ===
 +
As long as you have the love app installed from the playstore or another source the following methods will work:
 +
 +
*Method 1 Transfer your game folder to /sdcard/lovegame where main.lua is found at /sdcard/lovegame/main.lua. Then run the app.
 +
 +
*Method 2 Transfer a .love of your game to the device and click on it. Most file explorers will run the .love using the love app. If it does not you can install ES File Explorer which will. If you use Dropbox, you can use that to open .love files.
 +
 +
 +
----
 +
 +
=== iOS ===
 +
 +
In order to run LÖVE for iOS, it must first be compiled and installed. To do that, you’ll need Mac OS X, [https://developer.apple.com/xcode/ Xcode 7 or newer], and the LÖVE for iOS source code downloadable from the [https://love2d.org home page].
 +
 +
* If the <code>include</code> and <code>libraries</code> folders are not present in the <code>love/platform/xcode/ios</code> folder, [https://bitbucket.org/rude/love/downloads/love-0.10.0-ios-libraries.zip download them] and place them there. They contain the third-party library dependencies used by LÖVE.
 +
 +
* Open the Xcode project found at <code>love/platform/xcode/love.xcodeproj</code> and select the <code>love-ios</code> target in the dropdown menu at the top of the window.
 +
 +
* You may want to change the Build Configuration from Debug to Release for better performance, by opening the "Edit Scheme..." menu from the same dropdown selection.
 +
 +
* Choose either an iOS Simulator device or your plugged-in iOS device in the dropdown selection to the right of the previous one, and click the Build-and-Run ▶︎ button to the left, which will install LÖVE on the target device after compiling it.
 +
 +
LÖVE on iOS includes a simple list interface of games that are installed (until you [[Game Distribution|fuse]] a .love to it for distribution.)
 +
 +
* To put a .love file on the iOS Simulator after LÖVE is installed, drag the file onto the iOS Simulator’s window while it’s open. LÖVE will launch if it’s not running already. If another game is currently active you may need to quit LÖVE for the new game to show up (press Shift-Command-H twice to open the App Switcher menu on the iOS Simulator.)
 +
 +
* To put a .love file or game folder on your iOS device after LÖVE is installed, you can either download it with the Safari, or transfer it from your computer through iTunes when your device is connected: open iTunes, go to the iOS device which has LÖVE installed, go to the ‘Apps’ section and scroll down and find LÖVE, and add the .love file or game folder to LÖVE’s Documents section.
 +
 +
See the [[Game Distribution]] page for creating Fused LÖVE games on iOS and distributing them.
 +
 +
== Next steps ==
 +
* [[Tutorial:Callback_Functions]] will teach you the basic structure of a love game.
 +
* [[:Category:Tutorials]] are the next piece of reading
 +
 +
== Other Languages ==
 +
{{i18n|Getting_Started}}
 +
 +
[[Category:LÖVE]]

Revision as of 13:58, 25 June 2017

Obținerea LÖVE

Descarcă ultima versiune a framework-ului LÖVE de pe site, și instaleaz-o. Dacă ești pe Windows și nu vrei să „instalezi” LÖVE, poți pur și simplu să descarci executabilele arhivate și să le dezarhivezi oriunde vrei.

Pentru a afla ce versiune LÖVE este instalată, rulează următoarea comandă:

love --version

Crearea unui Joc

Pentru a crea un joc simplu, crează un director oriunde, și deschide editorul tău de text preferat. Sublime Text este unul destul de bun pentru toate sistemele de operare, și are suport integrat pentru Lua. Crează un nou fișier în directorul pe care l-ai creat și numește-l main.lua. Pune următorul cod în fișier și salvează-l.

function love.draw()
    love.graphics.print("Hello World", 400, 300)
end

Rularea Jocurilor

LÖVE poate porni un joc în două feluri:

  • Dintr-un director care conține un fișier main.lua.
  • Dintr-un fișier fișier .love care are un fișier main.lua în directorul rădăcină

Pentru a crea fișiere .love vezi Distribuirea Jocurilor.


Windows

ZeroBrane Studio, Sublime Text 2, Notepad++, și SciTE permit rularea jocurilor dinăuntrul editoarelor lor.

Altfel, cea mai ușoară cale de a rula jocul este să trasați directorul pe love.exe sau o scurtătură a lui love.exe. Țineți minte să trasați directorul care conține fișierul main.lua și nu fișierul main.lua în sine.

Poți să rulezi jocul și din linia de comandă:

"C:\Program Files\LOVE\love.exe" "C:\games\mygame"
"C:\Program Files\LOVE\love.exe" "C:\games\joc-împachetat.love"

Poți crea și o scurtătură pentru asta; crează o simplă scurtătură către love.exe, click stânga pe ea și selectează „Proprietăți”(Properties), iar apoi pune linia de comandă pe care o vrei în câmpul „Țintă”(Target) pentru scurtătură.

Pe Windows, există o opțiune a liniei de comandă care va atașa o consolă ferestrei, ceea ce îți permite să vezi rezultatele apelurilor print (echivalent cu setarea t.console=true în conf.lua):

"C:\Program Files\LOVE\love.exe" --console

Linux

On Linux, you can use one of these command lines:

love /home/path/to/gamedir/
love /home/path/to/packagedgame.love

If you installed LÖVE system-wide, you can double click on .love files in your file manager as well.


Mac OS X

On Mac OS X, a folder or .love file can be dropped onto the love application bundle. On the Mac Terminal (command line), you can use love like this (assuming it's installed to the Applications directory):

open -n -a love "~/path/to/mygame"

However, the above method will not output printed text to the terminal window. To do that, you will need to execute the love binary inside the application bundle directly:

/Applications/love.app/Contents/MacOS/love ~/path/to/mygame

You can set up an alias in your Terminal session to call the binary when you use love by adding an alias to your ~/.bash_profile.

Open the file with

open -a TextEdit ~/.bash_profile

You may have to run

touch ~/.bash_profile

first if the file does not yet exist.

Then paste in the following code and save the file:

# alias to love
alias love="/Applications/love.app/Contents/MacOS/love"

Now you can call love from the command line like Linux and Windows:

love ~/path/to/mygame

Android

As long as you have the love app installed from the playstore or another source the following methods will work:

  • Method 1 Transfer your game folder to /sdcard/lovegame where main.lua is found at /sdcard/lovegame/main.lua. Then run the app.
  • Method 2 Transfer a .love of your game to the device and click on it. Most file explorers will run the .love using the love app. If it does not you can install ES File Explorer which will. If you use Dropbox, you can use that to open .love files.



iOS

In order to run LÖVE for iOS, it must first be compiled and installed. To do that, you’ll need Mac OS X, Xcode 7 or newer, and the LÖVE for iOS source code downloadable from the home page.

  • If the include and libraries folders are not present in the love/platform/xcode/ios folder, download them and place them there. They contain the third-party library dependencies used by LÖVE.
  • Open the Xcode project found at love/platform/xcode/love.xcodeproj and select the love-ios target in the dropdown menu at the top of the window.
  • You may want to change the Build Configuration from Debug to Release for better performance, by opening the "Edit Scheme..." menu from the same dropdown selection.
  • Choose either an iOS Simulator device or your plugged-in iOS device in the dropdown selection to the right of the previous one, and click the Build-and-Run ▶︎ button to the left, which will install LÖVE on the target device after compiling it.

LÖVE on iOS includes a simple list interface of games that are installed (until you fuse a .love to it for distribution.)

  • To put a .love file on the iOS Simulator after LÖVE is installed, drag the file onto the iOS Simulator’s window while it’s open. LÖVE will launch if it’s not running already. If another game is currently active you may need to quit LÖVE for the new game to show up (press Shift-Command-H twice to open the App Switcher menu on the iOS Simulator.)
  • To put a .love file or game folder on your iOS device after LÖVE is installed, you can either download it with the Safari, or transfer it from your computer through iTunes when your device is connected: open iTunes, go to the iOS device which has LÖVE installed, go to the ‘Apps’ section and scroll down and find LÖVE, and add the .love file or game folder to LÖVE’s Documents section.

See the Game Distribution page for creating Fused LÖVE games on iOS and distributing them.

Next steps

Other Languages