mirror of https://github.com/bjornbytes/lovr.git
Route ODE messages into LOVR log system
ODE errors, debugs and messages are redirected into LOVR's log system by a callback mechanism for each. The ODE submodule is updated to revision that does not crash when error or debug occurs.
This commit is contained in:
parent
0daaca7a4f
commit
f6fbc2ad17
|
@ -1 +1 @@
|
|||
Subproject commit 8bf3aa17d1283aa65bf55a39a13b82dcb5853aaf
|
||||
Subproject commit e17fac33eee0c291d62fdd49a337837140a56116
|
|
@ -39,11 +39,32 @@ static uint32_t findTag(World* world, const char* name) {
|
|||
return NO_TAG;
|
||||
}
|
||||
|
||||
static void onErrorMessage(int num, const char* format, va_list args) {
|
||||
char message[1024];
|
||||
vsnprintf(message, 1024, format, args);
|
||||
lovrLog(LOG_ERROR, "PHY", message);
|
||||
}
|
||||
|
||||
static void onDebugMessage(int num, const char* format, va_list args) {
|
||||
char message[1024];
|
||||
vsnprintf(message, 1024, format, args);
|
||||
lovrLog(LOG_DEBUG, "PHY", message);
|
||||
}
|
||||
|
||||
static void onInfoMessage(int num, const char* format, va_list args) {
|
||||
char message[1024];
|
||||
vsnprintf(message, 1024, format, args);
|
||||
lovrLog(LOG_INFO, "PHY", message);
|
||||
}
|
||||
|
||||
static bool initialized = false;
|
||||
|
||||
bool lovrPhysicsInit() {
|
||||
if (initialized) return false;
|
||||
dInitODE();
|
||||
dSetErrorHandler(onErrorMessage);
|
||||
dSetDebugHandler(onDebugMessage);
|
||||
dSetMessageHandler(onInfoMessage);
|
||||
return initialized = true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue