MCPcopy Create free account
hub / github.com/SFML/SFML / onNativeWindowCreated

Function onNativeWindowCreated

src/SFML/Main/MainAndroid.cpp:336–359  ·  view source on GitHub ↗

///////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

334
335////////////////////////////////////////////////////////////
336void onNativeWindowCreated(ANativeActivity* activity, ANativeWindow* window)
337{
338 sf::priv::ActivityStates& states = retrieveStates(*activity);
339 const std::lock_guard lock(states.mutex);
340
341 // Update the activity states
342 states.window = window;
343
344 // If we have no context it's during window creation so don't send the focus event or it will try
345 // to recreate the surface again
346 if (states.context)
347 {
348 states.forwardEvent(sf::Event::FocusGained{});
349 }
350
351 // Wait for the event to be taken into account by SFML
352 states.updated = false;
353 while (!(states.updated | states.terminated))
354 {
355 states.mutex.unlock();
356 sf::sleep(sf::milliseconds(10));
357 states.mutex.lock();
358 }
359}
360
361////////////////////////////////////////////////////////////
362void onNativeWindowDestroyed(ANativeActivity* activity, ANativeWindow* /* window */)

Callers

nothing calls this directly

Calls 2

sleepFunction · 0.85
forwardEventMethod · 0.80

Tested by

no test coverage detected