Commit Graph

86 Commits

Author SHA1 Message Date
bjorn 4483145d53 Allow passing a file to lovr;
The file will be treated as main.lua.
Its directory will be treated as the source.
2022-04-28 17:36:05 -07:00
bjorn faa42ee38b mv resources etc; 2022-03-30 12:34:34 -07:00
bjorn bb9a20aaf2 Add basic help command line flag; 2022-03-25 03:58:06 -07:00
bjorn 2da18d419b mv util src; 2022-03-22 00:13:38 -07:00
bjorn 7dc54cc264 Add lovrCheck macro;
lovrCheck is a new way of performing runtime assertions.

It's identical to lovrAssert, except it's compiled out if
LOVR_UNCHECKED is defined.

It is meant to be used for non-mission-critical validation, for
example proper usage of types passed to the Lua API.  lovrAssert
should still be used to check return values from platform APIs.
2021-06-05 11:12:00 -06:00
bjorn e63099ba6a Flatten api.h; 2021-03-15 18:54:27 -06:00
bjorn 4f5adbc64c lovr.system; 2021-02-25 09:00:12 -07:00
bjorn 9c1af7427f Fix restart cookie on wasm; 2021-02-19 09:06:16 -07:00
bjorn 0e375804fe Only include <lualib.h> when needed; 2021-02-07 16:51:31 -07:00
bjorn 32fb7a7cb2 rm --root arg; 2020-12-25 16:52:06 -07:00
bjorn 4ef944d7c1 lovrDestroy calls lovrPlatformDestroy; 2020-11-12 18:08:04 -07:00
bjorn 6cadcea65d WebXR updates;
- Make the renderloop synchronous by hijacking the RAF to run on the
  XRSession when active.
- Convert os_web to use emscripten's native HTML5 interface instead
  of going through GLFW.
- Stop using preinitialized GL context -- lovrPlatformCreateWindow
  now creates the context.
- GLES2/3 emulation is not necessary.
- Remove inline sessions.  The VR simulator is used to render to the
  Canvas instead.  webxr_attach and webxr_detach are used to replace
  replace the active headset driver with the webxr driver when an
  immersive session starts.
- Add noop desktop_getSkeleton.
2020-08-20 13:28:07 -06:00
bjorn ec257b179f Support Lua 5.2, 5.3, 5.4; 2020-08-19 13:12:57 -06:00
bjorn 9abed055d8 lovr.log;
lovr.log is a new callback that is invoked whenever LÖVR wants to
send the project a message.  For example, this could be a performance
warning from the graphics module, an error message from one of the
headset backends, or an API deprecation notice.

The callback's signature is (message, level, tag).  The message is a
string containing the message to log, level is a string that is currently
one of "debug", "info", "warn", "error", and tag is an optional string
that is used to indicate the source of the message for grouping purposes.

The default implementation of the callback just prints the message,
but the callback can be overridden to do things like filter messages,
write them to a file, or even render them in VR.  Projects can also
invoke the callback directly to log their own messages.
2020-07-06 16:20:55 -06:00
bjorn 90b605f012 Add restart cookie; lovr.event.restart; arg.restart; 2020-02-26 14:40:40 -08:00
bjorn c9a06a37cb Refactor main; Add unused android entrypoint; 2020-01-28 21:38:44 -08:00
bjorn 42c85c39fb rm 1ms sleep from main loop;
It's causing massive problems on windows, and sleeping for zero ms
is good enough to relinquish CPU time to the OS.  VR APIs also do
their own sleeping.
2020-01-08 23:58:11 -08:00
bjorn 79fd5ad7d8 Name boot.lua chunk properly;
This makes error messages nicer.
2019-12-28 23:18:03 -08:00
bjorn e2d8f8c645 platform -> os;
The function names are staying the same for now.
2019-12-13 19:55:46 -08:00
bjorn 63dc8f6c9b Only use glfw for window creation;
This allows for headless operation.  Currently GLFW throws an error
if you call glfwInit without an X server running, preventing lovr
from starting at all in that situation.

Because GLFW is currently used for time functions, those had to be
moved into the platform layer.  There's lots of duplication here,
ideally the platform layer would just return raw timer values and the
timer module would handle the epoch logic, but it was too difficult to
coordinate that right now.

