LWFKit is a framework to using LWF on your Objective-C project powered by Ejecta.
- Add
LWFkit
into yourPodfile
pod install
- Import
LWFKit
directory into your project. - Add linked frameworks and libraries
OpenGLES.framework
,CoreText.framework
,CFNetwork.framework
,QuartzCore.framework
SystemConfiguration.framework
,libstdc++.dylib
,libicucore.dylib
,LWFKit/Externals/libJavaScriptCore.a
- Add files to Copy Bundle Resources
LWFKit/Externals/Ejecta/EJCanvas/2D/Shaders/*
LWFKit/Externals/Ejecta/Ejecta.js
LWFKit/Scripts
- Add
"$(SRCROOT)/LWFKit/Externals"
into Header Search Path
- (void)viewDidLoad
{
[super viewDidLoad];
LKView *lwf = [[LKView alloc] initWithFrame:CGRectMake(0, 0, 100, 80)];
[lwf load:@"example.lwf" completed:^ {
NSLog(@"loaded");
}];
[self.view addSubView:lwf];
// load with data prefix
[lwf load:@"example.lwf" prefix:@"data/example.lwfdata" completed:^ {
NSLog(@"loaded");
}];
}
// Go to jump frame
[lwf gotoAndPlayWithFrameLabel:@"jump"];
// Go to frame of 10
[lwf gotoAndPlayWithFrameLabel:10];
// Stop timeline
[lwf stop];
You can receive notify from flash event by fscommand
.
// Notify from fscommand('event', 'foo');
[lwf addEventHandler:@"foo", handler:^{
NSLog(@"foo fired").
}];
MIT License