|
|
|
@@ -97,7 +97,7 @@ public: |
|
|
|
#define JUCE_MAIN_FUNCTION_ARGS
|
|
|
|
#else
|
|
|
|
#define JUCE_MAIN_FUNCTION int main (int argc, char* argv[])
|
|
|
|
#define JUCE_MAIN_FUNCTION_ARGS argc, (const char**) argv
|
|
|
|
#define JUCE_MAIN_FUNCTION_ARGS argc, (const char**) argv, nullptr
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define START_JUCE_APPLICATION(AppClass) \
|
|
|
|
@@ -107,6 +107,56 @@ public: |
|
|
|
juce::JUCEApplicationBase::createInstance = &juce_CreateApplication; \
|
|
|
|
return juce::JUCEApplicationBase::main (JUCE_MAIN_FUNCTION_ARGS); \
|
|
|
|
}
|
|
|
|
|
|
|
|
#if JUCE_IOS
|
|
|
|
/**
|
|
|
|
You can instruct JUCE to use a custom iOS app delegate class instaed of JUCE's default
|
|
|
|
app delegate. For JUCE to work you must pass all messages to JUCE's internal app delegate.
|
|
|
|
Below is an example of minimal forwarding custom delegate. Note that you are at your own
|
|
|
|
risk if you decide to use your own delegate an subtle, hard to debug bugs may occur.
|
|
|
|
|
|
|
|
@interface MyCustomDelegate : NSObject <UIApplicationDelegate> { NSObject<UIApplicationDelegate>* juceDelegate; } @end
|
|
|
|
@implementation MyCustomDelegate
|
|
|
|
-(id) init
|
|
|
|
{
|
|
|
|
self = [super init];
|
|
|
|
juceDelegate = reinterpret_cast<NSObject<UIApplicationDelegate>*> ([[NSClassFromString (@"JuceAppStartupDelegate") alloc] init]);
|
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
-(void)dealloc
|
|
|
|
{
|
|
|
|
[juceDelegate release];
|
|
|
|
[super dealloc];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)forwardInvocation:(NSInvocation *)anInvocation
|
|
|
|
{
|
|
|
|
if (juceDelegate != nullptr && [juceDelegate respondsToSelector:[anInvocation selector]])
|
|
|
|
[anInvocation invokeWithTarget:juceDelegate];
|
|
|
|
else
|
|
|
|
[super forwardInvocation:anInvocation];
|
|
|
|
}
|
|
|
|
|
|
|
|
-(BOOL)respondsToSelector:(SEL)aSelector
|
|
|
|
{
|
|
|
|
if (juceDelegate != nullptr && [juceDelegate respondsToSelector:aSelector])
|
|
|
|
return YES;
|
|
|
|
|
|
|
|
return [super respondsToSelector:aSelector];
|
|
|
|
}
|
|
|
|
@end
|
|
|
|
*/
|
|
|
|
#define START_JUCE_APPLICATION_WITH_CUSTOM_DELEGATE(AppClass, DelegateClass) \
|
|
|
|
static juce::JUCEApplicationBase* juce_CreateApplication() { return new AppClass(); } \
|
|
|
|
extern "C" JUCE_MAIN_FUNCTION \
|
|
|
|
{ \
|
|
|
|
juce::JUCEApplicationBase::createInstance = &juce_CreateApplication; \
|
|
|
|
return juce::JUCEApplicationBase::main (argc, (const char**) argv, [DelegateClass class]); \
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif // JUCE_INITIALISATION_H_INCLUDED
|