2016-07-10 23:25:40 +00:00
|
|
|
LÖVR
|
2016-08-01 00:47:28 +00:00
|
|
|
===
|
2016-07-10 23:25:40 +00:00
|
|
|
|
2016-09-30 07:17:35 +00:00
|
|
|
LÖVR lets you make VR games with Lua!
|
2016-08-01 00:47:28 +00:00
|
|
|
|
|
|
|
Example
|
|
|
|
---
|
|
|
|
|
2016-09-30 07:17:35 +00:00
|
|
|
In a folder called `myGame`, create a file called `main.lua` with this in it:
|
2016-08-01 00:47:28 +00:00
|
|
|
|
2016-08-01 00:48:08 +00:00
|
|
|
```lua
|
2016-08-01 00:47:28 +00:00
|
|
|
function lovr.update(dt)
|
2016-09-30 07:17:35 +00:00
|
|
|
t = (t or 0) + dt
|
2016-08-01 00:47:28 +00:00
|
|
|
end
|
|
|
|
|
2016-09-30 07:17:35 +00:00
|
|
|
function lovr.draw(eye)
|
|
|
|
lovr.graphics.setColor(80, 0, 160)
|
|
|
|
lovr.graphics.translate(0, 1, -1)
|
|
|
|
lovr.graphics.rotate(t * 2, .70, .70, 0)
|
|
|
|
lovr.graphics.translate(0, -1, 1)
|
|
|
|
lovr.graphics.cube(0, 1, -1, 1)
|
|
|
|
end
|
2016-08-01 00:47:28 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
|
2016-09-30 07:17:35 +00:00
|
|
|
Drag the `myGame` folder onto a shortcut to `lovr.exe`. You should see a spinning purple cube! See instructions below on compiling `lovr.exe`.
|
|
|
|
|
2016-08-01 00:47:28 +00:00
|
|
|
Dependencies
|
|
|
|
---
|
|
|
|
|
|
|
|
- LuaJIT
|
2016-08-10 06:45:33 +00:00
|
|
|
- GLFW (3.2+) and OpenGL (3.2+)
|
2016-08-01 00:47:28 +00:00
|
|
|
- assimp
|
2016-09-30 07:17:35 +00:00
|
|
|
- SteamVR (OpenVR)
|
2016-08-01 00:47:28 +00:00
|
|
|
|
2016-09-18 01:18:16 +00:00
|
|
|
Supported Hardware
|
|
|
|
---
|
|
|
|
|
|
|
|
- HTC Vive
|
|
|
|
|
2016-09-30 07:17:35 +00:00
|
|
|
Support for other hardware will happen eventually.
|
|
|
|
|
2016-08-10 06:42:30 +00:00
|
|
|
Compiling
|
2016-08-01 00:47:28 +00:00
|
|
|
---
|
|
|
|
|
2016-08-10 08:18:45 +00:00
|
|
|
### Windows (CMake)
|
|
|
|
|
2016-08-10 08:20:05 +00:00
|
|
|
- Install [lovr-deps](https://github.com/bjornbytes/lovr-deps):
|
2016-08-10 08:18:45 +00:00
|
|
|
|
|
|
|
```sh
|
2016-08-10 08:20:05 +00:00
|
|
|
cd lovr
|
|
|
|
git clone --recursive https://github.com/bjornbytes/lovr-deps deps
|
2016-08-10 08:18:45 +00:00
|
|
|
```
|
|
|
|
|
2016-09-17 03:18:53 +00:00
|
|
|
Next, build using the CMake GUI or using the CMake command line.
|
2016-08-10 06:42:30 +00:00
|
|
|
|
2016-08-01 00:48:08 +00:00
|
|
|
```sh
|
2016-08-01 00:47:28 +00:00
|
|
|
mkdir build
|
|
|
|
cd build
|
2016-09-17 03:18:53 +00:00
|
|
|
cmake ..
|
2016-08-10 08:18:45 +00:00
|
|
|
```
|
|
|
|
|
2016-09-30 07:17:35 +00:00
|
|
|
This should output a Visual Studio solution, which can be built using Visual Studio. Or you can just build it with CMake:
|
2016-08-10 08:18:45 +00:00
|
|
|
|
|
|
|
```sh
|
|
|
|
cmake --build .
|
2016-08-01 00:47:28 +00:00
|
|
|
```
|
2016-08-10 06:42:30 +00:00
|
|
|
|
2016-09-30 07:17:35 +00:00
|
|
|
The executable will then exist at `/path/to/lovr/build/Debug/lovr.exe`. The recommended way to create and run a game from this point is:
|
|
|
|
|
|
|
|
- Create a shortcut to the `lovr.exe` executable somewhere convenient.
|
|
|
|
- Create a folder for your game: `MySuperAwesomeGame`.
|
|
|
|
- Create a `main.lua` file in the folder and put your code in there.
|
|
|
|
- Drag the `MySuperAwesomeGame` folder onto the shortcut to `lovr.exe`.
|
2016-09-17 03:18:53 +00:00
|
|
|
|
2016-08-10 08:18:45 +00:00
|
|
|
### OSX (tup)
|
2016-08-10 06:42:30 +00:00
|
|
|
|
2016-09-17 03:18:53 +00:00
|
|
|
Used for development, not generally recommended.
|
|
|
|
|
2016-09-30 07:19:40 +00:00
|
|
|
One-time setup:
|
|
|
|
|
2016-08-10 06:42:30 +00:00
|
|
|
```sh
|
2016-09-17 03:18:53 +00:00
|
|
|
cd lovr
|
|
|
|
git clone git@github.com:ValveSoftware/openvr ..
|
|
|
|
export DYLD_LIBRARY_PATH=`pwd`/../openvr/lib/osx32
|
|
|
|
brew install assimp glfw3 luajit
|
2016-09-30 07:19:40 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
Compiling:
|
|
|
|
|
|
|
|
```sh
|
2016-08-10 06:42:30 +00:00
|
|
|
tup
|
|
|
|
```
|
2016-09-30 07:17:35 +00:00
|
|
|
|
2016-09-30 07:19:40 +00:00
|
|
|
Running a game:
|
2016-09-30 07:17:35 +00:00
|
|
|
|
|
|
|
```sh
|
|
|
|
$ ./lovr /path/to/game
|
|
|
|
```
|