Browse Source

rm fenced codeblocks;

bjorn 2 years ago
parent
commit
afca132928

+ 1 - 1
api/init.lua

@@ -1876,7 +1876,7 @@ return {
       description = "The `lovr.filesystem` module provides access to the filesystem.",
       description = "The `lovr.filesystem` module provides access to the filesystem.",
       key = "lovr.filesystem",
       key = "lovr.filesystem",
       enums = {},
       enums = {},
-      notes = "LÖVR programs can only write to a single directory, called the save directory.  The location of the save directory is platform-specific:\n\n<table>\n  <tr>\n    <td>Windows</td>\n    <td><code>C:\\Users\\&lt;user&gt;\\AppData\\Roaming\\LOVR\\&lt;identity&gt;</code></td>\n  </tr>\n  <tr>\n    <td>macOS</td>\n    <td><code>/Users/&lt;user&gt;/Library/Application Support/LOVR/&lt;identity&gt;</code></td>\n  </tr> </table>\n\n`<identity>` should be a unique identifier for your app.  It can be set either in `lovr.conf` or by using `lovr.filesystem.setIdentity`.\n\nAll filenames are relative to either the save directory or the directory containing the project source.  Files in the save directory take precedence over files in the project.",
+      notes = "LÖVR programs can only write to a single directory, called the save directory.  The location of the save directory is platform-specific:\n\n<table>\n  <tr>\n    <td>Windows</td>\n    <td><code>C:\\Users\\&lt;user&gt;\\AppData\\Roaming\\LOVR\\&lt;identity&gt;</code></td>\n  </tr>\n  <tr>\n    <td>macOS</td>\n    <td><code>/Users/&lt;user&gt;/Library/Application Support/LOVR/&lt;identity&gt;</code></td>\n  </tr>\n  <tr>\n    <td>Linux</td>\n    <td><code>/home/&lt;user&gt;/.local/share/LOVR/&lt;identity&gt;</code></td>\n  </tr>\n  <tr>\n    <td>Android</td>\n    <td><code>/sdcard/Android/data/&lt;identity&gt;/files</code></td>\n  </tr> </table>\n\n`<identity>` should be a unique identifier for your app.  It can be set either in `lovr.conf` or by using `lovr.filesystem.setIdentity`.\n\nAll filenames are relative to either the save directory or the directory containing the project source.  Files in the save directory take precedence over files in the project.",
       functions = {
       functions = {
         {
         {
           name = "append",
           name = "append",

+ 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(eye)
-  -- This is called twice every frame (once for each eye).
-  --
-  -- You can use it to render the scene.
+    function lovr.draw(eye)
+      -- This is called twice every frame (once for each eye).
+      --
+      -- You can use it to render the scene.
 
 
-  print('rendering the ' .. eye .. ' eye')
-end
-```
+      print('rendering the ' .. eye .. ' eye')
+    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 model with a texture
-  model = lovr.graphics.newModel('monkey.obj', 'monkey.png')
-end
+    function lovr.load()
+      -- Load a model with a texture
+      model = lovr.graphics.newModel('monkey.obj', 'monkey.png')
+    end
 
 
-function lovr.draw()
-  -- Use a dark grey background
-  lovr.graphics.setBackgroundColor(50, 50, 50)
+    function lovr.draw()
+      -- Use a dark grey background
+      lovr.graphics.setBackgroundColor(50, 50, 50)
 
 
-  -- Draw the model
-  lovr.graphics.setColor(255, 255, 255)
-  model:draw(-.5, 1, -3)
+      -- Draw the model
+      lovr.graphics.setColor(255, 255, 255)
+      model:draw(-.5, 1, -3)
 
 
-  -- Draw a red cube using the "cube" primitive
-  lovr.graphics.setColor(255, 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(255, 0, 0)
+      lovr.graphics.cube('fill', .5, 1, -3, .5, lovr.timer.getTime())
+    end
 
 
 lovr.headset
 lovr.headset
 ---
 ---
@@ -145,12 +141,10 @@ a similar callback for `controllerreleased`.
 
 
 Here's an example that draws a sphere in the "opposite" position of the headset:
 Here's an 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
 ---
 ---
@@ -161,13 +155,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.
 
 
@@ -187,59 +179,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, controller in ipairs(lovr.headset.getControllers()) 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, controller in ipairs(lovr.headset.getControllers()) do
+        if not controllerBoxes[i] then
+          controllerBoxes[i] = world:newBoxCollider(0, 0, 0, .25)
+          controllerBoxes[i]:setKinematic(true)
+        end
+        controllerBoxes[i]:setPosition(controller:getPosition())
+        controllerBoxes[i]:setOrientation(controller:getOrientation())
+      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(255, 0, 0)
+      for i, box in ipairs(boxes) do
+        drawBox(box)
+      end
+
+      lovr.graphics.setColor(0, 0, 255)
+      for i, box in ipairs(controllerBoxes) do
+        drawBox(box)
+      end
     end
     end
-    controllerBoxes[i]:setPosition(controller:getPosition())
-    controllerBoxes[i]:setOrientation(controller:getOrientation())
-  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(255, 0, 0)
-  for i, box in ipairs(boxes) do
-    drawBox(box)
-  end
-
-  lovr.graphics.setColor(0, 0, 255)
-  for i, box in ipairs(controllerBoxes) do
-    drawBox(box)
-  end
-end
-```
 
 
 Next Steps
 Next Steps
 ---
 ---

+ 27 - 51
guides/Compiling.md

@@ -23,9 +23,7 @@ Dependencies
 These can be found as submodules in the `deps` directory of the repository.  To initialize the
 These can be found as submodules in the `deps` directory of the repository.  To initialize the
 submodules, clone LÖVR with the `--recursive` option or run this command in an existing repo:
 submodules, clone LÖVR with the `--recursive` option or run this command in an existing repo:
 
 
-```
-git submodule update --init
-```
+    git submodule update --init
 
 
 Windows
 Windows
 ---
 ---
@@ -33,12 +31,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
@@ -49,59 +45,45 @@ macOS
 
 
 Install the dependencies using your package manager of choice:
 Install the dependencies using your package manager of choice:
 
 
-```
-brew install assimp glfw3 luajit physfs freetype openal-soft ode
-```
+    brew install assimp glfw3 luajit physfs freetype openal-soft ode
 
 
 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 exists on your path.  Once that's done, you can run a game like this:
 symlink so that this executable exists on your path.  Once that's done, you can run a game like this:
 
 
-```
-lovr /path/to/myGame
-```
+    lovr /path/to/myGame
 
 
 Linux
 Linux
 ---
 ---
 
 
 On Arch Linux, first install necessary dependencies:
 On Arch Linux, first install necessary dependencies:
 
 
-```
-pacman -S assimp glfw-x11 luajit physfs freetype2 openal ode
-```
+    pacman -S assimp glfw-x11 luajit physfs freetype2 openal ode
 
 
 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
 
 
 Currently, there are performance issues between SteamVR and OpenGL apps.  These are being rapidly
 Currently, there are performance issues between SteamVR and OpenGL apps.  These are being rapidly
 resolved with newer versions of graphics drivers and SteamVR.
 resolved with newer versions of graphics drivers and SteamVR.
@@ -114,27 +96,21 @@ branch](https://github.com/bjornbytes/emscripten/tree/lovr) of Emscripten.
 
 
 Unix:
 Unix:
 
 
-```
-mkdir build
-cd build
-emcmake cmake -DCMAKE_BUILD_TYPE=Release ..
-emmake make -j2
-```
+    mkdir build
+    cd build
+    emcmake cmake -DCMAKE_BUILD_TYPE=Release ..
+    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.html`, `lovr.js`, and `lovr.js.mem`.  To package a game, run:
 The above commands will output `lovr.html`, `lovr.js`, and `lovr.js.mem`.  To package a game, run:
 
 
-```
-python /path/to/emscripten/tools/file_packager.py game.data --preload /path/to/game@/ --js-output=game.js
-```
+    python /path/to/emscripten/tools/file_packager.py game.data --preload /path/to/game@/ --js-output=game.js
 
 
 Which will output `game.js` and `game.data`.  The `lovr.html` file will need to be modified to
 Which will output `game.js` and `game.data`.  The `lovr.html` file will need to be modified to
 include `game.js` in a script tag.
 include `game.js` in a script tag.

+ 2 - 6
guides/Distribution.md

@@ -12,9 +12,7 @@ its contents.  On Windows you can select all the files in a project (**not** the
 right click them, and choose "Send to" -> "Compressed (zip) folder".  On Unix systems, the `zip`
 right click them, and choose "Send to" -> "Compressed (zip) folder".  On Unix systems, the `zip`
 utility can be used:
 utility 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 - 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.