Android fixups

This commit is contained in:
elasota
2020-10-12 00:37:32 -04:00
parent 5fbf3f5df0
commit 3b6ae1dba5
15 changed files with 162 additions and 75 deletions

View File

@@ -525,21 +525,27 @@ void GpAudioDriver_SDL2::RefillMixChunk(GpAudioChannel_SDL2 *const*channels, siz
audioMixBuffer += alignPadding;
}
bool noAudio = true;
for (size_t i = 0; i < numChannels; i++)
{
channels[i]->Consume(audioMixBuffer, kMixChunkSize);
if (i == 0)
{
noAudio = false;
for (size_t j = 0; j < kMixChunkSize; j++)
m_mixChunk[j] = audioMixBuffer[j] - 0x80;
m_mixChunk[j] = (audioMixBuffer[j] - 0x80) * 25;
}
else
{
for (size_t j = 0; j < kMixChunkSize; j++)
m_mixChunk[j] += audioMixBuffer[j] - 0x80;
m_mixChunk[j] += (audioMixBuffer[j] - 0x80) * 25;
}
}
if (noAudio)
memset(m_mixChunk, 0, kMixChunkSize * sizeof(m_mixChunk[0]));
}

View File

@@ -700,7 +700,7 @@ public:
bool Init();
static void TranslateSDLMessage(const SDL_Event *msg, IGpVOSEventQueue *eventQueue, float pixelScaleX, float pixelScaleY);
static void TranslateSDLMessage(const SDL_Event *msg, IGpVOSEventQueue *eventQueue, float pixelScaleX, float pixelScaleY, bool obstructiveTextInput);
void Run() override;
void Shutdown() override;
@@ -1540,7 +1540,7 @@ static void PostKeyboardEvent(IGpVOSEventQueue *eventQueue, GpKeyboardInputEvent
}
}
void GpDisplayDriver_SDL_GL2::TranslateSDLMessage(const SDL_Event *msg, IGpVOSEventQueue *eventQueue, float pixelScaleX, float pixelScaleY)
void GpDisplayDriver_SDL_GL2::TranslateSDLMessage(const SDL_Event *msg, IGpVOSEventQueue *eventQueue, float pixelScaleX, float pixelScaleY, bool obstructiveTextInput)
{
switch (msg->type)
{
@@ -1642,9 +1642,11 @@ void GpDisplayDriver_SDL_GL2::TranslateSDLMessage(const SDL_Event *msg, IGpVOSEv
PostKeyboardEvent(eventQueue, keyEventType, subset, key, 1);
}
// Monster hack. This needs to be redone to support OSK.
SDL_StopTextInput();
SDL_StartTextInput();
if (!obstructiveTextInput)
{
SDL_StopTextInput();
SDL_StartTextInput();
}
}
break;
case SDL_QUIT:
@@ -1674,7 +1676,10 @@ void GpDisplayDriver_SDL_GL2::Run()
m_window = SDL_CreateWindow(GP_APPLICATION_NAME, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, m_windowWidthPhysical, m_windowHeightPhysical, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE);
SDL_StartTextInput();
const bool obstructiveTextInput = m_properties.m_systemServices->IsTextInputObstructive();
if (!obstructiveTextInput)
SDL_StartTextInput();
StartOpenGLForWindow(logger);
@@ -1696,7 +1701,7 @@ void GpDisplayDriver_SDL_GL2::Run()
//else if (msg.type == SDL_MOUSELEAVE) // Does SDL support this??
// m_mouseIsInClientArea = false;
TranslateSDLMessage(&msg, m_properties.m_eventQueue, m_pixelScaleX, m_pixelScaleY);
TranslateSDLMessage(&msg, m_properties.m_eventQueue, m_pixelScaleX, m_pixelScaleY, obstructiveTextInput);
}
else
{