Commit Graph

63 Commits

Author SHA1 Message Date
bjorn cdecc1bae7 Add defer system; Rework exceptions; util cleanup;
Defer can be used to clean up resources when an error occurs.
2024-03-29 18:10:22 -07:00
bjorn d097d9819d Add wrappers for malloc functions; 2024-03-11 14:38:00 -07:00
bjorn 9068c8daee rm map_remove;
It's no longer used.
2024-03-07 10:13:00 -08:00
Josip Miskovic 1ad8f23fb8 Jolt physics engine integration 2024-01-30 18:22:27 +01:00
bjorn cb44549205 Fix more prototypes; 2023-04-25 21:45:30 -07:00
bjorn c1bb47d737 Merge branch 'master' into dev 2022-06-16 23:50:11 -07:00
bjorn af8f650a07 Make map_t size deterministic;
Currently, the amount of memory allocated for a map can sometimes be
different depending on whether it was allocated with an initial capacity
or the items were added iteratively.

This causes problems for people that want to copy data between maps that
have the same number of elements.

Now, the size of a map will always be the same for a given number of
elements, regardless of how the elements are added.

Plus this gets rid of the weird prevpo2 function.  Yay.
2022-06-14 16:52:19 -07:00
bjorn d8701df780 Add f16 conversion to util; 2022-04-27 00:19:44 -07:00
bjorn 5d271de91a mv map util; 2022-03-30 12:34:38 -07:00
bjorn 2da18d419b mv util src; 2022-03-22 00:13:38 -07:00
bjorn 7645f4c014 Add core folder; 2019-05-20 02:47:33 -07:00
bjorn 410a2810cf Move types into their own file; 2019-04-05 04:05:03 -07:00
bjorn 14cab6cd3c Move utf helper into lib; 2019-04-05 04:04:52 -07:00
bjorn 86a342877f rm nextPo2; 2019-04-05 03:56:56 -07:00
bjorn 7932ef6f9f Add type lookup;
Now Ref has a type id instead of a destructor/name, and use the type to
lookup the destructor and name when needed.

This improves performance, since now Ref contains a lot less data and we
can do an integer comparison instead of a string comparison when reading
objects from Lua.
2019-04-05 02:54:54 -07:00
bjorn f5a903a805 Oops, use calloc in _lovrAlloc; 2019-01-29 20:08:10 -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 40c7deaefe Vector API improvements; 2019-01-06 03:25:00 -08:00
bjorn 4f716499b0 Fix declspec for math functions;
LuaJIT can't find math functions on windows unless they are exported.
2019-01-04 02:18:21 -08:00
bjorn 086f7f4e47 lovrRelease frees objects instead of destructor;
That way objects allocated on the stack can be destroyed.
2018-12-19 01:41:01 -08:00
bjorn 5b52a91778 mv ref->free ref->destructor; 2018-12-19 01:33:47 -08:00
bjorn 58950aa20e _lovrAlloc throws on OOM; 2018-12-19 01:04:42 -08:00
bjorn c999f10039 Use _Noreturn for lovrThrow;
Generates smaller and prettier assembly.
2018-12-12 19:35:18 -08:00
bjorn eaf26ce4b8 Struct cleanup; 2018-12-10 15:18:42 -08:00
bjorn f8011f7bf7 Initial platform.h; 2018-10-29 14:00:16 -07:00
bjorn 92e6ad93cb Dynamically load modules; 2018-09-27 18:38:44 -07:00
bjorn 148a2bdb45 Error system no longer relies on Lua; 2018-09-26 10:39:17 -07:00
bjorn bc2d638b00 Refs know their type; 2018-07-24 19:14:29 -07:00
bjorn b7a43e1762 Fix build; 2018-07-11 18:24:21 -07:00
bjorn 0214c7605e Support requiring dll/so files;
Still WIP
2018-07-07 13:55:22 -07:00
bjorn 57c8dfe146 Clean up includes; 2018-07-04 13:51:35 -07:00
bjorn 8702d7422f Rewrite boot.lua, main.c, and exception handling;
There are breaking changes:

- lovr.step is removed.
- lovr.run is expected to return a main loop wrapped in a function.  The
  returned function is run as a coroutine to facilitate a cooperative
  main loop.
- lovr.errhand should return a loop function instead of while true-ing.
2018-05-27 19:05:10 -07:00
bjorn d77b139d21 Make Mesh more lightweight; 2018-03-21 15:36:00 -07:00
bjorn d2e0642b59 Use calloc in lovrAlloc; 2018-03-21 12:56:16 -07:00
bjorn 4df836727c Simplify refcounting; 2018-02-26 00:59:03 -08:00
bjorn 583afc9f16 Reorganize main/lovr separation; 2018-02-23 18:38:34 -08:00
bjorn d6aad1faba Fix RGB texture size; 2017-08-26 19:31:03 -07:00
bjorn 74f585ca8d Use lovrAssert and lovrThrow for better errors; 2017-08-10 01:05:04 -07:00
bjorn 7f1d441cdf Better error handling system;
Mom's spaghetti.
2017-08-10 00:45:19 -07:00
bjorn 73d8b8aa3e Unicode; 2017-02-09 21:06:07 -08:00
bjorn 4303846eac Clean up includes; 2017-01-21 18:00:32 -08:00
bjorn 6979b59980 map_int_find -> luax_pushenum; 2017-01-21 17:38:44 -08:00
bjorn 14dfeb688f Get rid of loadImage; 2017-01-21 17:29:20 -08:00
bjorn dff9cc3c98 Add stb_image implementation file; 2017-01-21 17:15:04 -08:00
bjorn 38768afda1 Sort out texture coordinates;
I hope
2017-01-15 13:49:46 -08:00
bjorn d6a30fc6d2 Basic sources; 2017-01-05 17:44:00 -08:00
bjorn bd9fec011b headsetControllerGetModel; 2016-11-25 23:32:48 -08:00
bjorn 30f70e58f6 Add __tostring to objects; 2016-11-23 20:17:07 -08:00
bjorn 0c200b9a2c Clean up util naming; 2016-11-19 13:33:40 -08:00
bjorn a743cfd3b6 Initial reference counting system; 2016-11-19 13:33:40 -08:00