mirror of
https://github.com/SFML/SFML.git
synced 2024-12-01 15:51:04 +08:00
[Android] Moved getActivity(ActivitySttates*) to the system module
Somehow this function gets stripped by compilators if I put this in the main module (which is what we want). To solve this issue (and to avoid additional dependencies on sfml-window), I moved it to the system module since all SFML modules depend on it.
This commit is contained in:
parent
4180e6b31f
commit
c77b8a3496
@ -64,6 +64,6 @@ sfml_add_library(sfml-audio
|
|||||||
else()
|
else()
|
||||||
sfml_add_library(sfml-audio
|
sfml_add_library(sfml-audio
|
||||||
SOURCES ${SRC}
|
SOURCES ${SRC}
|
||||||
DEPENDS sfml-system sfml-window
|
DEPENDS sfml-system
|
||||||
EXTERNAL_LIBS ${AUDIO_EXT_LIBS})
|
EXTERNAL_LIBS ${AUDIO_EXT_LIBS})
|
||||||
endif()
|
endif()
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#include <SFML/Audio/SoundFile.hpp>
|
#include <SFML/Audio/SoundFile.hpp>
|
||||||
#ifdef SFML_SYSTEM_ANDROID
|
#ifdef SFML_SYSTEM_ANDROID
|
||||||
#include <SFML/Window/Android/Activity.hpp>
|
#include <SFML/System/Android/Activity.hpp>
|
||||||
#include <SFML/System/Lock.hpp>
|
#include <SFML/System/Lock.hpp>
|
||||||
#endif
|
#endif
|
||||||
#include <SFML/System/InputStream.hpp>
|
#include <SFML/System/InputStream.hpp>
|
||||||
|
@ -41,11 +41,11 @@ set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/Modules/")
|
|||||||
set(LIBRARY_OUTPUT_PATH "${PROJECT_BINARY_DIR}/lib")
|
set(LIBRARY_OUTPUT_PATH "${PROJECT_BINARY_DIR}/lib")
|
||||||
|
|
||||||
# add the modules subdirectories
|
# add the modules subdirectories
|
||||||
add_subdirectory(System)
|
add_subdirectory(System)
|
||||||
add_subdirectory(Window)
|
|
||||||
if(SFML_OS_WINDOWS OR SFML_OS_ANDROID OR SFML_OS_IOS)
|
if(SFML_OS_WINDOWS OR SFML_OS_ANDROID OR SFML_OS_IOS)
|
||||||
add_subdirectory(Main)
|
add_subdirectory(Main)
|
||||||
endif()
|
endif()
|
||||||
|
add_subdirectory(Window)
|
||||||
add_subdirectory(Network)
|
add_subdirectory(Network)
|
||||||
add_subdirectory(Graphics)
|
add_subdirectory(Graphics)
|
||||||
if(NOT SFML_OS_IOS OR NOT (SFML_OS_ANDROID AND ${ANDROID_ABI} MATCHES "mips"))
|
if(NOT SFML_OS_IOS OR NOT (SFML_OS_ANDROID AND ${ANDROID_ABI} MATCHES "mips"))
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#include <SFML/Graphics/Font.hpp>
|
#include <SFML/Graphics/Font.hpp>
|
||||||
#include <SFML/Graphics/GLCheck.hpp>
|
#include <SFML/Graphics/GLCheck.hpp>
|
||||||
#ifdef SFML_SYSTEM_ANDROID
|
#ifdef SFML_SYSTEM_ANDROID
|
||||||
#include <SFML/Window/Android/Activity.hpp>
|
#include <SFML/System/Android/Activity.hpp>
|
||||||
#include <SFML/System/Lock.hpp>
|
#include <SFML/System/Lock.hpp>
|
||||||
#endif
|
#endif
|
||||||
#include <SFML/System/InputStream.hpp>
|
#include <SFML/System/InputStream.hpp>
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#include <SFML/Graphics/Image.hpp>
|
#include <SFML/Graphics/Image.hpp>
|
||||||
#include <SFML/Graphics/ImageLoader.hpp>
|
#include <SFML/Graphics/ImageLoader.hpp>
|
||||||
#ifdef SFML_SYSTEM_ANDROID
|
#ifdef SFML_SYSTEM_ANDROID
|
||||||
#include <SFML/Window/Android/Activity.hpp>
|
#include <SFML/System/Android/Activity.hpp>
|
||||||
#include <SFML/System/Lock.hpp>
|
#include <SFML/System/Lock.hpp>
|
||||||
#endif
|
#endif
|
||||||
#include <SFML/System/Err.hpp>
|
#include <SFML/System/Err.hpp>
|
||||||
|
@ -23,13 +23,24 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
// Android specific: we define the ANativeActivity_onCreate
|
||||||
|
// entry point, handling all the native activity stuff, then
|
||||||
|
// we call the user defined (and poratble) main function in
|
||||||
|
// an external thread so developers can keep a portable code
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
// Headers
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
#include <SFML/Config.hpp>
|
#include <SFML/Config.hpp>
|
||||||
|
|
||||||
#ifdef SFML_SYSTEM_ANDROID
|
#ifdef SFML_SYSTEM_ANDROID
|
||||||
|
|
||||||
#include <SFML/Window/Android/Activity.hpp>
|
|
||||||
#include <SFML/Window/EGLCheck.hpp>
|
#include <SFML/Window/EGLCheck.hpp>
|
||||||
#include <SFML/Window/Keyboard.hpp>
|
#include <SFML/Window/Keyboard.hpp>
|
||||||
|
#include <SFML/System/Android/Activity.hpp>
|
||||||
#include <SFML/System/Sleep.hpp>
|
#include <SFML/System/Sleep.hpp>
|
||||||
#include <SFML/System/Thread.hpp>
|
#include <SFML/System/Thread.hpp>
|
||||||
#include <SFML/System/Lock.hpp>
|
#include <SFML/System/Lock.hpp>
|
||||||
@ -41,7 +52,6 @@ namespace sf
|
|||||||
{
|
{
|
||||||
namespace priv
|
namespace priv
|
||||||
{
|
{
|
||||||
|
|
||||||
Keyboard::Key mapAndroidKeyToSFMLKey(int32_t key)
|
Keyboard::Key mapAndroidKeyToSFMLKey(int32_t key)
|
||||||
{
|
{
|
||||||
switch (key)
|
switch (key)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// SFML - Simple and Fast Multimedia Library
|
// SFML - Simple and Fast Multimedia Library
|
||||||
|
// Copyright (C) 2007-2013 Laurent Gomila (laurent.gom@gmail.com)
|
||||||
// Copyright (C) 2013 Jonathan De Wachter (dewachter.jonathan@gmail.com)
|
// Copyright (C) 2013 Jonathan De Wachter (dewachter.jonathan@gmail.com)
|
||||||
//
|
//
|
||||||
// This software is provided 'as-is', without any express or implied warranty.
|
// This software is provided 'as-is', without any express or implied warranty.
|
||||||
@ -22,20 +23,24 @@
|
|||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <SFML/Window/Android/Activity.hpp>
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
// Headers
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
#include <SFML/System/Android/Activity.hpp>
|
||||||
|
|
||||||
namespace sf
|
namespace sf
|
||||||
{
|
{
|
||||||
namespace priv
|
namespace priv
|
||||||
{
|
{
|
||||||
ActivityStates* getActivity(ActivityStates* initializedStates)
|
ActivityStates* getActivity(ActivityStates* initializedStates)
|
||||||
{
|
{
|
||||||
static ActivityStates* states = NULL;
|
static ActivityStates* states = NULL;
|
||||||
|
|
||||||
if (!states)
|
if (!states)
|
||||||
states = initializedStates;
|
states = initializedStates;
|
||||||
|
|
||||||
return states;
|
return states;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -70,7 +70,8 @@ struct ActivityStates
|
|||||||
bool updated;
|
bool updated;
|
||||||
};
|
};
|
||||||
|
|
||||||
SFML_WINDOW_API ActivityStates* getActivity(ActivityStates* initializedStates=NULL);
|
SFML_SYSTEM_API ActivityStates* getActivity(ActivityStates* initializedStates=NULL);
|
||||||
|
|
||||||
} // namespace priv
|
} // namespace priv
|
||||||
} // namespace sf
|
} // namespace sf
|
||||||
|
|
@ -66,6 +66,14 @@ else()
|
|||||||
${SRCROOT}/Unix/ThreadLocalImpl.cpp
|
${SRCROOT}/Unix/ThreadLocalImpl.cpp
|
||||||
${SRCROOT}/Unix/ThreadLocalImpl.hpp
|
${SRCROOT}/Unix/ThreadLocalImpl.hpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(ANDROID)
|
||||||
|
set(PLATFORM_SRC ${PLATFORM_SRC}
|
||||||
|
${SRCROOT}/Android/Activity.hpp
|
||||||
|
${SRCROOT}/Android/Activity.cpp
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
source_group("unix" FILES ${PLATFORM_SRC})
|
source_group("unix" FILES ${PLATFORM_SRC})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
// Headers
|
// Headers
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#include <SFML/Window/Android/EglContext.hpp>
|
#include <SFML/Window/Android/EglContext.hpp>
|
||||||
#include <SFML/Window/Android/Activity.hpp>
|
#include <SFML/System/Android/Activity.hpp>
|
||||||
#include <SFML/OpenGL.hpp>
|
#include <SFML/OpenGL.hpp>
|
||||||
#include <SFML/System/Err.hpp>
|
#include <SFML/System/Err.hpp>
|
||||||
#include <SFML/System/Sleep.hpp>
|
#include <SFML/System/Sleep.hpp>
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
// Headers
|
// Headers
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#include <SFML/Window/Android/InputImpl.hpp>
|
#include <SFML/Window/Android/InputImpl.hpp>
|
||||||
#include <SFML/Window/Android/Activity.hpp>
|
#include <SFML/System/Android/Activity.hpp>
|
||||||
#include <SFML/System/Lock.hpp>
|
#include <SFML/System/Lock.hpp>
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
// Headers
|
// Headers
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
#include <SFML/Window/VideoModeImpl.hpp>
|
#include <SFML/Window/VideoModeImpl.hpp>
|
||||||
#include <SFML/Window/Android/Activity.hpp>
|
#include <SFML/System/Android/Activity.hpp>
|
||||||
#include <SFML/System/Vector2.hpp>
|
#include <SFML/System/Vector2.hpp>
|
||||||
#include <SFML/System/Sleep.hpp>
|
#include <SFML/System/Sleep.hpp>
|
||||||
#include <SFML/System/Lock.hpp>
|
#include <SFML/System/Lock.hpp>
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include <SFML/Window/WindowStyle.hpp> // important to be included first (conflict with None)
|
#include <SFML/Window/WindowStyle.hpp> // important to be included first (conflict with None)
|
||||||
#include <SFML/Window/Android/WindowImplAndroid.hpp>
|
#include <SFML/Window/Android/WindowImplAndroid.hpp>
|
||||||
#include <SFML/Window/Event.hpp>
|
#include <SFML/Window/Event.hpp>
|
||||||
#include <SFML/Window/Android/Activity.hpp>
|
#include <SFML/System/Android/Activity.hpp>
|
||||||
#include <SFML/System/Lock.hpp>
|
#include <SFML/System/Lock.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
@ -148,9 +148,7 @@ elseif(ANDROID)
|
|||||||
${SRCROOT}/Android/InputImpl.hpp
|
${SRCROOT}/Android/InputImpl.hpp
|
||||||
${SRCROOT}/Android/InputImpl.cpp
|
${SRCROOT}/Android/InputImpl.cpp
|
||||||
${SRCROOT}/Android/JoystickImpl.hpp
|
${SRCROOT}/Android/JoystickImpl.hpp
|
||||||
${SRCROOT}/Android/JoystickImpl.cpp
|
${SRCROOT}/Android/JoystickImpl.cpp)
|
||||||
${SRCROOT}/Android/Activity.hpp
|
|
||||||
${SRCROOT}/Android/Activity.cpp)
|
|
||||||
source_group("android" FILES ${PLATFORM_SRC})
|
source_group("android" FILES ${PLATFORM_SRC})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user