[iOS] Adjusted the code and build files to use Automatic Reference Counting

This commit is contained in:
Laurent Gomila 2013-08-24 22:03:34 +02:00 committed by Jonathan De Wachter
parent d50f94ca97
commit e20ff86330
3 changed files with 14 additions and 5 deletions

View File

@ -89,6 +89,11 @@ macro(sfml_add_library target)
INSTALL_NAME_DIR "@executable_path/../Frameworks")
endif()
# enable automatic reference counting on iOS
if (IOS)
set_target_properties(${target} PROPERTIES XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC YES)
endif()
# link the target to its external dependencies
if(THIS_EXTERNAL_LIBS)
target_link_libraries(${target} ${THIS_EXTERNAL_LIBS})
@ -143,6 +148,11 @@ macro(sfml_add_example target)
target_link_libraries(${target} ${THIS_DEPENDS})
endif()
# enable automatic reference counting on iOS
if (IOS)
set_target_properties(${target} PROPERTIES XCODE_ATTRIBUTE_CLANG_ENABLE_OBJC_ARC YES)
endif()
# add the install rule
install(TARGETS ${target}
RUNTIME DESTINATION ${INSTALL_MISC_DIR}/examples/${target} COMPONENT examples)

View File

@ -30,7 +30,9 @@
#include <SFML/Window/iOS/SFView.hpp>
#include <SFML/System/Err.hpp>
#include <OpenGLES/EAGL.h>
#include <OpenGLES/EAGLDrawable.h>
#include <OpenGLES/ES1/glext.h>
#include <QuartzCore/CAEAGLLayer.h>
namespace sf
@ -98,9 +100,6 @@ EaglContext::~EaglContext()
// Restore the previous context
[EAGLContext setCurrentContext:previousContext];
// Release the context
[m_context release];
}
}
@ -125,7 +124,7 @@ void EaglContext::recreateRenderBuffers(SFView* glView)
glGenRenderbuffersOES(1, &m_colorbuffer);
glBindRenderbufferOES(GL_RENDERBUFFER_OES, m_colorbuffer);
if (glView)
[m_context renderbufferStorage:GL_RENDERBUFFER_OES fromDrawable:glView.layer];
[m_context renderbufferStorage:GL_RENDERBUFFER_OES fromDrawable:(CAEAGLLayer*)glView.layer];
glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, m_colorbuffer);
// Create a depth buffer if requested

View File

@ -98,7 +98,7 @@ void WindowImplUIKit::processEvents()
////////////////////////////////////////////////////////////
WindowHandle WindowImplUIKit::getSystemHandle() const
{
return m_window;
return (__bridge WindowHandle)m_window;
}