1
0
mirror of https://github.com/XProger/OpenLara.git synced 2025-08-17 18:36:43 +02:00

#15 fix android build

This commit is contained in:
XProger
2018-03-03 16:24:02 +03:00
parent b38747f50e
commit 7fbf75db42
2 changed files with 14 additions and 6 deletions

View File

@@ -169,23 +169,27 @@ JNI_METHOD(void, nativeTouch)(JNIEnv* env, jobject obj, jint id, jint state, jfl
// gamepad / keyboard // gamepad / keyboard
if (state < 0) { if (state < 0) {
switch (state) { switch (state) {
case -3 : Input::setPos(ikJoyL, vec2(DeadZone(x), DeadZone(y))); break; case -3 : Input::setJoyPos(0, jkL, vec2(DeadZone(x), DeadZone(y))); break;
case -4 : Input::setPos(ikJoyR, vec2(DeadZone(x), DeadZone(y))); break; case -4 : Input::setJoyPos(0, jkR, vec2(DeadZone(x), DeadZone(y))); break;
case -5 : Input::setPos(ikJoyPOV, vec2(float(getPOV(sign(x), sign(y))), 0.0f)); break; //case -5 : Input::setJoyPos(ikJoyPOV, vec2(float(getPOV(sign(x), sign(y))), 0.0f)); break;
default : { default : {
int btn = int(x); int btn = int(x);
InputKey key = btn <= 0 ? InputKey(ikJoyA - btn) : keyToInputKey(btn); if (btn <= 0)
Input::setDown(key, state != -1); Input::setJoyDown(0, JoyKey(jkA - btn), state != -1);
else
Input::setDown(keyToInputKey(btn), state != -1);
} }
} }
return; return;
} }
if (id == -100) { if (id == -100) {
/*
switch (state) { switch (state) {
case 0 : Input::head.basis.rot.x = x; Input::head.basis.rot.y = y; break; case 0 : Input::head.basis.rot.x = x; Input::head.basis.rot.y = y; break;
case 1 : Input::head.basis.rot.z = x; Input::head.basis.rot.w = y; Input::head.set(); break; case 1 : Input::head.basis.rot.z = x; Input::head.basis.rot.w = y; Input::head.set(); break;
} }
*/
return; return;
} }

View File

@@ -412,9 +412,13 @@ namespace Sound {
stb_vorbis_alloc alloc; stb_vorbis_alloc alloc;
OGG(Stream *stream, int channels) : Decoder(stream, channels), ogg(NULL) { OGG(Stream *stream, int channels) : Decoder(stream, channels), ogg(NULL) {
char buf[255];
strcpy(buf, Stream::contentDir);
strcat(buf, stream->name);
alloc.alloc_buffer_length_in_bytes = 256 * 1024; alloc.alloc_buffer_length_in_bytes = 256 * 1024;
alloc.alloc_buffer = new char[alloc.alloc_buffer_length_in_bytes]; alloc.alloc_buffer = new char[alloc.alloc_buffer_length_in_bytes];
ogg = stb_vorbis_open_filename(stream->name, NULL, &alloc); ogg = stb_vorbis_open_filename(buf, NULL, &alloc);
ASSERT(ogg); ASSERT(ogg);
stb_vorbis_info info = stb_vorbis_get_info(ogg); stb_vorbis_info info = stb_vorbis_get_info(ogg);
this->channels = info.channels; this->channels = info.channels;