-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Android platform support (rebased on 3.5) #2654
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
||
struct android_app* _globalAndroidApp = NULL; | ||
|
||
extern int main(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is something non standard and would need to be added to the documentation. We have 2 options:
- The
void android_main(struct android_app* app)
implementation is provided byglfw
and will need to forward the realmain
implementation to the hosting app together with thestruct android_app*
(here using theGLFWAPI struct android_app* glfwGetAndroidApp(GLFWwindow* window);
which should also be made global, not specific to a window). - The hosting app will provide the
void android_main(struct android_app* app)
and thestruct android_app*
is forwarded to glfw with a custom method. This will still allow the hosting app to be more standalone and work even without having glfw in the first place.
case APP_CMD_INIT_WINDOW: | ||
break; | ||
|
||
case APP_CMD_TERM_WINDOW: | ||
//_glfwInputWindowCloseRequest(_glfw.windowListHead); | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When device is rotated or app is put to sleep (background) we receive TERM_WINDOW, and when the app is again usable and foreground, we receive INIT_WINDOW. Receiving again init window will do nothing here, and we should instead setup the context in the new native window which has changed in the android_app struct.
case APP_CMD_RESUME: | ||
//_glfwInputWindowIconify(_glfw.windowListHead, GLFW_FALSE); | ||
break; | ||
|
||
case APP_CMD_PAUSE: | ||
//_glfwInputWindowIconify(_glfw.windowListHead, GLFW_TRUE); | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about these, but we could find a better way to notify a glfw window about being paused and resumed.
45ea2f5
to
de06756
Compare
////// GLFW platform API ////// | ||
////////////////////////////////////////////////////////////////////////// | ||
|
||
GLFWbool _glfwCreateWindowAndroid(_GLFWwindow* window, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling this more than once should produce an error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or we could use ASurfaceControl for each window and use the compositor from SurfaceFlinger to composite multiple windows.
How to set orientation for this glfw window? |
Let's move forward android support in glfw, can be done.
It's currently working nicely on YUP using GLES3.0 and the Rive Renderer (kunitoki/yup#29)