From 2b7b513824b1fdfbff8a7057b5e578c98abd5722 Mon Sep 17 00:00:00 2001 From: bjorn Date: Sun, 10 Jul 2022 17:08:53 -0600 Subject: [PATCH 1/6] Disable OpenXR on macOS; It doesn't seem to work. --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fbb5eea3..5868eece 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,7 +62,9 @@ elseif(ANDROID) endif() elseif(UNIX) find_package(PkgConfig) - if(NOT APPLE) + if(APPLE) + set(LOVR_USE_OPENXR OFF) + else() set(CMAKE_SKIP_RPATH OFF) endif() endif() From ff39a7485b2250c06c84de5f6e8c59068c964bc0 Mon Sep 17 00:00:00 2001 From: bjorn Date: Tue, 19 Jul 2022 08:48:39 -0700 Subject: [PATCH 2/6] Update appveyor.yml; --- etc/appveyor.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/etc/appveyor.yml b/etc/appveyor.yml index 478a0710..2bd82966 100644 --- a/etc/appveyor.yml +++ b/etc/appveyor.yml @@ -11,6 +11,8 @@ branches: only: - master +image: Visual Studio 2022 + before_build: - cd C:\projects\lovr - git submodule update --init From 50b321fb64b750716febb65fdb2b4448d1d48b59 Mon Sep 17 00:00:00 2001 From: Kelsey Higham Date: Thu, 21 Jul 2022 16:24:33 -0700 Subject: [PATCH 3/6] More beginner-friendly error message --- src/modules/math/pool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/math/pool.c b/src/modules/math/pool.c index 05c99d56..b56b57c1 100644 --- a/src/modules/math/pool.c +++ b/src/modules/math/pool.c @@ -60,7 +60,7 @@ Vector lovrPoolAllocate(Pool* pool, VectorType type, float** data) { } float* lovrPoolResolve(Pool* pool, Vector vector) { - lovrAssert(vector.handle.generation == pool->generation, "Attempt to use a vector in a different generation than the one it was created in (vectors can not be saved into variables)"); + lovrAssert(vector.handle.generation == pool->generation, "Attempt to use a temporary vector from a previous frame"); return pool->data + vector.handle.index; } From 31ca502034725aa9a02ffc2da9489da26ca8bcf4 Mon Sep 17 00:00:00 2001 From: Josip Miskovic Date: Mon, 1 Aug 2022 21:51:56 +0200 Subject: [PATCH 4/6] Add isKeyDown --- src/api/l_system.c | 7 +++++++ src/modules/system/system.c | 14 ++++++++++---- src/modules/system/system.h | 2 ++ 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/api/l_system.c b/src/api/l_system.c index 0672abcd..d59a1597 100644 --- a/src/api/l_system.c +++ b/src/api/l_system.c @@ -114,10 +114,17 @@ static int l_lovrSystemRequestPermission(lua_State* L) { return 0; } +static int l_lovrSystemIsKeyDown(lua_State* L) { + os_key key = luax_checkenum(L, 1, KeyboardKey, NULL); + lua_pushboolean(L, lovrSystemIsKeyDown(key)); + return 1; +} + static const luaL_Reg lovrSystem[] = { { "getOS", l_lovrSystemGetOS }, { "getCoreCount", l_lovrSystemGetCoreCount }, { "requestPermission", l_lovrSystemRequestPermission }, + { "isKeyDown", l_lovrSystemIsKeyDown }, { NULL, NULL } }; diff --git a/src/modules/system/system.c b/src/modules/system/system.c index 2757b6af..53576d39 100644 --- a/src/modules/system/system.c +++ b/src/modules/system/system.c @@ -4,7 +4,13 @@ #include "util.h" #include +static struct { + bool initialized; + bool pressedKeys[KEY_COUNT]; +} state; + static void onKeyboardEvent(os_button_action action, os_key key, uint32_t scancode, bool repeat) { + state.pressedKeys[key] = (action == BUTTON_PRESSED); lovrEventPush((Event) { .type = action == BUTTON_PRESSED ? EVENT_KEYPRESSED : EVENT_KEYRELEASED, .data.key.code = key, @@ -30,10 +36,6 @@ static void onPermissionEvent(os_permission permission, bool granted) { lovrEventPush(event); } -static struct { - bool initialized; -} state; - bool lovrSystemInit() { if (state.initialized) return false; os_on_key(onKeyboardEvent); @@ -59,6 +61,10 @@ uint32_t lovrSystemGetCoreCount() { return os_get_core_count(); } +bool lovrSystemIsKeyDown(os_key key) { + return state.pressedKeys[key]; +} + void lovrSystemRequestPermission(Permission permission) { os_request_permission((os_permission) permission); } diff --git a/src/modules/system/system.h b/src/modules/system/system.h index 3b55c6a8..a31eb5e3 100644 --- a/src/modules/system/system.h +++ b/src/modules/system/system.h @@ -1,5 +1,6 @@ #include #include +#include "core/os.h" #pragma once @@ -12,3 +13,4 @@ void lovrSystemDestroy(void); const char* lovrSystemGetOS(void); uint32_t lovrSystemGetCoreCount(void); void lovrSystemRequestPermission(Permission permission); +bool lovrSystemIsKeyDown(os_key key); From 8952476e358c1c4c3ccb95ad5fd33df99bf203e5 Mon Sep 17 00:00:00 2001 From: bjorn Date: Mon, 1 Aug 2022 22:14:49 -0700 Subject: [PATCH 5/6] Adjust; --- src/api/l_system.c | 2 +- src/modules/system/system.c | 2 +- src/modules/system/system.h | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/api/l_system.c b/src/api/l_system.c index d59a1597..ff40e807 100644 --- a/src/api/l_system.c +++ b/src/api/l_system.c @@ -116,7 +116,7 @@ static int l_lovrSystemRequestPermission(lua_State* L) { static int l_lovrSystemIsKeyDown(lua_State* L) { os_key key = luax_checkenum(L, 1, KeyboardKey, NULL); - lua_pushboolean(L, lovrSystemIsKeyDown(key)); + lua_pushboolean(L, lovrSystemIsKeyDown(key)); return 1; } diff --git a/src/modules/system/system.c b/src/modules/system/system.c index 53576d39..1566532d 100644 --- a/src/modules/system/system.c +++ b/src/modules/system/system.c @@ -61,7 +61,7 @@ uint32_t lovrSystemGetCoreCount() { return os_get_core_count(); } -bool lovrSystemIsKeyDown(os_key key) { +bool lovrSystemIsKeyDown(int keycode) { return state.pressedKeys[key]; } diff --git a/src/modules/system/system.h b/src/modules/system/system.h index a31eb5e3..cbfe17ec 100644 --- a/src/modules/system/system.h +++ b/src/modules/system/system.h @@ -1,6 +1,5 @@ #include #include -#include "core/os.h" #pragma once @@ -13,4 +12,4 @@ void lovrSystemDestroy(void); const char* lovrSystemGetOS(void); uint32_t lovrSystemGetCoreCount(void); void lovrSystemRequestPermission(Permission permission); -bool lovrSystemIsKeyDown(os_key key); +bool lovrSystemIsKeyDown(int keycode); From d81d906f5885c3a3a228b281a701845f791683be Mon Sep 17 00:00:00 2001 From: bjorn Date: Mon, 1 Aug 2022 22:35:20 -0700 Subject: [PATCH 6/6] Fix; --- src/modules/system/system.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/system/system.c b/src/modules/system/system.c index 1566532d..11d64221 100644 --- a/src/modules/system/system.c +++ b/src/modules/system/system.c @@ -62,7 +62,7 @@ uint32_t lovrSystemGetCoreCount() { } bool lovrSystemIsKeyDown(int keycode) { - return state.pressedKeys[key]; + return state.pressedKeys[keycode]; } void lovrSystemRequestPermission(Permission permission) {