Cross-platform application framework for 2D User Interfaces (similar to QT) and 3D graphics based on OpenGL, written in C++20.
Build using cmake or any IDE that supports it.
mkdir build
cd build
cmake ..
make -j
All dependencies are checked out and unzipped automatically.
GLBase OpenGL Utilities and wrapper classes / Window Management
SceneGraph 3D Scenegraph
UI UI System
Utilities FileSystem, Network, String and other utilities
#include <UIApplication.h>
using namespace ara
using namespace glm
int main(int, char**) {
// create an Application instance
UIApplication app
// init the application, passing a lambda function, creating a single UI Element
app.init([](UINode& rootNode) {
// Add a red, 400 by 400 pixels, centered "Div" element (similar to a html <div>)
rootNode.addChild<Div>({
.size = ivec2{400,400},
.bgColor = vec4{1.f, 0.f, 0.f, 1.f},
.align = align::center,
.valign = valign::center
})
})
// start the render loop. This will block until the loop is terminated
app.startEventLoop()
return 0
}
Add these two lines to your ara sdks application root folders CMakeLists.txt
include(GenerateAndroidProject)
gen_android_proj(${PROJECT_NAME} 0 icon)
The first argument refers to the cmake project name, the second to the type of Android Project (0 = pure native NDK application, 1 = Java NDI application) and the third argument refers to an icon in png format which will be included into the AndroidManifest file
(Note: depending on your setup you may need to add an explicit path to the ara sdk modules: e.g.: include(${ara_sdk_SOURCE_DIR}/Libraries/cmake/Modules/Android/GenerateAndroidProject.cmake)
)
This will generate a folder called ${PROJECT_NAME}_Android in the root folder of your project. Open this folder with Android Studio and build it as a usual NDK project.
As a demo, check the example project in Examples/UITest and uncommnent the lines:
include(Android/GenerateAndroidProject)
gen_android_proj(${PROJECT_NAME} 0 icon)
This will generate the folder Examples/UITest/UITest_Android. Open and build it as a regular project in android studio.
Important
- all resources such as images, fonts, etc. are expected to be in a folder called Assets in the root folder of the project
- inside the Assets folder, a folder called SplashScreen with a bitmap icon, a background image and a splash screen xml layout file is expected
The GenerateAndroidProject macro involves a few automatically executed steps
- check for the NDK version installed on your system (ANDROID_NDK and ANDROID_NDK_HOME environment variables must be set)
- check for a derivative of UIApplication in the root and src/ folder of your project and create a file called native_lib.cpp which will create an instance of this derivative class. This file will contain the android_main() function and also set up the ASensorManage
- create a CMakeLists.txt file inside the ${PROJECT_NAME}_Android folder including the ara sdk dependencies and source files. It will also include any *.cpp sources inside the projects root folder
- create a AndroidManifest file including the icon passed as an argument to gen_android_proj()
- in case of a JNI app, create a java MainActivity class, a JNI interface class and a camera permission helper class
- create a key for signing using keytool