Also, lovrPlatformInit is guaranteed to set the time epoch to 0 now.
2019-12-13 19:55:46 -08:00
bjorn 6f24da9f7f Rework Tupfiles;
- One toplevel Tupfile that makes it more clear what happens.
- Add config flags for -Werror, -fsanitize, and separate debug/optimize flags.
- Automatically integrate with libs built by CMake (build folder, rpath, libs folder).
- Disabling modules actually works, only the stuff that's needed is built.
2019-12-13 06:52:57 -08:00
bjorn 2f9400a5f7 Adjust includes; 2019-12-10 13:01:28 -08:00
sophia ef84a16716 Throw lua errors in the error handler; 2019-09-24 12:04:36 -07:00
bjorn 13655d0df4 Simplify logging; 2019-08-21 19:02:02 -07:00
bjorn 8d4760167f luax is now api; 2019-08-21 15:27:26 -07:00
bjorn 0d5c776b02 Windows opens console with --console argument;
Instead of all the time.
2019-08-01 13:49:39 -07:00
bjorn 6b2d06e766 Add lovrPlatformOpenConsole; 2019-06-16 18:55:43 -07:00
bjorn 575552a147 Restart hotkey works on default error screen; 2019-06-02 03:29:34 -07:00
bjorn 22fe333150 Update refcounting (again);
- Ref struct only stores refcount now and is more general.
- Proxy stores a hash of its type name instead of an enum.
- Variants store additional information instead of using a vtable.
- Remove the concept of superclasses from the API.
- Clean up some miscellaneous includes.
2019-06-02 01:02:26 -07:00
bjorn 67ddefd0c2 Ensure platform functions have prefix; 2019-05-20 04:02:25 -07:00
bjorn 7645f4c014 Add core folder; 2019-05-20 02:47:33 -07:00
bjorn 4a47afca38 Organize api folder; 2019-05-19 00:31:42 -07:00
bjorn b28face914 Handle coroutine stuff properly; 2019-03-07 01:04:45 -08:00
bjorn ce029cb5c5 Fix emscripten; Properly clear error on Android; 2019-03-06 23:17:29 -08:00
bjorn 569c9f7a11 Refactor asynchronous headset render errors;
It's now a more general error stored in the registry instead of
in a global variable.  There are more helper functions.
2019-03-06 23:17:29 -08:00
bjorn d340fc7aaa Polyfill LUA_RIDX_MAINTHREAD;
Instead of using a static variable.
2019-03-06 08:42:32 -08:00
bjorn d529620fea rm unused variables; 2019-02-17 14:19:39 -08:00
bjorn a763a6d2e1 Fix emscripten entry/exit points; 2019-02-14 09:22:00 -08:00
bjorn 6fd4b9ef4c Header cleanup; 2019-01-24 17:43:25 -08:00
bjorn cb9f166234 Revert "Replace sprintf with stb version;"
This reverts commit 8f9d24c51f.
2019-01-24 17:39:27 -08:00
bjorn 8f9d24c51f Replace sprintf with stb version; 2019-01-18 08:55:29 -08:00
bjorn 1fb2d6be02 Always use pushliteral when possible; 2018-12-15 21:45:32 -08:00
bjorn e5dd0a2c17 Fix wasm build.........; 2018-11-16 07:36:44 -08:00
bjorn c9793eae49 lovrPlatform: init/destroy; 2018-11-16 03:59:06 -08:00
bjorn 6514492cb8 glfwGetTime -> lovrPlatformGetTime;
Same for glfwSetTime;
2018-11-16 00:28:45 -08:00
bjorn da92cce634 Fix wasm build; 2018-11-15 08:21:26 -08:00
bjorn 784d61ef4a Modify module loading;
Dynamically loading things was cool but is causing more pain than
pleasure because it just barely doesn't work everywhere.  Instead,
find a better way to load modules.  Use a data driven luaL_Reg array
to define the module mapping and luaL_register to smoosh it into
package.preload at boot time.  Benefits:

- LOVR_ENABLE_<x> defines are respected and only require a single #if
- Module list is data driven and defined in one place
- It's faster (luax_preloadmodule did a global lookup every invocation)
- It works everywhere

Oh also threads were totally broken and this (mostly) fixes them.
2018-11-15 07:51:21 -08:00
mcc 64b187ef3f Manual merge args-and-physfs PR branch with master 2018-11-13 22:09:47 -05:00
mcc 91daeae634 Style/functional fixes to args for PR. --inside is now --root 2018-11-13 22:07:19 -05:00
mcc 96eed2786c Amend oculus_mobile error handling so headset.c renderHelper drives
Back out lovrHeadsetExtractRenderFn, don't let oculus_mobile.c pcall the render function, instead fit the render error saving inside renderHelper (emscripten/oculusmobile path). The render error is now saved in the environment at _lovrHeadsetRenderError. For this to work, luax now keeps track of a global variable for the current "main" environment.

This does means the render error path now works on emscripten (this has not been tested).
2018-11-13 16:50:31 -08:00