My project originated as the cocos2d Box2D template and I'm having issues as soon as I tried to create a world:
world = new b2World(gravity,doSleep);
Gives the error: No matching constructor for initialization of 'b2World'.
The file is .mm, I assume it's some issue about library linking maybe? If so I'm using xCode 4, how can I check the lib is properly linked?
Thanks.
You are using Box2D v2.2 or newer. The b2World constructor no longer takes two arguments, just one (gravity). You have to set doSleep separately:
world = new b2World(gravity);
world->SetAllowSleeping(doSleep);
This won't be the only change you'll need to make to transition from Box2D v2.1.x to v2.2.x. Kobold2D has a working Box2D 2.2.1 sample project, even if you don't use Kobold2D you can get updated source code for Box2D basics. In particular the GLESDebugDraw class and how to setup a screen bounding box with a body using multiple shapes.
Related
When I include a WebView component on a form in my Objective C project in XCode7 for a Cocoa application on OSX and try to compile, it compiles and then has a runtime error of:
NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of class (WebView) for key (NS.objects); the class may be defined in source code or a library that is not linked
What's the fix?
In XCode7, if you use a WebView widget, you have to add the framework. Go to the Project Navigator and click the first icon, which is your project icon. In the middle of your screen on that IDE then, you'll see General > Linked Frameworks and Libraries. Click the + and add WebKit.framework. Now when you compile, the linkage will be there and it will work.
The drawback I think is that it says it's a 10.11 component, and so if I want to deploy my app to a 10.9 system or 10.10 system, it won't work. I'm not 100% certain of this without testing, however, but do have this hunch.
ADDENDUM:
I set my project to be 10.8 compliant and then found I can run just fine on 10.8 all the way to the latest OSX.
I added the Parse SDK today (1.2.15) to an existing project which targets iOS7 and is built in Xcode5. I followed the instructions on https://parse.com/apps/quickstart#ios/native/existing exactly. Some things work, like creating and saving a PFObject. Certain functions however cannot be found by the compiler. For instance [PFUser enableAutomaticUser]; generates the error
AppDelegate.m:21:13: No known class method for selector 'enableAutomaticUser'
and [PFAnalytics trackAppOpenedWithLaunchOptions:launchOptions]; generates the error
AppDelegate.m:20:6: Use of undeclared identifier 'PFAnalytics'
Are the docs out of date and have these methods moved? I have tried restarting Xcode and cleaning my project. I can see the PFAnalytics.h file if I expand Parse.Framework in Xcode, and when I look at PFUser.h I can see a declaration of enableAutomaticUser;. Why can Xcode see some Parse classes and methods but not others?
My problem was that Framework Search Paths in Build Settings contained two directories, and one was invalid, resulting in this very strange behavior where some methods in Parse worked and others didn't.
I jsut started working at a company that uses flash builder, but I am using fdt at the moment. I am hvaing trouble getting FDT to instantiate the sprite in an fla project along with the custom class that goes with it.
Also, for some reasont he people here say instantiating a sprite like this is WRONG:
var mc:MovieClip = new MoviClip()
and this is right:
var _someClass:Class = getDfinitionByName("Linkage") as Class;
var _mc:Sprite = new _someClass() as Sprite
I cannot figure out how to instantiate the movieclip in the fla and also the as class at the same time with this method.
Is the asset a 'Sprite' or a 'MovieClip'? Although you can create Sprite assets in Flash Professional (FLA) it's likely the asset is a Movieclip.
Please confirm this.
Alao, a 'Movieclip' is a 'Sprite' since it inherits from 'Sprite'.
That way of linking is quite verbose and not typical. Are you linking the asset at compile or runtime?
Most people just export assets as a SWC. If you want to get the asset at runtime it's a different thing a bit...
Look at this post.
You use getDfinitionByName("Linkage") when your assets are loaded at runtime. If they are linked at compile time (as an swc library) then you're free to do var mc:Linkage = new Linkage(); instead.
I have a working game where I am loading all the textures from a different class. It works perfectly fine for the PC version.
Now, I am trying to port it to win8 using Monogame.
If I load a texture from Game1.cs using .xnb file it works absolutely fine. However, when I try to load the same texture by using a different class, it doesn't. It gives me an NullReferenceException error on
GraphicsDevice.Clear(Color.Cornflowerblue);
HungryCoder:
I don't know how you are loading the texture from the class, however, right now MonoGame doesn't yet have a Content Pipeline like you were provided with in building and XNA Game for the PC (they are working on it), therefore, you cannot add graphic files in the same manner.
In my walkthrough of building a Windows 8 XNA game, I create my Shooter player graphic from my own Player class by passing into my Initialize function within the class the Content.Load<> with the Texture type and location:
player.Initialize(Content.Load("Graphics\player"), playerPosition);
Note the .xnb file is located in a folder Graphics within my project.
In my background, I have also created a parallaxing background from a my background class by passing in the full Content Manager to my Initialize method of my Background class as well.
bgLayer1 = new ParallaxingBackground();
bgLayer1.Initialize(Content, "Graphics\bgLayer1", GraphicsDevice.Viewport.Width, -1);
Both of these examples work within my project/game.
If you interested have posted the player code example as a part of blog tutorial series on MonoGame on Windows 8. As I complete the code for the background, I will also add the full code example for the background as well. Hope this helps.
http://blogs.msdn.com/tarawalker
Are the images and sound files that are used inside the Unity IDE somehow compiled into libiPhone-lib.a inside XCode? I'm looking for a way to access the audio files and images inside XCode/Objective-C. As far as I can tell by looking at the exported XCode project, there are no sound files or other resources anywhere to be seen
They are compiled into the lib as a byte code which is then interpreted at runtime. Disclosure of this would destroy Unity's business model, as everyone would make corrections into unity-produced code. It is more easy for them to interpret bytecode rather than translating it into human-readable language like C or objective-c.
The answer is: yes, they are compiled into lib.
If you want to access them from objective-c layer, you have to add them to project again in a usual xCode way ,so their data will be doubled in the project.