cocos2d-iphone

Spritebuilder project with wrong node positions in xcode 6

杀马特。学长 韩版系。学妹 提交于 2019-12-12 23:52:50
问题 I've been using spritebuilder to play around with a few design ideas. I recently upgraded xcode to xcode 6 and my node positions have ended up being a bit screwy. I was wondering if anyone else is having these issues. What I get on spritebuilder vs how it ends up looking like on ios simulator Deploying to an actual ios device with ios 7 works correctly. 回答1: I managed to find a solution to the problem. unchecking all deivce orientations and checking protrait in xcode resolved it. I think

SpriteBuilder image file not found

[亡魂溺海] 提交于 2019-12-12 17:02:54
问题 I have added a .png image in sprit builder resource folder and I have published it. I see the added image in sprite builder all folder in Resources under Published-IOS. Here I have tried to access the added image in following ways. _hero.spriteFrame = [CCSpriteFrame frameWithImageNamed:@"Down.png"]; [_hero setTexture:[CCTexture textureWithFile:@"Game/Down.png"]] But none of these methods are working. it show error in log as. -[CCFileUtils fullPathForFilename:contentScale:] : cocos2d: Warning:

Xcode 3.2: Build & Analyze never finds any issues

我只是一个虾纸丫 提交于 2019-12-12 17:02:22
问题 I've used the Clang Static Analyzer from the command line before. I wanted to try Xcode's built-in version via Build & Analyze. I never get any negative results even though i specially prepared my code with very obvious issues Clang was always able to point out: // over-releasing an object: [label release]; [label release]; // uninitialized vars, allocating but not freeing an object NSString* str; int number; CCLabel* newLabel = [[CCLabel alloc] initWithString:str fontName:str fontSize:number

When we should use pushScene and replaceScene?

大兔子大兔子 提交于 2019-12-12 16:26:15
问题 I cocos2d, I am using pushScene and replaceScene to move to next scene. But, I am confused which we should use? When I am using replaceScene in some places app is crashing and giving errors like -[UITextView length]: unrecognized selector sent to instance 0x842a750 Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UITextView length]: unrecognized selector sent to instance 0x842a750' But, in my program I am not passing length to UITextView. My program is in

How to Optimize mach_msg_trap

烂漫一生 提交于 2019-12-12 16:18:41
问题 I know this question has been asked before, but no one has given any helpful answers as to how to fix it. I have a cocos2d ios application that uses the box2d physics engine. I ran a performance test on it and the cpu spends 5.6% of its time on mach_msg_trap. From what I have gathered from other questions, it seems as if mach_msg_trap is just the main thread waisting time as a result of your application being idle. My application isn't idle though. It has shaky performance and hovers in the

updating to ARC errors

让人想犯罪 __ 提交于 2019-12-12 16:09:51
问题 I am trying to update a project to ARC. Though I've seen a few posts on updating to ARC, none of the posts I've seen handle this specific issue. I've got multiple errors, most saying: ARC Issue Pointer to non-const type 'id' with no explicit ownership pointing to line CCARRAY_FOREACH(children_, item) in the CCMenu.m class. Please help. Updated: After restarting Xcode the above issue is no longer found at CCARRAY_FOREACH(children_, item) but was found in the ccCArray.h class at the lines I've

Adding a cocos2d view to a UIView

点点圈 提交于 2019-12-12 15:45:00
问题 I have integrated cocos2d 2.0 into an existing iOS project and would like to be able to create a view and add it to an existing view as a subview. Where should the cocos2d setup code be placed and how is the cocos2d view then made visible inside the UIView? I have followed Ray Wenderlichs tutorial and it doesn't help with the specific issue. A lot of the code is deprecated as well. Is it possible to do the cocos2d setup inside the cocos2d class I create? Im not sure on how to connect the

Leaderboard doesn't add in the screen cocos2d

柔情痞子 提交于 2019-12-12 15:04:30
问题 I used the code below to show the Leaderboard but all i got it the console this cocos2d: surface size: 480x320 the code: - (void)showLeaderboardForCategory:(NSString *)category { // Only execute if OS supports Game Center & player is logged in if (hasGameCenter) { // Create leaderboard view w/ default Game Center style GKLeaderboardViewController *leaderboardController = [[GKLeaderboardViewController alloc] init]; // If view controller was successfully created... if (leaderboardController !=

Understanding applicationSignificantTimeChange:

拜拜、爱过 提交于 2019-12-12 14:08:08
问题 I find that sometimes my application (Cocos2d game) beheaves in a "buggy" way after a significant time change. For example: case 1: when the application enters the background and, after several minutes, I restart it, I can see the loading image and then the application/game resumes. case 2: when the application enters the background and after a significant time change the application sometimes restarts, sometimes not. It is still unclear to me why. Looking at the AppDelegate methods I found:

setting proper cocos2d orientation

久未见 提交于 2019-12-12 13:38:03
问题 In my cocos2d application, inside the applicationDidFinishLaunching method for my app delegate, I set the orientation via [director setDeviceOrientation:kCCDeviceOrientationPortrait] because I really only want portrait. However, Apple rejected my app saying it must support upside down portrait as well. I'm not certain how I detect this, though. Reading the currentDevice orientation seems to return an unknown orientation, so my questions are twofold: 1) How am I supposed to detect the