Ensure platform functions have prefix;

This commit is contained in:
bjorn 2019-05-20 04:02:25 -07:00
parent b1e848ef6b
commit 67ddefd0c2
11 changed files with 24 additions and 24 deletions

View File

@ -337,7 +337,7 @@ static int l_lovrFilesystemWrite(lua_State* L) {
}
static int l_lovrFilesystemGetApplicationId(lua_State *L) {
sds applicationId = lovrGetApplicationId();
sds applicationId = lovrPlatformGetApplicationId();
if (applicationId) {
lua_pushstring(L, applicationId);
sdsfree(applicationId);

View File

@ -86,9 +86,9 @@ void lovrPlatformGetMousePosition(double* x, double* y);
void lovrPlatformSetMouseMode(MouseMode mode);
bool lovrPlatformIsMouseDown(MouseButton button);
bool lovrPlatformIsKeyDown(KeyCode key);
void lovrSleep(double seconds);
int lovrGetExecutablePath(char* dest, uint32_t size);
sds lovrGetApplicationId(void);
void lovrPlatformSleep(double seconds);
int lovrPlatformGetExecutablePath(char* dest, uint32_t size);
sds lovrPlatformGetApplicationId(void);
#ifdef _WIN32
#include <windows.h>
HANDLE lovrPlatformGetWindow(void);

View File

@ -70,15 +70,15 @@ bool lovrPlatformIsKeyDown(KeyCode key) {
return false;
}
void lovrSleep(double seconds) {
void lovrPlatformSleep(double seconds) {
usleep((unsigned int) (seconds * 1000000));
}
int lovrGetExecutablePath(char* dest, uint32_t size) {
int lovrPlatformGetExecutablePath(char* dest, uint32_t size) {
return 1;
}
sds lovrGetApplicationId() {
sds lovrPlatformGetApplicationId() {
pid_t pid = getpid();
sds procPath = sdscatfmt(sdsempty(), "/proc/%i/cmdline", (int)pid);
FILE *procFile = fopen(procPath, "r");

View File

@ -4,11 +4,11 @@
#include "platform_glfw.c.h"
void lovrSleep(double seconds) {
void lovrPlatformSleep(double seconds) {
usleep((unsigned int) (seconds * 1000000));
}
int lovrGetExecutablePath(char* dest, uint32_t size) {
int lovrPlatformGetExecutablePath(char* dest, uint32_t size) {
memset(dest, 0, size);
if (readlink("/proc/self/exe", dest, size) != -1) {
return 0;
@ -16,6 +16,6 @@ int lovrGetExecutablePath(char* dest, uint32_t size) {
return 1;
}
sds lovrGetApplicationId() {
sds lovrPlatformGetApplicationId() {
return NULL;
}

View File

@ -4,15 +4,15 @@
#include "platform_glfw.c.h"
void lovrSleep(double seconds) {
void lovrPlatformSleep(double seconds) {
usleep((unsigned int) (seconds * 1000000));
}
int lovrGetExecutablePath(char* dest, uint32_t size) {
int lovrPlatformGetExecutablePath(char* dest, uint32_t size) {
return _NSGetExecutablePath(dest, &size);
}
// TODO: Actually, this could perfectly well return the bundle ID, but who would need it?
sds lovrGetApplicationId() {
sds lovrPlatformGetApplicationId() {
return NULL;
}

View File

@ -3,14 +3,14 @@
#include "platform_glfw.c.h"
void lovrSleep(double seconds) {
void lovrPlatformSleep(double seconds) {
emscripten_sleep((unsigned int) (seconds * 1000));
}
int lovrGetExecutablePath(char* dest, uint32_t size) {
int lovrPlatformGetExecutablePath(char* dest, uint32_t size) {
return 1;
}
sds lovrGetApplicationId() {
sds lovrPlatformGetApplicationId() {
return NULL;
}

View File

@ -3,14 +3,14 @@
#include "platform_glfw.c.h"
void lovrSleep(double seconds) {
void lovrPlatformSleep(double seconds) {
Sleep((unsigned int) (seconds * 1000));
}
int lovrGetExecutablePath(char* dest, uint32_t size) {
int lovrPlatformGetExecutablePath(char* dest, uint32_t size) {
return !GetModuleFileName(NULL, dest, size);
}
sds lovrGetApplicationId() {
sds lovrPlatformGetApplicationId() {
return NULL;
}

View File

@ -81,7 +81,7 @@ int main(int argc, char** argv) {
return 0;
#else
while (lua_resume(T, 0) == LUA_YIELD) {
lovrSleep(.001);
lovrPlatformSleep(.001);
}
restart = lua_type(T, -1) == LUA_TSTRING && !strcmp(lua_tostring(T, -1), "restart");

View File

@ -134,7 +134,7 @@ void lovrFilesystemGetDirectoryItems(const char* path, getDirectoryItemsCallback
}
int lovrFilesystemGetExecutablePath(char* path, uint32_t size) {
return lovrGetExecutablePath(path, size);
return lovrPlatformGetExecutablePath(path, size);
}
const char* lovrFilesystemGetIdentity() {

View File

@ -435,13 +435,13 @@ static ModelData* openvr_newModelData(Device device) {
if (!state.deviceModels[index]) {
while (state.renderModels->LoadRenderModel_Async(renderModelName, &state.deviceModels[index]) == EVRRenderModelError_VRRenderModelError_Loading) {
lovrSleep(.001);
lovrPlatformSleep(.001);
}
}
if (!state.deviceTextures[index]) {
while (state.renderModels->LoadTexture_Async(state.deviceModels[index]->diffuseTextureId, &state.deviceTextures[index]) == EVRRenderModelError_VRRenderModelError_Loading) {
lovrSleep(.001);
lovrPlatformSleep(.001);
}
}

View File

@ -57,5 +57,5 @@ int lovrTimerGetFPS() {
}
void lovrTimerSleep(double seconds) {
lovrSleep(seconds);
lovrPlatformSleep(seconds);
}