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()
|
endif()
|
||||||
elseif(UNIX)
|
elseif(UNIX)
|
||||||
find_package(PkgConfig)
|
find_package(PkgConfig)
|
||||||
if(NOT APPLE)
|
if(APPLE)
|
||||||
|
set(LOVR_USE_OPENXR OFF)
|
||||||
|
else()
|
||||||
set(CMAKE_SKIP_RPATH OFF)
|
set(CMAKE_SKIP_RPATH OFF)
|
||||||
endif()
|
endif()
|
||||||
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
|
- 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
|
- VulkanSDK.exe --root C:\VulkanSDK --accept-licenses --default-answer --confirm-command install
|
||||||
|
|
||||||
|
image: Visual Studio 2022
|
||||||
|
|
||||||
before_build:
|
before_build:
|
||||||
- cd C:\projects\lovr
|
- cd C:\projects\lovr
|
||||||
- git submodule update --init
|
- git submodule update --init
|
||||||
|
|
|
@ -186,6 +186,11 @@ static int l_lovrSystemGetWindowDimensions(lua_State* L) {
|
||||||
|
|
||||||
static int l_lovrSystemGetWindowDensity(lua_State* L) {
|
static int l_lovrSystemGetWindowDensity(lua_State* L) {
|
||||||
lua_pushnumber(L, lovrSystemGetWindowDensity());
|
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;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,6 +204,7 @@ static const luaL_Reg lovrSystem[] = {
|
||||||
{ "getWindowHeight", l_lovrSystemGetWindowHeight },
|
{ "getWindowHeight", l_lovrSystemGetWindowHeight },
|
||||||
{ "getWindowDimensions", l_lovrSystemGetWindowDimensions },
|
{ "getWindowDimensions", l_lovrSystemGetWindowDimensions },
|
||||||
{ "getWindowDensity", l_lovrSystemGetWindowDensity },
|
{ "getWindowDensity", l_lovrSystemGetWindowDensity },
|
||||||
|
{ "isKeyDown", l_lovrSystemIsKeyDown },
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ Vector lovrPoolAllocate(Pool* pool, VectorType type, float** data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
float* lovrPoolResolve(Pool* pool, Vector vector) {
|
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;
|
return pool->data + vector.handle.index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,11 @@ static struct {
|
||||||
bool initialized;
|
bool initialized;
|
||||||
int windowWidth;
|
int windowWidth;
|
||||||
int windowHeight;
|
int windowHeight;
|
||||||
|
bool pressedKeys[KEY_COUNT];
|
||||||
} state;
|
} state;
|
||||||
|
|
||||||
static void onKey(os_button_action action, os_key key, uint32_t scancode, bool repeat) {
|
static void onKey(os_button_action action, os_key key, uint32_t scancode, bool repeat) {
|
||||||
|
state.pressedKeys[key] = (action == BUTTON_PRESSED);
|
||||||
lovrEventPush((Event) {
|
lovrEventPush((Event) {
|
||||||
.type = action == BUTTON_PRESSED ? EVENT_KEYPRESSED : EVENT_KEYRELEASED,
|
.type = action == BUTTON_PRESSED ? EVENT_KEYPRESSED : EVENT_KEYRELEASED,
|
||||||
.data.key.code = key,
|
.data.key.code = key,
|
||||||
|
@ -73,6 +75,10 @@ uint32_t lovrSystemGetCoreCount() {
|
||||||
return os_get_core_count();
|
return os_get_core_count();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool lovrSystemIsKeyDown(int keycode) {
|
||||||
|
return state.pressedKeys[keycode];
|
||||||
|
}
|
||||||
|
|
||||||
void lovrSystemRequestPermission(Permission permission) {
|
void lovrSystemRequestPermission(Permission permission) {
|
||||||
os_request_permission((os_permission) permission);
|
os_request_permission((os_permission) permission);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,3 +19,4 @@ bool lovrSystemIsWindowOpen(void);
|
||||||
uint32_t lovrSystemGetWindowWidth(void);
|
uint32_t lovrSystemGetWindowWidth(void);
|
||||||
uint32_t lovrSystemGetWindowHeight(void);
|
uint32_t lovrSystemGetWindowHeight(void);
|
||||||
float lovrSystemGetWindowDensity(void);
|
float lovrSystemGetWindowDensity(void);
|
||||||
|
bool lovrSystemIsKeyDown(int keycode);
|
||||||
|
|
Loading…
Reference in New Issue