Browse Source

rm fenced codeblocks;

bjorn 2 years ago
parent
commit
44b90fac3b

File diff suppressed because it is too large
+ 794 - 1465
api/init.lua


+ 1 - 3
api/lovr/filesystem/getSaveDirectory.lua

@@ -12,9 +12,7 @@ return {
   notes = [[
   notes = [[
     The save directory takes the following form:
     The save directory takes the following form:
 
 
-    ```
-    <appdata>/LOVR/<identity>
-    ```
+        <appdata>/LOVR/<identity>
 
 
     Where `<appdata>` is `lovr.filesystem.getAppdataDirectory` and `<identity>` is
     Where `<appdata>` is `lovr.filesystem.getAppdataDirectory` and `<identity>` is
     `lovr.filesystem.getIdentity` and can be customized using `lovr.conf`.
     `lovr.filesystem.getIdentity` and can be customized using `lovr.conf`.

+ 8 - 0
api/lovr/filesystem/init.lua

@@ -15,6 +15,14 @@ return {
         <td>macOS</td>
         <td>macOS</td>
         <td><code>/Users/&lt;user&gt;/Library/Application Support/LOVR/&lt;identity&gt;</code></td>
         <td><code>/Users/&lt;user&gt;/Library/Application Support/LOVR/&lt;identity&gt;</code></td>
       </tr>
       </tr>
+      <tr>
+        <td>Linux</td>
+        <td><code>/home/&lt;user&gt;/.local/share/LOVR/&lt;identity&gt;</code></td>
+      </tr>
+      <tr>
+        <td>Android</td>
+        <td><code>/sdcard/Android/data/&lt;identity&gt;/files</code></td>
+      </tr>
     </table>
     </table>
 
 
     `<identity>` should be a unique identifier for your app.  It can be set either in `lovr.conf` or
     `<identity>` should be a unique identifier for your app.  It can be set either in `lovr.conf` or

+ 95 - 99
guides/Callbacks_and_Modules.md

@@ -20,32 +20,30 @@ Callbacks
 There are various callbacks that can be used for interesting things.  Three of the most used ones
 There are various callbacks that can be used for interesting things.  Three of the most used ones
 are `lovr.load`, `lovr.update`, and `lovr.draw`.  A simple project skeleton might look like this:
 are `lovr.load`, `lovr.update`, and `lovr.draw`.  A simple project skeleton might look like this:
 
 
-```
-function lovr.load()
-  -- This is called once on load.
-  --
-  -- You can use it to load assets and set everything up.
+    function lovr.load()
+      -- This is called once on load.
+      --
+      -- You can use it to load assets and set everything up.
 
 
-  print('loaded!')
-end
+      print('loaded!')
+    end
 
 
-function lovr.update(dt)
-  -- This is called continuously and is passed the "delta time" as dt, which
-  -- is the number of seconds elapsed since the last update.
-  --
-  -- You can use it to simulate physics or update game logic.
+    function lovr.update(dt)
+      -- This is called continuously and is passed the "delta time" as dt, which
+      -- is the number of seconds elapsed since the last update.
+      --
+      -- You can use it to simulate physics or update game logic.
 
 
-  print('updating', dt)
-end
+      print('updating', dt)
+    end
 
 
-function lovr.draw()
-  -- This is called once every frame.
-  --
-  -- You can use it to render the scene.
+    function lovr.draw()
+      -- This is called once every frame.
+      --
+      -- You can use it to render the scene.
 
 
-  print('rendering')
-end
-```
+      print('rendering')
+    end
 
 
 By filling in the different callbacks you can start to define the behavior of an app.
 By filling in the different callbacks you can start to define the behavior of an app.
 
 
@@ -99,25 +97,23 @@ play area, so the origin is on the ground in the middle of the play space.
 
 
 You've already seen `lovr.graphics.print`, but here's another example:
 You've already seen `lovr.graphics.print`, but here's another example:
 
 
-```
-function lovr.load()
-  -- Load a 3D model
-  model = lovr.graphics.newModel('monkey.obj')
-end
+    function lovr.load()
+      -- Load a 3D model
+      model = lovr.graphics.newModel('monkey.obj')
+    end
 
 
-function lovr.draw()
-  -- Use a dark grey background
-  lovr.graphics.setBackgroundColor(.2, .2, .2)
+    function lovr.draw()
+      -- Use a dark grey background
+      lovr.graphics.setBackgroundColor(.2, .2, .2)
 
 
-  -- Draw the model
-  lovr.graphics.setColor(1.0, 1.0, 1.0)
-  model:draw(-.5, 1, -3)
+      -- Draw the model
+      lovr.graphics.setColor(1.0, 1.0, 1.0)
+      model:draw(-.5, 1, -3)
 
 
-  -- Draw a red cube using the "cube" primitive
-  lovr.graphics.setColor(1.0, 0, 0)
-  lovr.graphics.cube('fill', .5, 1, -3, .5, lovr.timer.getTime())
-end
-```
+      -- Draw a red cube using the "cube" primitive
+      lovr.graphics.setColor(1.0, 0, 0)
+      lovr.graphics.cube('fill', .5, 1, -3, .5, lovr.timer.getTime())
+    end
 
 
 lovr.headset
 lovr.headset
 ---
 ---
@@ -139,12 +135,10 @@ functions can be used to figure out the state of buttons and other controls on t
 
 
 Here's a simple example that draws a sphere in the "opposite" position of the headset:
 Here's a simple example that draws a sphere in the "opposite" position of the headset:
 
 
-```
-function lovr.draw()
-  local x, y, z = lovr.headset.getPosition()
-  lovr.graphics.sphere(-x, y, -z, .1)
-end
-```
+    function lovr.draw()
+      local x, y, z = lovr.headset.getPosition()
+      lovr.graphics.sphere(-x, y, -z, .1)
+    end
 
 
 lovr.audio
 lovr.audio
 ---
 ---
@@ -155,13 +149,11 @@ directions, which are used to make things sound realistic as the headset moves a
 Each instance of a sound is called a `Source`.  To create a sources, use `lovr.audio.newSource` and
 Each instance of a sound is called a `Source`.  To create a sources, use `lovr.audio.newSource` and
 pass it an ogg file.  You can then call `play` on the source to play it.
 pass it an ogg file.  You can then call `play` on the source to play it.
 
 
-```
-function lovr.load()
-  ambience = lovr.audio.newSource('background.ogg')
-  ambience:setLooping(true)
-  ambience:play()
-end
-```
+    function lovr.load()
+      ambience = lovr.audio.newSource('background.ogg')
+      ambience:setLooping(true)
+      ambience:play()
+    end
 
 
 See the `Source` page for more information.
 See the `Source` page for more information.
 
 
@@ -181,59 +173,63 @@ forces applied it.  The world should be updated in `lovr.update` using the `dt`
 
 
 Here's an example that makes a tower of boxes that you can knock down with controllers:
 Here's an example that makes a tower of boxes that you can knock down with controllers:
 
 
-```
-function lovr.load()
-  world = lovr.physics.newWorld()
+    function lovr.load()
+      world = lovr.physics.newWorld()
+
+      -- Create the ground
+      world:newBoxCollider(0, 0, 0, 5, .01, 5):setKinematic(true)
 
 
-  -- Create the ground
-  world:newBoxCollider(0, 0, 0, 5, .01, 5):setKinematic(true)
+      -- Create boxes!
+      boxes = {}
+      for x = -1, 1, .25 do
+        for y = .125, 2, .25 do
+          local box = world:newBoxCollider(x, y, -1, .25)
+          table.insert(boxes, box)
+        end
+      end
 
 
-  -- Create boxes!
-  boxes = {}
-  for x = -1, 1, .25 do
-    for y = .125, 2, .25 do
-      local box = world:newBoxCollider(x, y, -1, .25)
-      table.insert(boxes, box)
+      -- Each controller is going to have a collider attached to it
+      controllerBoxes = {}
     end
     end
-  end
-
-  -- Each controller is going to have a collider attached to it
-  controllerBoxes = {}
-end
-
-function lovr.update(dt)
-  -- Synchronize controllerBoxes with the active controllers
-  for i, hand in ipairs(lovr.headset.getHands()) do
-    if not controllerBoxes[i] then
-      controllerBoxes[i] = world:newBoxCollider(0, 0, 0, .25)
-      controllerBoxes[i]:setKinematic(true)
+
+    function lovr.update(dt)
+      -- Synchronize controllerBoxes with the active controllers
+      for i, hand in ipairs(lovr.headset.getHands()) do
+        if not controllerBoxes[i] then
+          controllerBoxes[i] = world:newBoxCollider(0, 0, 0, .25)
+          controllerBoxes[i]:setKinematic(true)
+        end
+        controllerBoxes[i]:setPosition(lovr.headset.getPosition(hand))
+        controllerBoxes[i]:setOrientation(lovr.headset.getOrientation(hand))
+      end
+
+      -- Update the physics simulation
+      world:update(dt)
+    end
+
+    -- A helper function for drawing boxes
+    function drawBox(pass, box)
+      local x, y, z = box:getPosition()
+      pass:cube(x, y, z, .25, quat(box:getOrientation()), 'line')
+    end
+
+    -- A helper function for drawing boxes
+    function drawBox(box)
+      local x, y, z = box:getPosition()
+      lovr.graphics.cube('line', x, y, z, .25, box:getOrientation())
+    end
+
+    function lovr.draw()
+      lovr.graphics.setColor(1.0, 0, 0)
+      for i, box in ipairs(boxes) do
+        drawBox(box)
+      end
+
+      lovr.graphics.setColor(0, 0, 1.0)
+      for i, box in ipairs(controllerBoxes) do
+        drawBox(box)
+      end
     end
     end
-    controllerBoxes[i]:setPosition(lovr.headset.getPosition(hand))
-    controllerBoxes[i]:setOrientation(lovr.headset.getOrientation(hand))
-  end
-
-  -- Update the physics simulation
-  world:update(dt)
-end
-
--- A helper function for drawing boxes
-function drawBox(box)
-  local x, y, z = box:getPosition()
-  lovr.graphics.cube('line', x, y, z, .25, box:getOrientation())
-end
-
-function lovr.draw()
-  lovr.graphics.setColor(1.0, 0, 0)
-  for i, box in ipairs(boxes) do
-    drawBox(box)
-  end
-
-  lovr.graphics.setColor(0, 0, 1.0)
-  for i, box in ipairs(controllerBoxes) do
-    drawBox(box)
-  end
-end
-```
 
 
 Next Steps
 Next Steps
 ---
 ---

+ 28 - 54
guides/Compiling.md

@@ -29,12 +29,10 @@ Windows
 From the lovr folder, run these commands to create a build folder and compile the project using
 From the lovr folder, run these commands to create a build folder and compile the project using
 CMake:
 CMake:
 
 
-```
-$ mkdir build
-$ cd build
-$ cmake ..
-$ cmake --build .
-```
+    $ mkdir build
+    $ cd build
+    $ cmake ..
+    $ cmake --build .
 
 
 The executable will then exist at `/path/to/lovr/build/Debug/lovr.exe`.  A LÖVR project (a folder
 The executable will then exist at `/path/to/lovr/build/Debug/lovr.exe`.  A LÖVR project (a folder
 containing a `main.lua` script) can then be dropped onto `lovr.exe` to run it, or it can be run
 containing a `main.lua` script) can then be dropped onto `lovr.exe` to run it, or it can be run
@@ -45,26 +43,20 @@ macOS
 
 
 Install the dependencies using your package manager of choice:
 Install the dependencies using your package manager of choice:
 
 
-```
-$ brew install glfw3 luajit physfs openal-soft ode libccd
-```
+    $ brew install glfw3 luajit physfs openal-soft ode libccd
 
 
 Next, build using CMake, as above:
 Next, build using CMake, as above:
 
 
-```
-$ mkdir build
-$ cd build
-$ cmake ..
-$ cmake --build .
-```
+    $ mkdir build
+    $ cd build
+    $ cmake ..
+    $ cmake --build .
 
 
 The lovr executable should exist in `lovr/build` now.  It's recommended to set up an alias or
 The lovr executable should exist in `lovr/build` now.  It's recommended to set up an alias or
 symlink so that this executable can be found in your PATH environment variable.  Once that's done,
 symlink so that this executable can be found in your PATH environment variable.  Once that's done,
 you can run a project like this:
 you can run a project like this:
 
 
-```
-$ lovr /path/to/myGame
-```
+    $ lovr /path/to/myGame
 
 
 > You may need to set the `PKG_CONFIG_PATH` environment variable for OpenAL to be located properly.
 > You may need to set the `PKG_CONFIG_PATH` environment variable for OpenAL to be located properly.
 > If you run into this, see [Troubleshooting](#troubleshooting) below for more info.
 > If you run into this, see [Troubleshooting](#troubleshooting) below for more info.
@@ -76,40 +68,30 @@ First, install the dependencies using your package manager of choice.
 
 
 #### Arch Linux
 #### Arch Linux
 
 
-```
-$ pacman -S glfw-x11 luajit physfs openal ode
-```
+    $ pacman -S glfw-x11 luajit physfs openal ode
 
 
 #### Debian/Ubuntu
 #### Debian/Ubuntu
 
 
-```
-$ sudo apt install build-essential cmake xorg-dev libglfw3-dev libluajit-5.1-dev libphysfs-dev libopenal-dev libode-dev libccd-dev libenet-dev
-```
+    $ sudo apt install build-essential cmake xorg-dev libglfw3-dev libluajit-5.1-dev libphysfs-dev libopenal-dev libode-dev libccd-dev libenet-dev
 
 
 Then, build with CMake:
 Then, build with CMake:
 
 
-```
-$ mkdir build
-$ cd build
-$ cmake ..
-$ cmake --build .
-```
+    $ mkdir build
+    $ cd build
+    $ cmake ..
+    $ cmake --build .
 
 
 On Linux, LÖVR needs to run within the Steam Runtime.  To do this, first [install
 On Linux, LÖVR needs to run within the Steam Runtime.  To do this, first [install
 Steam](https://wiki.archlinux.org/index.php/Steam#Installation).  Next, [install the Steam udev
 Steam](https://wiki.archlinux.org/index.php/Steam#Installation).  Next, [install the Steam udev
 rules](https://github.com/ValveSoftware/SteamVR-for-Linux#usb-device-requirements).  Then, run LÖVR
 rules](https://github.com/ValveSoftware/SteamVR-for-Linux#usb-device-requirements).  Then, run LÖVR
 within the Steam runtime:
 within the Steam runtime:
 
 
-```
-$ ~/.steam/steam/ubuntu12_32/steam-runtime/run.sh lovr
-```
+    $ ~/.steam/steam/ubuntu12_32/steam-runtime/run.sh lovr
 
 
 If you receive errors related to `libstdc++`, set the `LD_PRELOAD` environment variable when running
 If you receive errors related to `libstdc++`, set the `LD_PRELOAD` environment variable when running
 the command:
 the command:
 
 
-```
-$ LD_PRELOAD='/usr/$LIB/libstdc++.so.6 /usr/$LIB/libgcc_s.so.1' ~/.steam/steam/ubuntu12_32/steam-runtime/run.sh lovr
-```
+    $ LD_PRELOAD='/usr/$LIB/libstdc++.so.6 /usr/$LIB/libgcc_s.so.1' ~/.steam/steam/ubuntu12_32/steam-runtime/run.sh lovr
 
 
 WebVR
 WebVR
 ---
 ---
@@ -118,34 +100,26 @@ First, [install the Emscripten SDK](https://emscripten.org/docs/getting_started/
 
 
 Unix:
 Unix:
 
 
-```
-$ mkdir build
-$ cd build
-$ emcmake cmake ..
-$ emmake make -j2
-```
+    $ mkdir build
+    $ cd build
+    $ emcmake cmake ..
+    $ emmake make -j2
 
 
 Windows (from a Visual Studio Command Prompt, make sure the Emscripten SDK is on PATH):
 Windows (from a Visual Studio Command Prompt, make sure the Emscripten SDK is on PATH):
 
 
-```
-$ mkdir build
-$ cd build
-$ emcmake cmake -G "NMake Makefiles" ..
-$ emmake nmake
-```
+    $ mkdir build
+    $ cd build
+    $ emcmake cmake -G "NMake Makefiles" ..
+    $ emmake nmake
 
 
 The above commands will output `lovr.js`, `lovr.wasm`, and `lovr.html`.  The easiest way to run LÖVR
 The above commands will output `lovr.js`, `lovr.wasm`, and `lovr.html`.  The easiest way to run LÖVR
 from here is to use `emrun`:
 from here is to use `emrun`:
 
 
-```
-$ emrun --browser firefox lovr.html
-```
+    $ emrun --browser firefox lovr.html
 
 
 To package a game, run:
 To package a game, run:
 
 
-```
-$ python "$EMSCRIPTEN/tools/file_packager.py" game.data --no-heap-copy --preload /path/to/game@/ --js-output=game.js
-```
+    $ python "$EMSCRIPTEN/tools/file_packager.py" game.data --no-heap-copy --preload /path/to/game@/ --js-output=game.js
 
 
 Which will output `game.js` and `game.data`.  You can then include the `game.js` script on the HTML
 Which will output `game.js` and `game.data`.  You can then include the `game.js` script on the HTML
 page (before the lovr.js script tag) to run the project.
 page (before the lovr.js script tag) to run the project.

+ 2 - 6
guides/Distribution.md

@@ -12,9 +12,7 @@ contents.  On Windows you can select all the files in a project (**not** the pro
 click them, and choose "Send to" -> "Compressed (zip) folder".  On Unix systems, the `zip` utility
 click them, and choose "Send to" -> "Compressed (zip) folder".  On Unix systems, the `zip` utility
 can be used:
 can be used:
 
 
-```
-$ zip -9qr .
-```
+    $ zip -9qr .
 
 
 A zip archive can be run with LÖVR but isn't a standalone executable yet.
 A zip archive can be run with LÖVR but isn't a standalone executable yet.
 
 
@@ -24,9 +22,7 @@ Creating an Executable
 Once you have a project archive, it can be appended to the LÖVR binary to create a standalone
 Once you have a project archive, it can be appended to the LÖVR binary to create a standalone
 executable.  On Windows, this can be done using the command prompt:
 executable.  On Windows, this can be done using the command prompt:
 
 
-```
-$ copy /b lovr.exe+MyProject.zip MyProject.exe
-```
+    $ copy /b lovr.exe+MyProject.zip MyProject.exe
 
 
 On Unix systems, the `cat` utility can be used to concatenate the two files.
 On Unix systems, the `cat` utility can be used to concatenate the two files.
 
 

+ 5 - 7
guides/Getting_Started.md

@@ -36,15 +36,13 @@ file in your project folder, LÖVR will run the code in there when the project s
 
 
 Create a file called `main.lua` in a project folder and type the following Lua code in it:
 Create a file called `main.lua` in a project folder and type the following Lua code in it:
 
 
-```
-function lovr.draw()
-  lovr.graphics.print('hello world', 0, 1.7, -3, .5)
-end
-```
+    function lovr.draw()
+      lovr.graphics.print('hello world', 0, 1.7, -3, .5)
+    end
 
 
 Don't worry if you're confused about the code, it's not important to understand it all right now.
 Don't worry if you're confused about the code, it's not important to understand it all right now.
-In short, we declared the `lovr.draw` callback and used `lovr.graphics.print` in there to render
-some text in the world.  We'll learn more about how this works in the next guide.
+In short, we declared the `lovr.draw` callback and used `Pass:text` in there to render some text in
+the world.  We'll learn more about how this works in the next guide.
 
 
 Running a Project
 Running a Project
 ---
 ---

+ 5 - 11
guides/Getting_Started_(Android).md

@@ -26,9 +26,7 @@ page](https://github.com/mcclure/lovr-oculus-mobile/releases).
 
 
 Install it to the device:
 Install it to the device:
 
 
-```
-$ adb install /path/to/test-release.apk
-```
+    $ adb install /path/to/test-release.apk
 
 
 Try running it by navigating to the "Library" -> "Unknown Sources" menu of the headset and running
 Try running it by navigating to the "Library" -> "Unknown Sources" menu of the headset and running
 the `org.lovr.test` app.  You should see a message about how to upload files.
 the `org.lovr.test` app.  You should see a message about how to upload files.
@@ -39,17 +37,13 @@ Running a Project
 Now we can create a LÖVR project, which is a folder with some code and assets in it.  Create a
 Now we can create a LÖVR project, which is a folder with some code and assets in it.  Create a
 folder called `hello-world` and add this code to a file named `main.lua` in there:
 folder called `hello-world` and add this code to a file named `main.lua` in there:
 
 
-```
-function lovr.draw()
-  lovr.graphics.print('hello world', 0, 1.7, -3, .5)
-end
-```
+    function lovr.draw()
+      lovr.graphics.print('hello world', 0, 1.7, -3, .5)
+    end
 
 
 Then use `adb` to sync it to the device:
 Then use `adb` to sync it to the device:
 
 
-```
-$ adb push --sync /path/to/hello-world/. /sdcard/Android/data/org.lovr.test/files/.lodr
-```
+    $ adb push --sync /path/to/hello-world/. /sdcard/Android/data/org.lovr.test/files/.lodr
 
 
 You should see the "hello world" message!
 You should see the "hello world" message!
 
 

+ 5 - 7
guides/Libraries.md

@@ -6,14 +6,12 @@ the capabilities of LÖVR and others just make it easier to get stuff done.  Lib
 distributed as a single Lua file.  You can copy the Lua file into your project and `require` it to
 distributed as a single Lua file.  You can copy the Lua file into your project and `require` it to
 use the library:
 use the library:
 
 
-```
--- library.lua is sitting next to our main.lua here
-local lib = require('library')
+    -- library.lua is sitting next to our main.lua here
+    local lib = require('library')
 
 
-function lovr.load()
-  lib.doStuff()
-end
-```
+    function lovr.load()
+      lib.doStuff()
+    end
 
 
 Below is a catalog of useful libraries.  All of them can be used with LÖVR, although some of them
 Below is a catalog of useful libraries.  All of them can be used with LÖVR, although some of them
 only depend on Lua and aren't specific to LÖVR.
 only depend on Lua and aren't specific to LÖVR.

Some files were not shown because too many files changed in this diff