Esempio n. 1
0
 FREObject initialize(FREContext ctx, void* funcData, uint32_t argc, FREObject argv[]) {
     std::cout << "[NATIVE initialize]" << std::endl;
     FRESetContextActionScriptData(ctx, argv[0]);
     
     myonative::MyoDevice* device = new myonative::MyoDevice(ctx);
     FRESetContextNativeData(ctx, (void*) device);
     
     return NULL;
 }
/**
 * Called when the extension context object is created. This function is
 * responsible for setting up the function map for ActionScript method names
 * to native functions.
 *
 * See also: ExtensionFunctions.m
 */
static void ContextInitializer(void* extensionData,
                               const uint8_t* contextType,
                               FREContext context,
                               uint32_t* numberOfNamedFunctionsOut,
                               const FRENamedFunction** namedFunctionsArrayOut)
{
    *numberOfNamedFunctionsOut = NAHB2D_createNamedFunctionsArray(namedFunctionsArrayOut);
    FREResult result = FRESetContextNativeData(context, new SessionContext());
    if (result != FRE_OK) 
    {
        DISPATCH_INTERNAL_ERROR(context, "Could not set context native data");
    }
}
Esempio n. 3
0
    void contextInitializer(void* extData, const uint8_t* ctxType, FREContext ctx, uint32_t* numFunctions, const FRENamedFunction** functions) {
        std::cout << "context initializer" << std::endl;
        if ( 0 == strcmp( (const char*) ctxType, "shared" ) )
		{
			*numFunctions = sizeof( _Shared_methods ) / sizeof( FRENamedFunction );
			*functions = _Shared_methods;
		}
		else
        {
            *numFunctions = sizeof( _Instance_methods ) / sizeof( FRENamedFunction );
            *functions = _Instance_methods;
            
            leapnative::LNLeapDevice* device = new leapnative::LNLeapDevice(ctx);
            FRESetContextNativeData(ctx, (void*) device);
        }
	}