I was making a game, ran it many times and it worked just perfect.Once this issue appeared, I can't even understand what was the reason.Missing any files? Cocos2d-iphone 3.3 + SpriteBuilder + Chipmunk
/Source/libs/cocos2d-iphone/external/Chipmunk/xcode/build/Chipmunk7.build/Debug-iphoneos/ChipmunkStatic-iPhone.build/Objects-normal/armv7/cpSpace.d:1: expected predicate and/or actions following probe description
Related
I'm making a mobile game with SDL2 which will be initially developed for IOS.
I have almost finnished the game development, and now, in order to integrate it with Firebase, I need a pointer to UIViewController.
After reading countless topics, I tried this:
SDL_SysWMinfo systemWindowInfo;
SDL_VERSION (& systemWindowInfo.version);
SDL_GetWindowWMInfo (sdlWindow, & systemWindowInfo))
UIWindow * appWindow = mainWindowWMInfo.info.uikit.window;
UIViewController * rootViewController = appWindow.rootViewController;
But the line "UIViewController * rootViewController = appWindow.rootViewController;" causes this error: "Incomplete definition of type '_UIWindow'"
All topics related to this sample code are at least four years old, and I'm trying hard, but I haven't found any topics talking recently about how to get UIViewController in an SDL2 / ios project.
So, my questions are:
Is the sample code above still working in the current versions of SDL2 or has something changed in the latest version and this sample code no longer works?
If the sample code still works, what can I do wrong to cause this “Incomplete definition of type '_UIWindow'” error?
If this sample code no longer works in SDL2, how can I get a UIViewController pointer in the current version of SDL2?
Any help is welcome because I have been stuck in this problem for days. I've been working on this game for ten months and solving this problem is the last task left to complete it , so I really need to solve this issue.
I solve this problem. Everything is OK in SDL, I was using a .cpp file in this code, but I needed to use .mm file here.
So, when I switched the file name from cpp to mm, the problem has solved.
I am trying to load particle effects (in .plist format) in my Cocos2d-x game code, and I am facing the warning: "libpng warning: iCCP: known incorrect sRGB profile", as mentioned in the question. I have done some research on my end, and the other StackOverflow users who asked similar questions had this issue while loading .png files.
However, I am facing the same issue while initializing .plist files instead. Any insight on how to remove this warning would be helpful. Kindly note that I am not facing any issue with loading the .plist file as such, but the warnings are polluting my log streams.
Sample code:
ParticleSystem* testStar = testNode->getChildByName<ParticleSystem*>("star");
testStar->initWithFile(filePath + "/" + "test.plist"); //valid filePath
testStar->setVisible(true);
Also, to confirm that this isn't an issue with the .plist file itself, I tried loading the file manually on my UI editor tool, and that seemed to load it without any issues.
I am ready to provide more details on my environment if necessary. I tried doing the above in a blank project as well, and I was able to reproduce the same warning.
Cocos2d-x version: cocos2d-x-3.14.1
I was able to solve this by using a sub-class of ParticleSystem instead of ParticleSystem itself. The sub-class I used is ParticleSystemQuad. Additionally, I realized that the initWithFile API was being called multiple times in my code, due to Cocos2D update schedulers. That may have been a cause for this warning.
To fix this warning, I created a fresh variable/system, and assigned a parent to it, while setting the position of the new variable to that of a well-known (desired position) node.
/* Getting the desired particleEffect position */
const Vec2& desiredPos = testNode->getChildByName("blablablah")->getPosition();
std::string filePath = "/"; //assign a directory for the .plist
// Avoid exponentiation
if (!testNode->getChildByName("sampleParticle")) {
auto p1 = ParticleSystemQuad::create(filePath + "/" + "test.plist");
p1->setPosition(desiredPos);
p1->resetSystem();
p1->setName("sampleParticle");
p1->setVisible(true);
testNode->addChild(p1);
}
Code:
var bg = CCSprite(imageNamed:"Background.png")
Images used in Resource:
Background-hd.png
Background-ipad.png
Background-ipadhd.png
Background-iphone5hd.png
Background.png
In all device Background.png(320x480) used, other images are ignored. How to fix this ?
Retina display is not enabled...How to enable retina display in v3 ?
Here is working sample code with this problem.
I'm not really advanced user of SpriteBuilder but have some concerns about your issue.
As you are using Sprite Builder for starting the project, it configures your CCFileUtils to distinguish different devices' resources by looking at folders, not prefixes. In your app delegate you can see this line:
[CCBReader configureCCFileUtils];
going into this method you can see that search mode for file utils is set to CCFileUtilsSearchModeDirectory
sharedFileUtils.searchMode = CCFileUtilsSearchModeDirectory;
So you need to use Publish folders and copy your Background image to each of them with the same name (Background.png), but with different resolution for each device.
You don't need to use image suffixes in SpriteBuilder at all.
Finally Updated Cocos2d and now -hd,-ipad files are used. Just updated one line
sharedFileUtils.searchMode = CCFileUtilsSearchModeSuffix
For some reason my UIButtons aren't appearing in my ruby motion apps. Only the button text appears.
Here's the code:
#containerView = UIView.alloc.initWithFrame([[0, 50], [self.view.frame.size.width, 100]])
#loginButton = UIButton.buttonWithType(UIButtonTypeRoundedRect)
#loginButton.frame = [[(self.view.frame.size.width / 2) + 5, 65], [(self.view.frame.size.width / 2) - 15, 40]]
#loginButton.setTitle('Login', forState: UIControlStateNormal)
#loginButton.addTarget(self,
action:'login',
forControlEvents:UIControlEventTouchUpInside)
#containerView.addSubview(#loginButton)
self.view.addSubview(#containerView)
I'm using RubyMotion v2.16, Promotion 1.0.4, sugarcube 1.3.5, motion layout 0.0.1 and bubblewrap 1.4.0
I've tried to render the buttons using the promotion way, the sugarcube way and the bubblewrap way but decided to break it down to the raw rubymotion way (above) for troubleshooting in a regular view controller. Any ideas on this one?
Well, if anyone else is reading outdated documentation also, it turns out that UIButtonTypeRoundedRect has been deprecated in iOS7.
https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/TransitionGuide/Controls.html#//apple_ref/doc/uid/TP40013174-CH9-SW1
Looked in the CCMenu.h and it looks like it responds to the exact method Xcode (4.5.2) is saying it doesn't respond to. I've tried overriding the method and extending CCMenu, but it always throws the same message.
When I build and run my project, it seems to work fine. Should I ignore this warning and continue with my game? Another question: Is there a simple way to 'update' this code to a non-deprecated or outdated method? Here's the cocos2d-iphone-extensions version I'm using. Also, it's cocos2d 2.1.
The error is generated on line 76 of the .m file.
CCMenuAdvanced.h:
https://github.com/cocos2d/cocos2d-iphone-extensions/blob/master/Extensions/CCMenuAdvanced/CCMenuAdvanced.h
CCMenuAdvanced.m:
https://github.com/cocos2d/cocos2d-iphone-extensions/blob/master/Extensions/CCMenuAdvanced/CCMenuAdvanced.m
You are getting this warning because -(id) initWithItems: (CCMenuItem*) item vaList: (va_list) args is not present in the header file (CCMenuAdvanced.h).
You need to use + (id) menuWithItems: (CCMenuItem*) firstItem vaList: (va_list) args; from CCMenu (superclass of CCMenuAdvanced).