Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/framework/core/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@ void Application::init(std::vector<std::string>& args)
g_configs.init();

// initialize resources
#ifdef ANDROID
g_resources.init(nullptr);
#else
g_resources.init(args[0].data());
#endif

// initialize lua
g_lua.init();
Expand Down
5 changes: 3 additions & 2 deletions src/framework/platform/androidmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
* THE SOFTWARE.
*/

#ifndef ANDROIDMANAGER_H
#define ANDROIDMANAGER_H
#pragma once

#ifdef ANDROID

#include <game-activity/native_app_glue/android_native_app_glue.h>
#include <string>
Expand Down
15 changes: 9 additions & 6 deletions src/framework/platform/androidwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,14 @@ void AndroidWindow::poll() {
case TOUCH_DOWN:
case TOUCH_LONGPRESS:
case TOUCH_UP:
processFingerdownAndFingerup();
processFingerDownAndUp();
break;
case TOUCH_MOTION:
processFingermotion();
processFingerMotion();
case KEY_DOWN:
case KEY_UP:
case EVENT_UNDEFINED:
processKeyDownOrKeyUp();
processKeyDownOrUp();
break;
}

Expand All @@ -217,7 +217,7 @@ void AndroidWindow::poll() {
fireKeysPress();
}

void AndroidWindow::processKeyDownOrKeyUp() {
void AndroidWindow::processKeyDownOrUp() {
if(m_currentEvent.type == KEY_DOWN || m_currentEvent.type == KEY_UP) {
Fw::Key keyCode = Fw::KeyUnknown;
KeyCode key = m_currentEvent.keyCode;
Expand Down Expand Up @@ -246,7 +246,7 @@ void AndroidWindow::processTextInput() {
}
}

void AndroidWindow::processFingerdownAndFingerup() {
void AndroidWindow::processFingerDownAndUp() {
bool isTouchdown = m_currentEvent.type == TOUCH_DOWN;
Fw::MouseButton mouseButton = (m_currentEvent.type == TOUCH_LONGPRESS) ?
Fw::MouseRightButton : Fw::MouseLeftButton;
Expand All @@ -268,7 +268,7 @@ void AndroidWindow::processFingerdownAndFingerup() {
m_onInputEvent(m_inputEvent);
}

void AndroidWindow::processFingermotion() {
void AndroidWindow::processFingerMotion() {
m_inputEvent.reset();
m_inputEvent.type = Fw::MouseMoveInputEvent;

Expand Down Expand Up @@ -344,6 +344,9 @@ void AndroidWindow::initializeAndroidApp(android_app* app) {
auto *engine = (AndroidWindow*) app->userData;
engine->handleCmd(cmd);
};

android_app_set_key_event_filter(m_app, NULL);
android_app_set_motion_event_filter(m_app, NULL);
}

void AndroidWindow::onNativeTouch(int actionType,
Expand Down
11 changes: 6 additions & 5 deletions src/framework/platform/androidwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
* THE SOFTWARE.
*/

#ifndef ANDROIDWINDOW_H
#define ANDROIDWINDOW_H
#pragma once

#ifdef ANDROID

#include "platformwindow.h"
#include <android/native_window.h>
Expand Down Expand Up @@ -89,10 +90,10 @@ class AndroidWindow : public PlatformWindow
uint32_t pointerIndex,
GameActivityMotionEvent* motionEvent);

void processKeyDownOrKeyUp();
void processKeyDownOrUp();
void processTextInput();
void processFingerdownAndFingerup();
void processFingermotion();
void processFingerDownAndUp();
void processFingerMotion();

void handleNativeEvents();
void handleCmd(int32_t cmd);
Expand Down