Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/SFMLPublic

Android examples#3613

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
JonnyPtn wants to merge13 commits intoSFML:master
base:master
Choose a base branch
Loading
fromJonnyPtn:android_examples
Draft

Conversation

@JonnyPtn
Copy link
Contributor

@JonnyPtnJonnyPtn commentedNov 25, 2025
edited
Loading

Currently none of the examples work for Android, there's only a separate android example with lots of android specific code.

This is a draft to add an android project to SFML which can build and run the shared examples easily. Examples supported (Parity with iOS):

  • Window
  • Event handling
  • OpenGL
  • Stencil
  • Tennis
  • Text
  • Keyboard

Project setup has an "SFML" module which declares the external native build to use our cmake setup, then a lightweight app module for each example, which is basically just an app manifest stating which shared library to run

Window creation changes

Window creation on android is asynchronous. This causes problems as when ansf::Window is created on android it's not actually valid until the callback is received and the egl surface can be created, which we do when polling events. The issue here is demonstrated by the window example, where we do stuff with the window before polling events and they fail.

This PR changes window construction to wait for the window to actually be created. While blocking like this may not seem like a great idea the current implementation already blocks the application startup until the firstsf::Window is created anyway so I don't think it's a big issue, and I'm not sure there are any alternatives without requiring users to add their own blocking code after window creation

# Executables on android are shared libraries loaded by the native activity
add_library(${target} SHARED${target_input})
target_link_libraries(${target}PRIVATE SFML::Main)
target_link_options(${target}PRIVATE -u ANativeActivity_onCreate)# Prevent these from being stripped
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This is something every user would have to do, so perhaps it should be set as a public property onSFML::Main instead so they don't have to?

@JonnyPtn
Copy link
ContributorAuthor

I believe the window changes here should solve#3521

@eXpl0it3reXpl0it3r linked an issueNov 25, 2025 that may beclosed by this pull request
3 tasks
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

EGL context is not created on Android

2 participants

@JonnyPtn@eXpl0it3r

[8]ページ先頭

©2009-2025 Movatter.jp