mirror of https://github.com/bjornbytes/lovr.git
Merge branch 'master' into dev
This commit is contained in:
commit
c41188c4b4
|
@ -68,7 +68,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()
|
||||
|
|
|
@ -23,6 +23,8 @@ install:
|
|||
- if not exist VulkanSDK.exe curl -L --silent --show-error --output VulkanSDK.exe https://sdk.lunarg.com/sdk/download/1.3.216.0/windows/VulkanSDK-1.3.216.0-Installer.exe?Human=true
|
||||
- VulkanSDK.exe --root C:\VulkanSDK --accept-licenses --default-answer --confirm-command install
|
||||
|
||||
image: Visual Studio 2022
|
||||
|
||||
before_build:
|
||||
- cd C:\projects\lovr
|
||||
- git submodule update --init
|
||||
|
|
|
@ -186,6 +186,11 @@ static int l_lovrSystemGetWindowDimensions(lua_State* L) {
|
|||
|
||||
static int l_lovrSystemGetWindowDensity(lua_State* L) {
|
||||
lua_pushnumber(L, lovrSystemGetWindowDensity());
|
||||
}
|
||||
|
||||
static int l_lovrSystemIsKeyDown(lua_State* L) {
|
||||
os_key key = luax_checkenum(L, 1, KeyboardKey, NULL);
|
||||
lua_pushboolean(L, lovrSystemIsKeyDown(key));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -199,6 +204,7 @@ static const luaL_Reg lovrSystem[] = {
|
|||
{ "getWindowHeight", l_lovrSystemGetWindowHeight },
|
||||
{ "getWindowDimensions", l_lovrSystemGetWindowDimensions },
|
||||
{ "getWindowDensity", l_lovrSystemGetWindowDensity },
|
||||
{ "isKeyDown", l_lovrSystemIsKeyDown },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,9 +8,11 @@ static struct {
|
|||
bool initialized;
|
||||
int windowWidth;
|
||||
int windowHeight;
|
||||
bool pressedKeys[KEY_COUNT];
|
||||
} state;
|
||||
|
||||
static void onKey(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,
|
||||
|
@ -73,6 +75,10 @@ uint32_t lovrSystemGetCoreCount() {
|
|||
return os_get_core_count();
|
||||
}
|
||||
|
||||
bool lovrSystemIsKeyDown(int keycode) {
|
||||
return state.pressedKeys[keycode];
|
||||
}
|
||||
|
||||
void lovrSystemRequestPermission(Permission permission) {
|
||||
os_request_permission((os_permission) permission);
|
||||
}
|
||||
|
|
|
@ -19,3 +19,4 @@ bool lovrSystemIsWindowOpen(void);
|
|||
uint32_t lovrSystemGetWindowWidth(void);
|
||||
uint32_t lovrSystemGetWindowHeight(void);
|
||||
float lovrSystemGetWindowDensity(void);
|
||||
bool lovrSystemIsKeyDown(int keycode);
|
||||
|
|
Loading…
Reference in New Issue