mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 17:01:18 +02:00
Merge branch 'android' of git://github.com/birarda/hifi into android
This commit is contained in:
commit
0cc4f5b226
10 changed files with 49 additions and 20 deletions
|
@ -17,6 +17,8 @@ if (ANDROID)
|
||||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${ANDROID_APK_OUTPUT_DIR}/libs/${ANDROID_ABI}")
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${ANDROID_APK_OUTPUT_DIR}/libs/${ANDROID_ABI}")
|
||||||
|
|
||||||
setup_hifi_library(Gui Widgets AndroidExtras)
|
setup_hifi_library(Gui Widgets AndroidExtras)
|
||||||
|
|
||||||
|
add_definitions(-DANDROID)
|
||||||
else ()
|
else ()
|
||||||
setup_hifi_project(Gui Widgets)
|
setup_hifi_project(Gui Widgets)
|
||||||
endif ()
|
endif ()
|
||||||
|
@ -28,19 +30,21 @@ include_glm()
|
||||||
link_hifi_libraries(shared networking audio-client avatars)
|
link_hifi_libraries(shared networking audio-client avatars)
|
||||||
include_dependency_includes()
|
include_dependency_includes()
|
||||||
|
|
||||||
find_package(LibOVR)
|
if (ANDROID)
|
||||||
if (LIBOVR_FOUND)
|
find_package(LibOVR)
|
||||||
add_definitions(-DHAVE_LIBOVR)
|
|
||||||
target_link_libraries(${TARGET_NAME} ${LIBOVR_LIBRARIES} ${LIBOVR_ANDROID_LIBRARIES})
|
if (LIBOVR_FOUND)
|
||||||
include_directories(SYSTEM ${LIBOVR_INCLUDE_DIRS})
|
add_definitions(-DHAVE_LIBOVR)
|
||||||
|
target_link_libraries(${TARGET_NAME} ${LIBOVR_LIBRARIES} ${LIBOVR_ANDROID_LIBRARIES})
|
||||||
|
include_directories(SYSTEM ${LIBOVR_INCLUDE_DIRS})
|
||||||
|
|
||||||
if (ANDROID)
|
|
||||||
# we need VRLib, so add a project.properties to our apk build folder that says that
|
# we need VRLib, so add a project.properties to our apk build folder that says that
|
||||||
file(RELATIVE_PATH RELATIVE_VRLIB_PATH ${ANDROID_APK_OUTPUT_DIR} "${LIBOVR_VRLIB_DIR}")
|
file(RELATIVE_PATH RELATIVE_VRLIB_PATH ${ANDROID_APK_OUTPUT_DIR} "${LIBOVR_VRLIB_DIR}")
|
||||||
file(WRITE "${ANDROID_APK_BUILD_DIR}/project.properties" "android.library.reference.1=${RELATIVE_VRLIB_PATH}")
|
file(WRITE "${ANDROID_APK_BUILD_DIR}/project.properties" "android.library.reference.1=${RELATIVE_VRLIB_PATH}")
|
||||||
|
|
||||||
list(APPEND IGNORE_COPY_LIBS ${LIBOVR_ANDROID_LIBRARIES})
|
list(APPEND IGNORE_COPY_LIBS ${LIBOVR_ANDROID_LIBRARIES})
|
||||||
endif (ANDROID)
|
endif ()
|
||||||
|
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# the presence of a HOCKEY_APP_ID means we are making a beta build
|
# the presence of a HOCKEY_APP_ID means we are making a beta build
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 88 KiB After Width: | Height: | Size: 9.7 KiB |
|
@ -13,13 +13,13 @@
|
||||||
|
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
|
|
||||||
|
#include <qpa/qplatformnativeinterface.h>
|
||||||
#include <QtAndroidExtras/QAndroidJniEnvironment>
|
#include <QtAndroidExtras/QAndroidJniEnvironment>
|
||||||
#include <QtAndroidExtras/QAndroidJniObject>
|
#include <QtAndroidExtras/QAndroidJniObject>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <QtCore/QTimer>
|
#include <QtCore/QTimer>
|
||||||
#include <qpa/qplatformnativeinterface.h>
|
|
||||||
#include <QtWidgets/QMenuBar>
|
#include <QtWidgets/QMenuBar>
|
||||||
|
|
||||||
#ifdef HAVE_LIBOVR
|
#ifdef HAVE_LIBOVR
|
||||||
|
@ -53,13 +53,12 @@ GVRInterface::GVRInterface(int argc, char* argv[]) :
|
||||||
|
|
||||||
connect(this, &QGuiApplication::applicationStateChanged, this, &GVRInterface::handleApplicationStateChange);
|
connect(this, &QGuiApplication::applicationStateChanged, this, &GVRInterface::handleApplicationStateChange);
|
||||||
|
|
||||||
#if defined(Q_WS_ANDROID) && defined(HAVE_LIBOVR)
|
#if defined(ANDROID) && defined(HAVE_LIBOVR)
|
||||||
QAndroidJniEnvironment jniEnv;
|
QAndroidJniEnvironment jniEnv;
|
||||||
|
|
||||||
QPlatformNativeInterface* interface = QApplication::platformNativeInterface();
|
QPlatformNativeInterface* interface = QApplication::platformNativeInterface();
|
||||||
jobject activity = (jobject) interface->nativeResourceForIntegration("QtActivity");
|
jobject activity = (jobject) interface->nativeResourceForIntegration("QtActivity");
|
||||||
|
|
||||||
|
|
||||||
ovr_RegisterHmtReceivers(&*jniEnv, activity);
|
ovr_RegisterHmtReceivers(&*jniEnv, activity);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ class GVRInterface : public QApplication {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
GVRInterface(int argc, char* argv[]);
|
GVRInterface(int argc, char* argv[]);
|
||||||
|
|
||||||
RenderingClient* getClient() { return _client; }
|
RenderingClient* getClient() { return _client; }
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#include <QtWidgets/QInputDialog>
|
#include <QtWidgets/QInputDialog>
|
||||||
#include <QtWidgets/QMenuBar>
|
#include <QtWidgets/QMenuBar>
|
||||||
|
|
||||||
#ifndef Q_OS_ANDROID
|
#ifndef ANDROID
|
||||||
#include <QtWidgets/QDesktopWidget>
|
#include <QtWidgets/QDesktopWidget>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -42,13 +42,18 @@ GVRMainWindow::GVRMainWindow(QWidget* parent) :
|
||||||
menuBar()->addMenu(helpMenu);
|
menuBar()->addMenu(helpMenu);
|
||||||
|
|
||||||
QAction* goToAddress = new QAction("Go to Address", fileMenu);
|
QAction* goToAddress = new QAction("Go to Address", fileMenu);
|
||||||
QAction* aboutQt = new QAction("About Qt", helpMenu);
|
|
||||||
|
|
||||||
fileMenu->addAction(goToAddress);
|
|
||||||
helpMenu->addAction(aboutQt);
|
|
||||||
|
|
||||||
connect(goToAddress, &QAction::triggered, this, &GVRMainWindow::showAddressBar);
|
connect(goToAddress, &QAction::triggered, this, &GVRMainWindow::showAddressBar);
|
||||||
|
fileMenu->addAction(goToAddress);
|
||||||
|
|
||||||
|
#ifdef ANDROID
|
||||||
|
QAction* goFullScreen = new QAction("Enter Full Screen", fileMenu);
|
||||||
|
connect(goFullScreen, &QAction::triggered, this, &GVRMainWindow::goFullScreen);
|
||||||
|
fileMenu->addAction(goFullScreen);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
QAction* aboutQt = new QAction("About Qt", helpMenu);
|
||||||
connect(aboutQt, &QAction::triggered, qApp, &QApplication::aboutQt);
|
connect(aboutQt, &QAction::triggered, qApp, &QApplication::aboutQt);
|
||||||
|
helpMenu->addAction(aboutQt);
|
||||||
|
|
||||||
QWidget* baseWidget = new QWidget(this);
|
QWidget* baseWidget = new QWidget(this);
|
||||||
|
|
||||||
|
@ -62,7 +67,15 @@ GVRMainWindow::GVRMainWindow(QWidget* parent) :
|
||||||
setCentralWidget(baseWidget);
|
setCentralWidget(baseWidget);
|
||||||
|
|
||||||
// add the interface view
|
// add the interface view
|
||||||
InterfaceView* interfaceView = new InterfaceView(baseWidget);
|
new InterfaceView(baseWidget);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GVRMainWindow::goFullScreen() {
|
||||||
|
#ifdef ANDROID
|
||||||
|
menuBar()->hide();
|
||||||
|
#else
|
||||||
|
showFullScreen();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void GVRMainWindow::showAddressBar() {
|
void GVRMainWindow::showAddressBar() {
|
||||||
|
|
|
@ -22,6 +22,7 @@ public:
|
||||||
GVRMainWindow(QWidget* parent = 0);
|
GVRMainWindow(QWidget* parent = 0);
|
||||||
public slots:
|
public slots:
|
||||||
void showAddressBar();
|
void showAddressBar();
|
||||||
|
void goFullScreen();
|
||||||
private:
|
private:
|
||||||
QVBoxLayout* _mainLayout;
|
QVBoxLayout* _mainLayout;
|
||||||
};
|
};
|
||||||
|
|
|
@ -16,7 +16,11 @@ int main(int argc, char* argv[]) {
|
||||||
GVRInterface app(argc, argv);
|
GVRInterface app(argc, argv);
|
||||||
|
|
||||||
GVRMainWindow mainWindow;
|
GVRMainWindow mainWindow;
|
||||||
|
#ifdef ANDROID
|
||||||
|
mainWindow.showFullScreen();
|
||||||
|
#else
|
||||||
mainWindow.showMaximized();
|
mainWindow.showMaximized();
|
||||||
|
#endif
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
|
@ -31,6 +31,8 @@ elseif (WIN32)
|
||||||
add_definitions(-DNSIGHT_FOUND)
|
add_definitions(-DNSIGHT_FOUND)
|
||||||
target_link_libraries(${TARGET_NAME} "${NSIGHT_LIBRARIES}")
|
target_link_libraries(${TARGET_NAME} "${NSIGHT_LIBRARIES}")
|
||||||
endif ()
|
endif ()
|
||||||
|
elseif (ANDROID)
|
||||||
|
target_link_libraries(${TARGET_NAME} "-lGLESv3" "-lEGL")
|
||||||
else ()
|
else ()
|
||||||
find_package(OpenGL REQUIRED)
|
find_package(OpenGL REQUIRED)
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
#include <GL/wglew.h>
|
#include <GL/wglew.h>
|
||||||
|
|
||||||
|
#elif defined(ANDROID)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#include <GL/gl.h>
|
#include <GL/gl.h>
|
||||||
#include <GL/glext.h>
|
#include <GL/glext.h>
|
||||||
|
|
|
@ -57,7 +57,11 @@ const QUrl AddressManager::currentAddress() const {
|
||||||
|
|
||||||
void AddressManager::loadSettings(const QString& lookupString) {
|
void AddressManager::loadSettings(const QString& lookupString) {
|
||||||
if (lookupString.isEmpty()) {
|
if (lookupString.isEmpty()) {
|
||||||
handleLookupString(SettingHandles::currentAddress.get().toString());
|
const QString& lastAddress = SettingHandles::currentAddress.get().toString();
|
||||||
|
|
||||||
|
if (lastAddress.isEmpty()) {
|
||||||
|
handleLookupString(lastAddress);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
handleLookupString(lookupString);
|
handleLookupString(lookupString);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue