Skip to content

Lightweight SWF framework for your Objective-C project with Ejecta

License

Notifications You must be signed in to change notification settings

yonekawa/lwfkit.objc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LWFKit

LWFKit is a framework to using LWF on your Objective-C project powered by Ejecta.

Setup

CocoaPods

  1. Add LWFkit into your Podfile
  2. pod install

Manually

  1. Import LWFKit directory into your project.
  2. Add linked frameworks and libraries
    OpenGLES.framework, CoreText.framework, CFNetwork.framework, QuartzCore.framework SystemConfiguration.framework, libstdc++.dylib, libicucore.dylib, LWFKit/Externals/libJavaScriptCore.a
  3. Add files to Copy Bundle Resources
    LWFKit/Externals/Ejecta/EJCanvas/2D/Shaders/* LWFKit/Externals/Ejecta/Ejecta.js LWFKit/Scripts
  4. Add "$(SRCROOT)/LWFKit/Externals" into Header Search Path

How to Use

Initialize

- (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");
    }];
}

Timeline Control

// Go to jump frame
[lwf gotoAndPlayWithFrameLabel:@"jump"];

// Go to frame of 10
[lwf gotoAndPlayWithFrameLabel:10];

// Stop timeline
[lwf stop];

Event Handling

You can receive notify from flash event by fscommand.

// Notify from fscommand('event', 'foo');
[lwf addEventHandler:@"foo", handler:^{
    NSLog(@"foo fired").
}];

License

MIT License

References

LWF
Ejecta

About

Lightweight SWF framework for your Objective-C project with Ejecta

Resources

License

Stars

Watchers

Forks

Packages

No packages published