Commit Graph

31 Commits

Author SHA1 Message Date
mcc 4859360209 Fix compile with -DLOVR_ENABLE_HEADSET=NO 2019-02-01 13:20:28 -08:00
bjorn 6291a5ad5a Always check malloc result; Less calloc;
Some more questions:

- Should there be some kind of allocation helper so you don't need
  to always check the result?
- Throwing an error on OOM is convenient and is probably correct 90%
  of the time, it even provides a nice error message instead of a
  nil dereference somewhere.  But it's inflexible.  Is it the right
  thing to do?
2019-01-29 16:53:01 -08:00
bjorn aa56cbc7b0 Fix crash on repeated calls to Channel:peek; 2019-01-12 20:51:50 -08:00
bjorn 1fb2d6be02 Always use pushliteral when possible; 2018-12-15 21:45:32 -08:00
bjorn 0e99d47394 Fix module destruction;
There is a problem when a Thread stops: it destroys all of the modules
that it required.  This is because we unconditionally call luax_atexit
when modules are required, and when the thread lua_State dies it takes
all of the modules with it.  To fix this, lovr<Module>Init will return
whether or not initialization successfully happened, which provides us
with enough info to know if we should place the luax_atexit destructor
2018-11-19 09:24:28 -08:00
bjorn 43309efc57 Fix problems with variants; 2018-10-23 11:11:47 -07:00
bjorn 816fda2177 Fix everything and merge; 2018-09-27 18:38:44 -07:00
bjorn cee3c28f4e luax_atexit; rm lovrDestroy;
Modules register themselves in the registry for destruction at
lua_close instead of having a hardcoded list in lovrDestroy.
2018-09-27 18:38:44 -07:00
bjorn e02d22365f api: refactor; 2018-09-27 18:38:44 -07:00
bjorn 792834623c api: more modular helper functions; 2018-09-27 18:38:44 -07:00
bjorn f872a5f094 Re-enable threads for emscripten;
They don't appear to work very well but this simplifies code a lot.
2018-08-30 22:09:54 -07:00
bjorn 9e494cae46 Make custom events work; 2018-07-26 19:38:01 -07:00
bjorn 156c0cde5d Condense event code a bit; 2018-07-26 19:38:01 -07:00
bjorn 83ddb82162 Simplify Lua object management; 2018-07-24 20:13:54 -07:00
bjorn f903b6014c Use arrays for enums instead of maps; 2018-07-04 20:11:52 -07:00
bjorn 93e082c8cc WebVR;
- Add FORCE_FILESYSTEM
- Handle THREAD_ERROR event with noop case
- Remove hopefully redundant lovr.graphics.clear in errhand
- Finally use correct type signature for assimpFileTell
2018-05-27 19:05:10 -07:00
bjorn 012ba07063 Disable threads in WebVR;
Browser/emscripten support is currently unstable.
2018-05-27 19:05:10 -07:00
bjorn 8b3fcc94b8 Event module is thread safe; 2018-04-01 22:43:54 -07:00
bjorn 8be201c040 Add default lovr.threaderror callback; 2018-03-12 10:37:45 -07:00
bjorn 4df836727c Simplify refcounting; 2018-02-26 00:59:03 -08:00
bjorn 272cce65a2 Weird compile fixes; 2018-02-25 21:41:02 -08:00
bjorn 3a36bcceae lovr.mount; lovr.headset.isMounted; isPresent changes;
Remove lovr.headset.isPresent.
Replace Controller:isPresent with Controller:isConnected.
Add lovr.headset.isMounted and lovr.mount callback.
2018-02-25 16:42:31 -08:00
bjorn 4cca193fcb lovr.threaderror callback; 2018-02-23 18:38:52 -08:00
bjorn 84de048fa3 Fix warnings; 2018-01-26 19:11:42 -08:00
mcc 8052896b33 Restart-without-quit support: lovr.event.quit("restart") and return-from-run() both support the string "restart" in place of an exit code. When this happens, the program reruns itself in a new, isolated environment. In Emscripten, no reboot occurs and the program only quits. 2018-01-25 21:32:16 -05:00
bjorn 1d20e49829 Move api header; 2017-12-10 12:41:43 -08:00
bjorn dfece82c89 Fix undefined behavior with event polling; 2017-05-17 00:03:42 -06:00
bjorn 0c6da83332 lovr.focus;
This may not work in all cases involving e.g. overlays.
2017-03-11 19:01:01 -08:00
bjorn f9f0773b92 lovr.controllerpressed; lovr.controllerreleased; 2017-03-11 18:46:07 -08:00
bjorn fce7746b16 Simplify api structure; 2017-03-11 03:08:07 -08:00
bjorn fa74254e64 Rename lovr to api; 2017-03-11 02:25:39 -08:00
Renamed from src/lovr/event.c (Browse further)