mirror of
https://github.com/SFML/SFML.git
synced 2024-11-28 22:31:09 +08:00
[Android] No longer cache the window size
Because onContextRectChanged happens after the surface creation thus, the window doesn't return the correct value when the surface gets created.
This commit is contained in:
parent
17430ef372
commit
860c232507
@ -95,12 +95,7 @@ void WindowImplAndroid::processEvents()
|
||||
Event tempEvent = states->pendingEvents.back();
|
||||
states->pendingEvents.pop_back();
|
||||
|
||||
if (tempEvent.type == Event::Resized)
|
||||
{
|
||||
m_width = tempEvent.size.width;
|
||||
m_height = tempEvent.size.height;
|
||||
}
|
||||
else if (tempEvent.type == Event::GainedFocus)
|
||||
if (tempEvent.type == Event::GainedFocus)
|
||||
{
|
||||
states->context->createSurface(states->window);
|
||||
states->updated = true;
|
||||
@ -134,7 +129,13 @@ void WindowImplAndroid::setPosition(const Vector2i& position)
|
||||
////////////////////////////////////////////////////////////
|
||||
Vector2u WindowImplAndroid::getSize() const
|
||||
{
|
||||
return Vector2u(static_cast<unsigned int>(m_width), static_cast<unsigned int>(m_height));
|
||||
ActivityStates* states = getActivity(NULL);
|
||||
Lock lock(states->mutex);
|
||||
|
||||
int32_t width = ANativeWindow_getWidth(states->window);
|
||||
int32_t height = ANativeWindow_getHeight(states->window);
|
||||
|
||||
return Vector2u(static_cast<unsigned int>(width), static_cast<unsigned int>(height));
|
||||
}
|
||||
|
||||
|
||||
@ -161,12 +162,14 @@ void WindowImplAndroid::setIcon(unsigned int width, unsigned int height, const U
|
||||
////////////////////////////////////////////////////////////
|
||||
void WindowImplAndroid::setVisible(bool visible)
|
||||
{
|
||||
// Not applicable
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
void WindowImplAndroid::setMouseCursorVisible(bool visible)
|
||||
{
|
||||
// Not applicable
|
||||
}
|
||||
|
||||
|
||||
|
@ -200,13 +200,6 @@ private:
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
static int getUnicode(AInputEvent* event);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Member data
|
||||
////////////////////////////////////////////////////////////
|
||||
// Cache the width and height, as calls to ANativeWindow_getWidth/Height can be slow
|
||||
int m_width;
|
||||
int m_height;
|
||||
};
|
||||
|
||||
} // namespace priv
|
||||
|
Loading…
Reference in New Issue
Block a user