OSX/iOS: Updated to Xcode5.

This commit is contained in:
bkaradzic 2013-12-07 10:19:54 -08:00
parent 4970c175c7
commit dee588dfba
6 changed files with 28 additions and 16 deletions

View file

@ -42,7 +42,7 @@ static const char* tokenizeCommandLine(const char* _commandLine, char* _buffer,
switch (state)
{
case SkipWhitespace:
for (; isspace(*curr); ++curr); // skip whitespace
for (; isspace(*curr); ++curr) {}; // skip whitespace
state = SetTerm;
break;
@ -92,7 +92,7 @@ static const char* tokenizeCommandLine(const char* _commandLine, char* _buffer,
case Escape:
{
const char* start = --curr;
for (; '\\' == *curr; ++curr);
for (; '\\' == *curr; ++curr) {};
if ('"' != *curr)
{

View file

@ -16,11 +16,6 @@
#include <bx/uint32_t.h>
#include <bx/thread.h>
namespace bgfx
{
void renderFrame();
}
namespace entry
{
struct MainThreadEntry
@ -76,6 +71,7 @@ namespace entry
void setWindowSize(uint32_t _width, uint32_t _height)
{
BX_UNUSED(_width, _height);
}
void toggleWindowFrame()
@ -84,6 +80,7 @@ namespace entry
void setMouseLock(bool _lock)
{
BX_UNUSED(_lock);
}
} // namespace entry
@ -124,8 +121,8 @@ using namespace entry;
if (nil == m_displayLink)
{
m_displayLink = [self.window.screen displayLinkWithTarget:self selector:@selector(renderFrame)];
[m_displayLink setFrameInterval:1];
[m_displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
//[m_displayLink setFrameInterval:1];
//[m_displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
}
}
@ -163,6 +160,8 @@ using namespace entry;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
BX_UNUSED(application, launchOptions);
CGRect rect = [ [UIScreen mainScreen] bounds];
m_window = [ [UIWindow alloc] initWithFrame: rect];
m_view = [ [View alloc] initWithFrame: rect];
@ -176,24 +175,29 @@ using namespace entry;
- (void)applicationWillResignActive:(UIApplication *)application
{
BX_UNUSED(application);
[m_view stop];
}
- (void)applicationDidEnterBackground:(UIApplication *)application
{
BX_UNUSED(application);
}
- (void)applicationWillEnterForeground:(UIApplication *)application
{
BX_UNUSED(application);
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
BX_UNUSED(application);
[m_view start];
}
- (void)applicationWillTerminate:(UIApplication *)application
{
BX_UNUSED(application);
[m_view stop];
}

View file

@ -53,6 +53,7 @@
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
{
BX_UNUSED(sender);
self->terminated = true;
return NSTerminateCancel;
}
@ -246,13 +247,13 @@ namespace entry
{
break;
}
while (DispatchEvent(PeekEvent() ) );
while (DispatchEvent(PeekEvent() ) ) {};
}
m_eventQueue.postExitEvent();
while (bgfx::RenderFrame::NoContext != bgfx::renderFrame() );
while (bgfx::RenderFrame::NoContext != bgfx::renderFrame() ) {};
thread.shutdown();
return 0;
@ -277,6 +278,7 @@ namespace entry
void setWindowSize(uint32_t _width, uint32_t _height)
{
BX_UNUSED(_width, _height);
}
void toggleWindowFrame()
@ -285,6 +287,7 @@ namespace entry
void setMouseLock(bool _lock)
{
BX_UNUSED(_lock);
}
} // namespace entry

View file

@ -1570,7 +1570,7 @@ namespace bgfx
{
BX_TRACE("render thread start");
Context* ctx = (Context*)_userData;
while (!ctx->renderFrame() );
while (!ctx->renderFrame() ) {};
BX_TRACE("render thread exit");
return EXIT_SUCCESS;
}

View file

@ -14,6 +14,7 @@ namespace bgfx
{
void GlContext::create(uint32_t _width, uint32_t _height)
{
BX_UNUSED(_width, _height);
CAEAGLLayer* layer = (CAEAGLLayer*)g_bgfxEaglLayer;
layer.opaque = true;
@ -82,6 +83,7 @@ namespace bgfx
void GlContext::resize(uint32_t _width, uint32_t _height, bool _vsync)
{
BX_UNUSED(_width, _height, _vsync);
BX_TRACE("resize context");
}

View file

@ -13,7 +13,7 @@
namespace bgfx
{
# define GL_IMPORT(_optional, _proto, _func) _proto _func
# define GL_IMPORT(_optional, _proto, _func, _import) _proto _func
# include "glimports.h"
# undef GL_IMPORT
@ -21,6 +21,8 @@ namespace bgfx
void GlContext::create(uint32_t _width, uint32_t _height)
{
BX_UNUSED(_width, _height);
s_opengl = bx::dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL");
BX_CHECK(NULL != s_opengl, "OpenGL dynamic library is not found!");
@ -75,6 +77,7 @@ namespace bgfx
void GlContext::resize(uint32_t _width, uint32_t _height, bool _vsync)
{
BX_UNUSED(_width, _height, _vsync);
}
void GlContext::swap()
@ -86,10 +89,10 @@ namespace bgfx
void GlContext::import()
{
# define GL_IMPORT(_optional, _proto, _func) \
# define GL_IMPORT(_optional, _proto, _func, _import) \
{ \
_func = (_proto)bx::dlsym(s_opengl, #_func); \
BGFX_FATAL(_optional || NULL != _func, Fatal::UnableToInitialize, "Failed to create OpenGL context. NSGLGetProcAddress(\"%s\")", #_func); \
_func = (_proto)bx::dlsym(s_opengl, #_import); \
BGFX_FATAL(_optional || NULL != _func, Fatal::UnableToInitialize, "Failed to create OpenGL context. NSGLGetProcAddress(\"%s\")", #_import); \
}
# include "glimports.h"
# undef GL_IMPORT