MVC Collision +other question

Member
Posts: 34
Joined: 2009.01
Post: #16
AnotherJake Wrote:...greater than 200% better...
I'm just wondering if you could clarify this. Was your code performance after the optimizations 2x faster, 3x faster, or ... 200x faster?
Quote this message in a reply
Member
Posts: 306
Joined: 2009.03
Post: #17
I think the last time I used c++ i used STL(standered template something or other) to get lists and maps and all that. Any suggestions of a good library like that which can easily be put on the iphone?
[edit] I don't have access to check at work, but after some reading I am thinking xcode prob has an STL built in and I just need to either start importing things or maybe add some setting somewhere to get to them. And figure out what the imports will look like Wink
Quote this message in a reply
Member
Posts: 306
Joined: 2009.03
Post: #18
Well it turns out adding the boost library was not as easy as I had hoped. I set it up on the header search paths, and I can include the files, but they don't seem to be able to include the files that they depend on. Its strange though, in one of their source code files they refer to #include <utility> but the compiler doesn't find it. However the utility is in /boost/utility and they use /boost/abcxyz for other includes but not for this one. Changing the file to be /boost/utiltiy doesnt seem to help sadly. Not sure if its related to the fact that they use hpp files for their header or not.. Anyhow ill keep digging.
Quote this message in a reply
Moderator
Posts: 3,572
Joined: 2003.06
Post: #19
Good luck with Boost. Keep us updated!

kalimba Wrote:I'm just wondering if you could clarify this. Was your code performance after the optimizations 2x faster, 3x faster, or ... 200x faster?

Well, 100% is where it started before going straight C, so 100% better would be 2x faster, and another 100% would be 3x faster. So about 3x as fast using straight C instead of Cocoa crazy with Objective-C. At one point it was as slow as 15 FPS, and after C it went up to around 45 FPS, as I recall -- hazily. The techniques I used went from one extreme to the other, but I was drawing exactly the same scene. Like I said, I think it was mainly due to heavy reliance on NSDictionary and NSArray.
Quote this message in a reply
Member
Posts: 306
Joined: 2009.03
Post: #20
The boost thing appears to be an iphone project issue. I created a console c++ application and it all worked fine. Thats not a good sign. I will look a little more. Having auto memory cleanup is a really nice thing Wink
Quote this message in a reply
Member
Posts: 306
Joined: 2009.03
Post: #21
Ok got boost to work. It was all due to my misunderstanding of the .mm thing. I thought just the files you wanted to mix c++ and Obj c in needed it, so I had .m for my pure obj c classes and that was throwing it out of whack. I made all files be .mm and it compiled and worked correctly. The only problem is there is no content assist working for templated classes. Gonna look into that next. Having to give up code assist for this to work is no good Wink. They do have some no template version of the shared_ptr which is required in visual studios to make code assist work through these but I wasn't able to get that to do the trick yet. Ill post if i get it to work right.
Another thing thats wierd. If i do the standerd c project i can get code insight on :
shared_ptr<SomeObj> s;
s.[hit the insight key]
That works(which doesn't on the iphone project), but if i do s->[hit the key] I should see functions on SomeObj. I get no insight, but whats funny is that if i type a valid function name it colors it right, and if its an invalid function name it colors it wrong. So it clearly knows what they are Smile
Quote this message in a reply
Member
Posts: 306
Joined: 2009.03
Post: #22
Looks like xcode doesn't support code completion through smart pointers. I tried the basic auto_ptr that comes with c++ and it had the same problem. Thats too bad.

After more digging it appears its the templates thats the problem. The following does not allow code completion:
Code:
class X{
public:
    int z()
    {
        return 5;
    }
};
template<class T> class Test{
public:
    int z()
    {
        return 5;
    }
    T * get() const // never throws
    {
        return NULL;
    }
};

int main (int argc, char * const argv[]) {

    Test<X> t;
    t.get()->
}

If anyone knows how to make that work I would be extremely grateful.
Quote this message in a reply
Member
Posts: 306
Joined: 2009.03
Post: #23
Also saw this post in response to my question on the offical forums Sad

Xcode's indexer does not handle C++ templates or namespaces at all. No features of Xcode that are based on symbolic manipulation—code completion, navigation, class modeling, class browsing, etc.—will work with C++ templates, or distinguish among symbols in separate namespaces.

guess I need to suck it up work on my delete skills Smile
Quote this message in a reply
Moderator
Posts: 3,572
Joined: 2003.06
Post: #24
Great to see you got Boost working on iPhone.

Yeah, Xcode has plenty of failings. It's free though, and it gets the job done. Wink
Quote this message in a reply
Member
Posts: 75
Joined: 2009.01
Post: #25
Well, if your game isn't too complicated and will be using pngs, you could use the CGRectIntersectsRect/CGRectContainsRect methods.
Those are what I use for my simple games that use pngs.
Quote this message in a reply
Post Reply