diff --git a/project/ToolkitBuild.xml b/project/ToolkitBuild.xml index 48116b299..61960f8c2 100644 --- a/project/ToolkitBuild.xml +++ b/project/ToolkitBuild.xml @@ -1,6 +1,6 @@ - + @@ -23,6 +23,7 @@ + diff --git a/project/include/Hardware.h b/project/include/Hardware.h index 6f94d4704..60ba3f560 100644 --- a/project/include/Hardware.h +++ b/project/include/Hardware.h @@ -7,6 +7,7 @@ #define NME_FLOAT32_VERT_VALUES #endif + namespace nme { @@ -141,7 +142,11 @@ class HardwareRenderer : public HardwareContext static HardwareRenderer *current; + #ifndef IPHONE static HardwareRenderer *CreateMetal(void *inMetalLayer); + #endif + static HardwareRenderer *CreateMetalNull(); + static HardwareRenderer *CreateOpenGL(void *inWindow, void *inGLCtx, bool shaders); static HardwareRenderer *CreateDX11(void *inDevice, void *inContext); diff --git a/project/src/common/ManagedStage.cpp b/project/src/common/ManagedStage.cpp index 17aec1542..81ba23801 100644 --- a/project/src/common/ManagedStage.cpp +++ b/project/src/common/ManagedStage.cpp @@ -31,13 +31,15 @@ ManagedStage::ManagedStage(int inWidth,int inHeight,int inFlags) if (nmeOpenglRenderer) mHardwareRenderer = HardwareRenderer::CreateOpenGL(0, 0, inFlags & wfAllowShaders); else + { // TODO? - mHardwareRenderer = HardwareRenderer::CreateMetal(0); + mHardwareRenderer = HardwareRenderer::CreateMetalNull(); + } #elif defined(NME_OGL) mHardwareRenderer = HardwareRenderer::CreateOpenGL(0, 0, inFlags & wfAllowShaders); #elif defined(NME_METAL) // TODO? - mHardwareRenderer = HardwareRenderer::CreateMetal(0); + mHardwareRenderer = HardwareRenderer::CreateMetalNull(); #else #error "No valid HardwareRenderer" #endif diff --git a/project/src/metal/MetalContext.mm b/project/src/metal/MetalContext.mm index fbbbf9637..13e04f85c 100644 --- a/project/src/metal/MetalContext.mm +++ b/project/src/metal/MetalContext.mm @@ -971,7 +971,20 @@ void BeginDirectRender(const Rect &inRect) { } void EndDirectRender() { } }; +HardwareRenderer *HardwareRenderer::CreateMetalNull() +{ + HardwareRenderer *ctx = new MetalContext( nullptr ); + return ctx; +} +#ifdef IPHONE +HardwareRenderer *HardwareRendererCreateMetal(CAMetalLayer *metalLayer) +{ + HardwareRenderer *ctx = new MetalContext( metalLayer ); + + return ctx; +} +#else HardwareRenderer *HardwareRenderer::CreateMetal(void *inRenderer) { SDL_Renderer *renderer = (SDL_Renderer *)renderer; @@ -986,6 +999,7 @@ void EndDirectRender() { } return ctx; } +#endif } // end namespace nme diff --git a/project/toolkit/jpeg/files.xml b/project/toolkit/jpeg/files.xml index 8b3afacbd..606546a37 100644 --- a/project/toolkit/jpeg/files.xml +++ b/project/toolkit/jpeg/files.xml @@ -5,7 +5,7 @@ - + diff --git a/project/toolkit/sdl-mixer/files.xml b/project/toolkit/sdl-mixer/files.xml index e8eacfc7a..fb5420d69 100644 --- a/project/toolkit/sdl-mixer/files.xml +++ b/project/toolkit/sdl-mixer/files.xml @@ -40,6 +40,7 @@ + diff --git a/templates/ios/UIStageView.mm b/templates/ios/UIStageView.mm index 6acebc69c..2f3159937 100644 --- a/templates/ios/UIStageView.mm +++ b/templates/ios/UIStageView.mm @@ -48,6 +48,12 @@ #define APP_LOG(x) { } #endif +#ifdef IPHONE +namespace nme +{ +HardwareRenderer *HardwareRendererCreateMetal(CAMetalLayer *metalLayer); +} +#endif #ifndef IPHONESIM CMMotionManager *sgCmManager = 0; @@ -171,7 +177,9 @@ - (void) mainLoop:(id) sender; UIView *container; UIView *playerView; NMEView *nmeView; + #ifdef NME_VIDEO class IOSVideo *video; + #endif bool popupEnabled; bool multiTouchEnabled; @@ -459,7 +467,7 @@ - (void) setupStageLayer:(NMEStage *)inStage self.enableSetNeedsDisplay = YES; - mHardwareRenderer = HardwareRenderer::CreateMetal(metalLayer); + mHardwareRenderer = HardwareRendererCreateMetal(metalLayer); mHardwareRenderer->IncRef(); mHardwareRenderer->SetWindowSize(backingSize.width, backingSize.height); @@ -1160,6 +1168,7 @@ - (void) dealloc @end // End NMEView +#ifdef NME_VIDEO class IOSVideo; @interface PlayerHandler : NSObject { @@ -1752,6 +1761,7 @@ -(void)removeMovieNotificationHandlers @end +#endif // NME_VIDEO double sgWakeUp = 0.0; @@ -1769,7 +1779,9 @@ -(void)removeMovieNotificationHandlers NMEStage::NMEStage(CGRect inRect) : nme::Stage(true) { APP_LOG(@"new NMEStage"); + #ifdef NME_VIDEO video = 0; + #endif //printf("New NMEStage\n"); sgNmeStage = this; @@ -1915,6 +1927,7 @@ -(void)removeMovieNotificationHandlers void NMEStage::onVideoPlay() { + #ifdef NME_VIDEO if (!playerView) { playerView = video->getPlayerView(); @@ -1925,10 +1938,12 @@ -(void)removeMovieNotificationHandlers if (wantOpaqueBg!=haveOpaqueBg) recreateNmeView(); } + #endif } StageVideo *NMEStage::createStageVideo(void *inOwner) { + #ifdef NME_VIDEO if (!video) { video = new IOSVideo(this,1.0/getDPIScale()); @@ -1936,6 +1951,9 @@ -(void)removeMovieNotificationHandlers } return video; + #else + return nullptr; + #endif } @@ -2008,11 +2026,13 @@ -(void)removeMovieNotificationHandlers int top = 0; gc_set_top_of_stack(&top,false); + #ifdef NME_VIDEO if (inEvt.type==etPoll && video) video->onPoll(); if ((inEvt.type==etActivate || inEvt.type==etDeactivate) && video) video->setActive(inEvt.type==etActivate); + #endif HandleEvent(inEvt); } diff --git a/tools/nme/src/project/NMEProject.hx b/tools/nme/src/project/NMEProject.hx index 50bab2219..f5c0d62c9 100644 --- a/tools/nme/src/project/NMEProject.hx +++ b/tools/nme/src/project/NMEProject.hx @@ -94,7 +94,7 @@ class IOSConfig public function new() { compiler = "clang"; - deployment = "9.0"; + deployment = "12.0"; deviceConfig = UNIVERSAL; linkerFlags = new Array(); viewTestDir = "";