lae界面開發工具入門之介紹十二--<iOS系統如何編譯打包?> 原

lae sdk相關文件放在lae目錄下, 已經下載過的同學,請更新一下。

laetool 下載地址:https://github.com/ouloba/laetool.git

 

1、建立新的工程.

2、起個產品名字.

3、把AppDelegate.m修改爲AppDelegate.mm, 

4、修改頭文件如下

//
//  AppDelegate.h
//  LaeApp
//
//  Created by 廖錫州 on 16/7/27.
//  Copyright  2016年 廖錫州. All rights reserved.
//

#import <UIKit/UIKit.h>

@class EAGLView;
@class ViewController;

@interface AppDelegate : UIResponder <UIAccelerometerDelegate, UIAlertViewDelegate, UITextFieldDelegate,UIApplicationDelegate>{
    UIWindow *window;
    EAGLView *eaglView;
    ViewController    *viewController;
}

@property (strong, nonatomic) UIWindow *window;


@end

5、修改源文件AppDelage.mm代碼如下 

//
//  AppDelegate.m
//  LaeApp
//
//  Created by 廖錫州 on 16/7/27.
//  Copyright  2016年 廖錫州. All rights reserved.
//

#import "AppDelegate.h"
#import <lae/EAGLView.h>
#import "ViewController.h"

@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    // Add the view controller's view to the window and display.
    window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]];
    
    CGRect frame = [[UIScreen mainScreen] bounds];
    // CGFloat scale_screen = [UIScreen mainScreen].scale;
    // frame.size.height = frame.size.height*scale_screen;
    // frame.size.width  = frame.size.width*scale_screen;
    
    eaglView = [EAGLView initWithFrame: frame];
    
    // Use RootViewController manage CCEAGLView
    viewController = [[ViewController alloc] initWithNibName:nil bundle:nil];
    viewController.wantsFullScreenLayout = YES;
    viewController.view = eaglView;
    
    //
    // [window addSubview: viewController.view];
    // [window setRootViewController:viewController];
    
    // Set RootViewController to window
    if ( [[UIDevice currentDevice].systemVersion floatValue] < 6.0)
    {
        // warning: addSubView doesn't work on iOS6
        [window addSubview: viewController.view];
    }
    else
    {
        // use this method on ios6
        [window setRootViewController:viewController];
    }
    
    [window makeKeyAndVisible];
    
    [[UIApplication sharedApplication] setStatusBarHidden: YES];
    
    // IMPORTANT: Setting the GLView should be done after creating the RootViewController
    //cocos2d::GLViewImpl *glview = cocos2d::GLViewImpl::createWithEAGLView(eaglView);
    //cocos2d::Director::getInstance()->setOpenGLView(glview);
    
    //app->run();
    eaglView.animationInterval = 1.0 / 60.0;
    [eaglView startAnimation];
    return YES;
}

- (void)applicationWillResignActive:(UIApplication *)application {
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

- (void)applicationDidEnterBackground:(UIApplication *)application {
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
    ICGuiPause();
    ICGuiDestroy();
}

- (void)applicationWillEnterForeground:(UIApplication *)application {
    // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
     ICGuiResume();
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
    [EAGLView sharedInstance].animationInterval = 1.0 / 60.0;
    ICGuiResume();
}

- (void)applicationWillTerminate:(UIApplication *)application {
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

@end

6、刪除Main.storyboard,同時刪除info.plist中相關設置(點擊如下圖中的減號)。

7、修改Bitcode設置,設置爲No.

8、添加相關framework和靜態庫。

9、添加項目資源文件.如2048遊戲資源包,同時加入字體文件

 

目前SDK不支持simulator,所以需要真機調試。萬事俱備只欠東風,選擇iPhone真機,然後點擊運行,大功告成!

運行如下

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章