lae界面开发工具入门之介绍十二--<iOS系统如何编译打包?>

倾然丶 夕夏残阳落幕 提交于 2019-12-06 22:36:27

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真机,然后点击运行,大功告成!

运行如下

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!