From 7fbf75db4259fa5fa20aeb8f55b1b278cb131e13 Mon Sep 17 00:00:00 2001 From: XProger Date: Sat, 3 Mar 2018 16:24:02 +0300 Subject: [PATCH] #15 fix android build --- src/platform/android/app/src/main/cpp/main.cpp | 14 +++++++++----- src/sound.h | 6 +++++- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/platform/android/app/src/main/cpp/main.cpp b/src/platform/android/app/src/main/cpp/main.cpp index c1f5945..013094d 100644 --- a/src/platform/android/app/src/main/cpp/main.cpp +++ b/src/platform/android/app/src/main/cpp/main.cpp @@ -169,23 +169,27 @@ JNI_METHOD(void, nativeTouch)(JNIEnv* env, jobject obj, jint id, jint state, jfl // gamepad / keyboard if (state < 0) { switch (state) { - case -3 : Input::setPos(ikJoyL, vec2(DeadZone(x), DeadZone(y))); break; - case -4 : Input::setPos(ikJoyR, vec2(DeadZone(x), DeadZone(y))); break; - case -5 : Input::setPos(ikJoyPOV, vec2(float(getPOV(sign(x), sign(y))), 0.0f)); break; + case -3 : Input::setJoyPos(0, jkL, vec2(DeadZone(x), DeadZone(y))); break; + case -4 : Input::setJoyPos(0, jkR, vec2(DeadZone(x), DeadZone(y))); break; + //case -5 : Input::setJoyPos(ikJoyPOV, vec2(float(getPOV(sign(x), sign(y))), 0.0f)); break; default : { int btn = int(x); - InputKey key = btn <= 0 ? InputKey(ikJoyA - btn) : keyToInputKey(btn); - Input::setDown(key, state != -1); + if (btn <= 0) + Input::setJoyDown(0, JoyKey(jkA - btn), state != -1); + else + Input::setDown(keyToInputKey(btn), state != -1); } } return; } if (id == -100) { + /* switch (state) { 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; } + */ return; } diff --git a/src/sound.h b/src/sound.h index b474c40..f9d0050 100644 --- a/src/sound.h +++ b/src/sound.h @@ -412,9 +412,13 @@ namespace Sound { stb_vorbis_alloc alloc; 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 = 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); stb_vorbis_info info = stb_vorbis_get_info(ogg); this->channels = info.channels;