banner



How To Make A Game In Xcode

My game engine is currently in beta phase. I have not released the engine to the public notwithstanding. Part of it is due to unresolved bugs nowadays in the engine. Although the engine tin handle a full blown game, such every bit a soccer game , I'm afraid that information technology is not ready for prime fourth dimension.

Regardless if I release the engine to the public or non, I am interested in knowing how I would create my engine into a distributable framework using Xcode. It turns out that creating a framework using Xcode is very simple.

These are the steps to create a framework in Xcode:

Creating a framework

Step 1:

Create a new projection and select "Cocoa Touch on Framework."

Step 2:

Give your framework a name and select "Objective-C" every bit the language. Make sure the "Include Unit Tests" box is unchecked.

Xcode will generate a header file with the proper noun of your framework. In this header file, nosotros will include the header files of your API. So allow'south create the API.

Footstep 3:

Create a file representing your API and requite it a name. I chosen the files "MyAPI."

Step four (Optional):

You don't have to do this if you code in Objective-C. Only I like to code in C++; thus I need to modify the extension of the files to ".mm" as shown in the image beneath.

Pace v:

Declare and implement your API files. In this example, I created a form with a "printHello" method.

Pace half dozen:

Your users will not exist able to use your framework unless y'all make the API header files Public. If you lot select the MyAPI header file and open Xcode Utility pane, you will find that under "Target Membership" the header file is ready to "Project."

Make sure to set up the header file to "Public."

Stride 7:

At present, we demand to import all the public header files of your API. To do so, open up upwards the framework header file "MyFirstFramework.h" and import all public header files of your API. See highlighted line in the epitome below:

Here is a larger epitome. See line 20.

Screen Shot 2017-05-20 at 12.10.54 PM.png

Step 8:

Select Product->Build to build the framework. You tin can too employ Command+B to build information technology.

At this bespeak, the framework is prepare to be distributed to your users.

Step 9:

If you need to locate your framework, correct-click on the framework and click "Testify in Finder." See the image below.

Screen Shot 2017-05-20 at 10.26.41 AM.png

Testing your Framework

Pace i:

Permit's test your framework in a new projection. Create a new "Single View Awarding" project in Xcode.

Step 2:

Give information technology a name and select "Objective-C" equally the linguistic communication.

Step 3:

Copy your framework into the new projection. To locate your framework, run into Step 9 above.

Step 4:

We demand to make certain that the new project has the proper settings earlier it can use the framework.

Click on Build Phases and make sure that your framework is in the Link Binary With Libraries section.

Step 5:

Click on General. You will observe that the Embedded Binaries section doesn't include the framework.

Add the framework in the Embedded Binaries section.

Step vi:

You will notice that the Linked Frameworks and Libraries section contains a duplicate re-create of the framework. Remove one of the copies.

Footstep vii (Optional):

Since I use C++ in the framework, I demand to change the extension of the AppDelegate and ViewController files to use the ".mm" extension.

Pace viii:

Now y'all are prepare to use the framework in the new projection. Import the framework equally shown in line 11 in the image beneath. You can at present call the API classes as shown in the "viewDidLoad" method in the image below.

Build and run the projection. And that is it.

Hope this helps.

Computer Graphics Enthusiast. Currently developing a 3D Game Engine.

Source: https://www.haroldserrano.com/blog/creating-a-framework-in-xcode

Posted by: gloverfign1969.blogspot.com

0 Response to "How To Make A Game In Xcode"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel