Cocos2d + Storyboards, how can I get a working draft?

EDIT: Accept / Bounty is sent to anyone who can tell me how to make a project that:

  • Uses Cocos2d 2.x
  • There are storyboards
  • Has ARC
  • Bonus if you provided a download link to the template

The previous question became a mess, and I pretty much solved it myself. The Bounty is still ready to take over if someone wants to make a better version of my project.

HERE IS WORKING, CLEAN, READY TO USE A TEMPLATE FOR ANY USE, COMPLETE WITH ARC, COCOS2D 2.1, STANDARD AREAS AND ALL

Tested in Xcode 4, 5, iOS 6, 7, only on iPhone, but should also work on iPad.

I looked at it very hard when I was working on it, so I hope I help someone with it. The credit goes to Tiny Tim Games and https://stackoverflow.com> I slightly modified these files to work. Instructions for using noobs are inside the readme file! :)

+6
source share
3 answers

You did not specify any code to support your question, but from experience you could try using self.view.bounds instead of self.view.frame ?

Update

Create a property for your CCGLView in your view controller:

 @property (nonatomic) CCGLView *glView; 

Then create an instance as you already have, but save it to your resource.

 [self setGlView:[[CCGLView alloc] initWithFrame:[[self view] bounds]]; 

Then we implement viewWillLayoutSubviews and update the frame of your CCGLView to match.

 - (void)viewWillLayoutSubviews { [super viewWillLayoutSubviews]; [[self glView] setFrame:[[self view] bounds]]; } 
+1
source

I also struggled with this problem. This is how I created an iOS project (with ARC and demos) that uses the Cocos2d-iphone library.

  • create a new Xcode Cocos2d iOS project from a template
  • create a new Xcode iOS application project with one view
  • in Finder, locate the Cocos2d project folder created in step 1
  • Drag and drop the libs folder from the cocos2d project into one application project for viewing in Xcode (when prompted, select the "Copy files" option and be sure to mark the purpose of the project)

In an iOS app project with one view:

  • Go to Build Phases -> Compile Sources and select all files from ProjectName / libs / folder
  • Right click to add compiler flag
  • In the compiler flag box, -fno-objc-arc to disable ARC for these files (cocos2d lib files are written with all the necessary memory management code, so we donโ€™t need ARC).
  • Go to build settings 9 .. In Header Search Paths add: "libs/kazmath/include" (go to the project folder in Finder and double-check the path)
  • In Other Linker Flags add: -lz -ObjC
  • It remains only to add the necessary frameworks. Scroll to the Phase Assembling section and open Linking Binary Files to Libraries.
  • These libraries should be added (some may already be included):
    • AVFoundation.framework
    • AudioToolbox.framework
    • OpenAL.framework
    • QuartzCore.framework
    • OpenGLES.framework
    • UIKit.framework
    • Foundation.framework
    • CoreGraphics.framework
  • CMD + B to see if the project can build

Here is an example project: APPLICATION OF THE SOFTWARE .

+1
source

Source: https://habr.com/ru/post/951140/


All Articles