mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2025-02-17 20:31:57 -05:00
OSX/iOS: Updated to Xcode5.
This commit is contained in:
parent
4970c175c7
commit
dee588dfba
6 changed files with 28 additions and 16 deletions
|
@ -42,7 +42,7 @@ static const char* tokenizeCommandLine(const char* _commandLine, char* _buffer,
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case SkipWhitespace:
|
case SkipWhitespace:
|
||||||
for (; isspace(*curr); ++curr); // skip whitespace
|
for (; isspace(*curr); ++curr) {}; // skip whitespace
|
||||||
state = SetTerm;
|
state = SetTerm;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ static const char* tokenizeCommandLine(const char* _commandLine, char* _buffer,
|
||||||
case Escape:
|
case Escape:
|
||||||
{
|
{
|
||||||
const char* start = --curr;
|
const char* start = --curr;
|
||||||
for (; '\\' == *curr; ++curr);
|
for (; '\\' == *curr; ++curr) {};
|
||||||
|
|
||||||
if ('"' != *curr)
|
if ('"' != *curr)
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,11 +16,6 @@
|
||||||
#include <bx/uint32_t.h>
|
#include <bx/uint32_t.h>
|
||||||
#include <bx/thread.h>
|
#include <bx/thread.h>
|
||||||
|
|
||||||
namespace bgfx
|
|
||||||
{
|
|
||||||
void renderFrame();
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace entry
|
namespace entry
|
||||||
{
|
{
|
||||||
struct MainThreadEntry
|
struct MainThreadEntry
|
||||||
|
@ -76,6 +71,7 @@ namespace entry
|
||||||
|
|
||||||
void setWindowSize(uint32_t _width, uint32_t _height)
|
void setWindowSize(uint32_t _width, uint32_t _height)
|
||||||
{
|
{
|
||||||
|
BX_UNUSED(_width, _height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void toggleWindowFrame()
|
void toggleWindowFrame()
|
||||||
|
@ -84,6 +80,7 @@ namespace entry
|
||||||
|
|
||||||
void setMouseLock(bool _lock)
|
void setMouseLock(bool _lock)
|
||||||
{
|
{
|
||||||
|
BX_UNUSED(_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace entry
|
} // namespace entry
|
||||||
|
@ -124,8 +121,8 @@ using namespace entry;
|
||||||
if (nil == m_displayLink)
|
if (nil == m_displayLink)
|
||||||
{
|
{
|
||||||
m_displayLink = [self.window.screen displayLinkWithTarget:self selector:@selector(renderFrame)];
|
m_displayLink = [self.window.screen displayLinkWithTarget:self selector:@selector(renderFrame)];
|
||||||
[m_displayLink setFrameInterval:1];
|
//[m_displayLink setFrameInterval:1];
|
||||||
[m_displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
|
//[m_displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,6 +160,8 @@ using namespace entry;
|
||||||
|
|
||||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
||||||
{
|
{
|
||||||
|
BX_UNUSED(application, launchOptions);
|
||||||
|
|
||||||
CGRect rect = [ [UIScreen mainScreen] bounds];
|
CGRect rect = [ [UIScreen mainScreen] bounds];
|
||||||
m_window = [ [UIWindow alloc] initWithFrame: rect];
|
m_window = [ [UIWindow alloc] initWithFrame: rect];
|
||||||
m_view = [ [View alloc] initWithFrame: rect];
|
m_view = [ [View alloc] initWithFrame: rect];
|
||||||
|
@ -176,24 +175,29 @@ using namespace entry;
|
||||||
|
|
||||||
- (void)applicationWillResignActive:(UIApplication *)application
|
- (void)applicationWillResignActive:(UIApplication *)application
|
||||||
{
|
{
|
||||||
|
BX_UNUSED(application);
|
||||||
[m_view stop];
|
[m_view stop];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)applicationDidEnterBackground:(UIApplication *)application
|
- (void)applicationDidEnterBackground:(UIApplication *)application
|
||||||
{
|
{
|
||||||
|
BX_UNUSED(application);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)applicationWillEnterForeground:(UIApplication *)application
|
- (void)applicationWillEnterForeground:(UIApplication *)application
|
||||||
{
|
{
|
||||||
|
BX_UNUSED(application);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)applicationDidBecomeActive:(UIApplication *)application
|
- (void)applicationDidBecomeActive:(UIApplication *)application
|
||||||
{
|
{
|
||||||
|
BX_UNUSED(application);
|
||||||
[m_view start];
|
[m_view start];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)applicationWillTerminate:(UIApplication *)application
|
- (void)applicationWillTerminate:(UIApplication *)application
|
||||||
{
|
{
|
||||||
|
BX_UNUSED(application);
|
||||||
[m_view stop];
|
[m_view stop];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,7 @@
|
||||||
|
|
||||||
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
|
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
|
||||||
{
|
{
|
||||||
|
BX_UNUSED(sender);
|
||||||
self->terminated = true;
|
self->terminated = true;
|
||||||
return NSTerminateCancel;
|
return NSTerminateCancel;
|
||||||
}
|
}
|
||||||
|
@ -246,13 +247,13 @@ namespace entry
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
while (DispatchEvent(PeekEvent() ) );
|
while (DispatchEvent(PeekEvent() ) ) {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
m_eventQueue.postExitEvent();
|
m_eventQueue.postExitEvent();
|
||||||
|
|
||||||
while (bgfx::RenderFrame::NoContext != bgfx::renderFrame() );
|
while (bgfx::RenderFrame::NoContext != bgfx::renderFrame() ) {};
|
||||||
thread.shutdown();
|
thread.shutdown();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -277,6 +278,7 @@ namespace entry
|
||||||
|
|
||||||
void setWindowSize(uint32_t _width, uint32_t _height)
|
void setWindowSize(uint32_t _width, uint32_t _height)
|
||||||
{
|
{
|
||||||
|
BX_UNUSED(_width, _height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void toggleWindowFrame()
|
void toggleWindowFrame()
|
||||||
|
@ -285,6 +287,7 @@ namespace entry
|
||||||
|
|
||||||
void setMouseLock(bool _lock)
|
void setMouseLock(bool _lock)
|
||||||
{
|
{
|
||||||
|
BX_UNUSED(_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace entry
|
} // namespace entry
|
||||||
|
|
|
@ -1570,7 +1570,7 @@ namespace bgfx
|
||||||
{
|
{
|
||||||
BX_TRACE("render thread start");
|
BX_TRACE("render thread start");
|
||||||
Context* ctx = (Context*)_userData;
|
Context* ctx = (Context*)_userData;
|
||||||
while (!ctx->renderFrame() );
|
while (!ctx->renderFrame() ) {};
|
||||||
BX_TRACE("render thread exit");
|
BX_TRACE("render thread exit");
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ namespace bgfx
|
||||||
{
|
{
|
||||||
void GlContext::create(uint32_t _width, uint32_t _height)
|
void GlContext::create(uint32_t _width, uint32_t _height)
|
||||||
{
|
{
|
||||||
|
BX_UNUSED(_width, _height);
|
||||||
CAEAGLLayer* layer = (CAEAGLLayer*)g_bgfxEaglLayer;
|
CAEAGLLayer* layer = (CAEAGLLayer*)g_bgfxEaglLayer;
|
||||||
layer.opaque = true;
|
layer.opaque = true;
|
||||||
|
|
||||||
|
@ -82,6 +83,7 @@ namespace bgfx
|
||||||
|
|
||||||
void GlContext::resize(uint32_t _width, uint32_t _height, bool _vsync)
|
void GlContext::resize(uint32_t _width, uint32_t _height, bool _vsync)
|
||||||
{
|
{
|
||||||
|
BX_UNUSED(_width, _height, _vsync);
|
||||||
BX_TRACE("resize context");
|
BX_TRACE("resize context");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
namespace bgfx
|
namespace bgfx
|
||||||
{
|
{
|
||||||
|
|
||||||
# define GL_IMPORT(_optional, _proto, _func) _proto _func
|
# define GL_IMPORT(_optional, _proto, _func, _import) _proto _func
|
||||||
# include "glimports.h"
|
# include "glimports.h"
|
||||||
# undef GL_IMPORT
|
# undef GL_IMPORT
|
||||||
|
|
||||||
|
@ -21,6 +21,8 @@ namespace bgfx
|
||||||
|
|
||||||
void GlContext::create(uint32_t _width, uint32_t _height)
|
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");
|
s_opengl = bx::dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL");
|
||||||
BX_CHECK(NULL != s_opengl, "OpenGL dynamic library is not found!");
|
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)
|
void GlContext::resize(uint32_t _width, uint32_t _height, bool _vsync)
|
||||||
{
|
{
|
||||||
|
BX_UNUSED(_width, _height, _vsync);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GlContext::swap()
|
void GlContext::swap()
|
||||||
|
@ -86,10 +89,10 @@ namespace bgfx
|
||||||
|
|
||||||
void GlContext::import()
|
void GlContext::import()
|
||||||
{
|
{
|
||||||
# define GL_IMPORT(_optional, _proto, _func) \
|
# define GL_IMPORT(_optional, _proto, _func, _import) \
|
||||||
{ \
|
{ \
|
||||||
_func = (_proto)bx::dlsym(s_opengl, #_func); \
|
_func = (_proto)bx::dlsym(s_opengl, #_import); \
|
||||||
BGFX_FATAL(_optional || NULL != _func, Fatal::UnableToInitialize, "Failed to create OpenGL context. NSGLGetProcAddress(\"%s\")", #_func); \
|
BGFX_FATAL(_optional || NULL != _func, Fatal::UnableToInitialize, "Failed to create OpenGL context. NSGLGetProcAddress(\"%s\")", #_import); \
|
||||||
}
|
}
|
||||||
# include "glimports.h"
|
# include "glimports.h"
|
||||||
# undef GL_IMPORT
|
# undef GL_IMPORT
|
||||||
|
|
Loading…
Reference in a new issue