iPhone & iPad (preparing)

Folder construction of Live2D SDK: 

You need to make settings of the Live2D include file and the library (libLive2D.a) properly.

     ├Live2D_SDK_XXXX
         ├live2d_include        //A folder involves the include file
         ├lib                         //A folder involves the library
             ├libLive2D.a               //A library for the actual machine
             ├libLive2D_simulator.a  //A library for the simulator

Set the include:

You can set the include file using one of two methods as below;

      【Method 1】
This method is to register the live2d_include by dragging and dropping to the project.
*A include file is encoded by Shift-JIS. You can prevent the character from misconversion by selecting Shift-JIS when dragging and dropping .
 
      【Method 2】
This method is to register it with the path (relative path or absolute path) to live2d_include in "header search path" for the setting of each target in the project.


Set the library:

Register libLive2D.a (for the actual machine) or libLive2D_simulator.a(for the simulator) as a project. Drag and drop it to XCode, it will be registered as a project file as well as registered "Link Binary with Libraries" in each target.
A warning will appear if you try to register two of for the actual machine and for the simulator for one target, however the build will be made.
*If you want to make above successfully without a warning, you need to create two types of target - one for actual machine and one for simulator, and register libLive2D.a for the actual machine and libLive2D_simulator.a for the simulator target.

Add a framework:

CoreGraphics.framework
Add above framework, since the function of CoreGraphics.framework is usually used to load the Texture.

 OpenGLES.framework 
 QuartzCore.framework
Add above frameworks when you embed Live2D to the project which does not use OpenGL.

Test:

When the build is completed, you need to test for calling.
As the library of Live2D is written by C++, the filename extension should be ".cpp" (an extension for C++) or ".mm" (an extension which can be mixed Objective-C and C++) to use it with iPhone. 

When referring Live2D-related C++ classes from the header, all files which import (or include) the file should have ".mm", not ".m" for the extension. If the extension is ".m", errors like followings may occur;


        Compile SomeClass.m ... 
        Expected '=', ',', ';', 'asm' or '__attribute__' before 'XXXXXX'

In this case, the error will disappear if you change the SomeClass extension to ".mm".

If you invoke it from EAGLView.m, change the extension to "EAGLView.mm". 

(Objective-C will operate without any problem after changing to ".mm".)

Describe to add #import"Live2D.h" for the upper of EAGLView.mm, and to invoke Live2D::init() for the initialized part (like initWithCoder) .


If the build is not completed, check the settings of the include file and the library.

If the build ic completed and executed, "Live2D version XXX" will be displayed on the console.


Tutorial of the simple version SDK sample:

The simple version SDK sample is a SDK which is consisted with the basic elements to move Live2D on iPhone or iPad.
Refer to the following pages about the element which is dependent to iOS.