Wasin Thonkaew cocos2d-x for Mac OS X ?
Posts 227
Added by Wasin Thonkaew about 1 year ago

Is there going to be cocos2d-x runnable on Mac OS X like in its PC version ?

Zhe Wang RE: cocos2d-x for Mac OS X ?
Posts 1642
Location Amoy, China
Added by Zhe Wang about 1 year ago

Here's the contributed source code of mac port. We're busy upgrading gles20 branch, so have no time to merge it into master branch.
If someone need mac port badly, he can start from this zip ball.

Enjoy Coding, Enjoy Life.

Wasin Thonkaew RE: cocos2d-x for Mac OS X ?
Posts 227
Added by Wasin Thonkaew about 1 year ago

That's okay. I can wait until you guys merge it.
Glad to hear it's still in development.
Thanks

Alex Leutgoeb RE: cocos2d-x for Mac OS X ?
Posts 3
Added by Alex Leutgoeb about 1 year ago

Thanks for the hint in the other thread, glad that there is still some development for the Mac platform going on.

I'll try to merge the sources in my project later on, are there any statements from the original author for which (major) version of Cocos2d-x this port is intended?

Alex

joseph pinkasfeld RE: cocos2d-x for Mac OS X ?
Posts 14
Added by joseph pinkasfeld 12 months ago

I use this with the last cocos2d-x release to make nice video of my new cocos2d-x game
But I think there is a mistake
in the following method of CCDisplayLinkDirectorMac

void CCDisplayLinkDirectorMac::mainLoop(void)
{
    if (m_bPurgeDirecotorInNextLoop)
    {
        purgeDirector();
        m_bPurgeDirecotorInNextLoop = false;
    }
    else if (! m_bInvalid)
    {
        drawScene();

        // release the objects
        //CCPoolManager::getInstance()->pop();        
    }
}

Someone have forgotten to remove a comment

//CCPoolManager::getInstance()->pop();        

it should not be commented
or nothing will be autorelease

Andrey Kiryushkin RE: cocos2d-x for Mac OS X ?
Posts 4
Added by Andrey Kiryushkin 12 months ago

Hey Joseph,
could you please share the working library for Mac OS X with a simple Hello World running? Thanks a lot.

joseph pinkasfeld RE: cocos2d-x for Mac OS X ?
Posts 14
Added by joseph pinkasfeld 12 months ago

it will be available here
http://flashbob.free.fr/essai/helloworld.zip
Original cocos2d-x plateform test are a bit hacked to have both Mac and Iphone plateform in the same project file, I didn't figure well how it works

Andrey Kiryushkin RE: cocos2d-x for Mac OS X ?
Posts 4
Added by Andrey Kiryushkin 12 months ago

Thank you very much!! I was able to run my project on Mac platform thanks to your effort!
I'm very grateful.

Imperial Penguin RE: cocos2d-x for Mac OS X ?
Posts 22
Added by Imperial Penguin 11 months ago

I would like to thank you as well! I as having a hard time figuring out how to get the hello world sample running on OS X. You can do a proper platform check like this:

#ifdef __APPLE__
#include "TargetConditionals.h" 
#endif

//iphone
#if ! CC_TARGET_PLATFORM && TARGET_OS_IPHONE
    #undef  CC_TARGET_PLATFORM
    #define CC_TARGET_PLATFORM         CC_PLATFORM_IOS
    #define CC_SUPPORT_MULTITHREAD 0
    #define CC_SUPPORT_UNICODE 0
    #define CC_SUPPORT_PVRTC
#endif
//
// mac
#if ! CC_TARGET_PLATFORM && TARGET_OS_MAC
    #undef  CC_TARGET_PLATFORM
    #define CC_TARGET_PLATFORM         CC_PLATFORM_MAC
    #define CC_SUPPORT_MULTITHREAD 0
    #define CC_SUPPORT_UNICODE 0
#endif

TargetConditionals.h defines TARGET_OS_IPHONE as 0 on Mac, but since it is still defined you have to check the value instead of just checking for the definition.

Imperial Penguin RE: cocos2d-x for Mac OS X ?
Posts 22
Added by Imperial Penguin 11 months ago

Thanks greatly to the help from Joseph, I put a working version on github here https://github.com/ImperialPenguin/cocos2d-x/tree/macosx All I have is the hello world demo up now, but I hope to add the tests soon and begin the process of seeing what bug fixes and features need to be added.

Wasin Thonkaew RE: cocos2d-x for Mac OS X ?
Posts 227
Added by Wasin Thonkaew 11 months ago

Thanks everyone for bumping this up, great to see working version on Mac! :)

Imperial Penguin RE: cocos2d-x for Mac OS X ?
Posts 22
Added by Imperial Penguin 11 months ago

I just added support for Truetype fonts to the port and pushed it to the github address above. Is there an official github repo somewhere for the macosx port that I can send a pull request to? There's still a lot of things that I want to fix and I'd like to be able to share the fixes with everyone.

Wenzhi Cai RE: cocos2d-x for Mac OS X ?
Posts 1
Location 北京朝阳
Added by Wenzhi Cai 11 months ago

Thanks for joseph's sharing! I'm looking for this for long time!!!

CocoSpark

Johan Sundhage RE: cocos2d-x for Mac OS X ?
Posts 5
Added by Johan Sundhage 11 months ago

Imperial Penguin: is the github macosx branch removed now? I downloaded it a few days ago and started to play around and found a few bugs I'd like to report...

Imperial Penguin RE: cocos2d-x for Mac OS X ?
Posts 22
Added by Imperial Penguin 11 months ago

No, I didn't delete the branch, I just merged it with the master because I had fixed everything that I wanted to (or at least I thought I did. Let me know if there are more problems and I'll take a look at them).
I did make some changes to fit my needs that others might not appreciate so much though. For example, you now have to call a create function that takes four arguments. The first two are the width and height of the window in pixels, and the next two are the width and height of the window in points. This will make it easier to port over existing mobile titles, by allowing you to keep working in the 320x480 coordinate system. Enabling retina display will allow the use of larger images.
I also added preliminary joystick support hooked to the accelerometer. Right now it needs an analog joystick (the d-pad doesn't do anything) and the DDHIDLib framework needs to be copies to the app's bundle. Eventually, I want to build a static version of the library to take a away that requirement, but I've been busy with other things. I've also added support for keyboard input. You can type in the textinputtest directly, of course. The keypad test keys (back, and menu) are mapped to Shift-F1 and Shift-F2, although I doubt that will be very useful to anybody.
There is one bug left in the github branch, and that is that glView is being initialized twice in the test and helloworld projects. I haven't bothered pushing the fix because I didn't think anyone was paying attention. I'll try to find time to do that today. Let me know if I missed anything.

Johan Sundhage RE: cocos2d-x for Mac OS X ?
Posts 5
Added by Johan Sundhage 11 months ago

ah, great!

I've stumbled upon some strange behaviors while trying to run an old Cocos2d-x game of mine for mac... I have a helper function that generates buttons that consist of a sprite container, a background sprite and a CCLabelBMFont instance on top of that. After creating a few of these buttons and adding them to the scenery I get an assertion at CCSprite::addChild --> CCAssert(((CCSprite*)pChild)->getTexture()->getName() == m_pobTextureAtlas->getTexture()->getName(), ""); (EXC_BAD_ACCESS)

This happens approx 50% of the times i run the app. Otherwise everything works. My dirty work-around is to set m_bUsesBatchNode to false which works in my case... I have a zip of a Xcode project that generates the assertion but it's too big to attach here. If anyone wants it, send me a PM containing an email address and I'll send it that way...

Nat Weiss RE: cocos2d-x for Mac OS X ?
Posts 17
Added by Nat Weiss 10 months ago

Hey all.

Just wanted to let everybody know I'm starting an effort to merge all the mac code into the latest gles20 branch so it can hopefully be a part of the next Cocos2d-X release, even if some features are limited.

I'm using ImperialPenguin's cocos2d-x mac branch and the zip Walzer provided above and piecing things together in a fresh branch of gles20.

When everything's ready I will submit a pull request to the Cocos2d-X team so they can merge it.

Nat Weiss RE: cocos2d-x for Mac OS X ?
Posts 17
Added by Nat Weiss 10 months ago

Got it working! Whew. It was quite a trick to sort out all the changes from 1.x to 2.x and make the Mac version happy.

So yeah, it works! Full screen support works. Mouse input. Sound. All the basics are in there.

Here's a little video showing it off:
http://www.youtube.com/watch?v=I5nqC3-GeLM

The pull request I am submitting to the Cocos2d-X team has only basic Mac support. I will leave it to somebody else to make the HelloWorld, test project and proj.mac folders.

ImperialPenguin? :)

Here's the pull request:
https://github.com/cocos2d/cocos2d-x/pull/1107

Imperial Penguin RE: cocos2d-x for Mac OS X ?
Posts 22
Added by Imperial Penguin 10 months ago

I'd be happy to have a go at it when I get a chance, but unfortunately right now I'm looking at a month or so of work before I even find time for a nap. I overextended myself when iPhoneDevSDK.com when down for a week or so and I created a replacement forum even with a boatload of work ahead of me. Of course iPhoneDevDSK came back up as minutes after I was done, but I figure I might as well finish polishing up the forum. Even if no one joins it gives me a break from my current Cocos2d-x project. Sometimes you get tired of looking at the same codebase for two months straight. Haha. Anyhow, I'll take a look when I have time, but someone else may beat me to it.

Tamas V RE: cocos2d-x for Mac OS X ?
Posts 10
Added by Tamas V 10 months ago

When will Mac code ready for use and bundled in stable version of Cocos2dx?
Thanks.

Minggo Zhang RE: cocos2d-x for Mac OS X ?
Posts 1641
Added by Minggo Zhang 10 months ago

Big thanks to Nat Weiss.
The pull request is merged into cocos2d-x.
You can download and have a try.

Joe Rumsey RE: cocos2d-x for Mac OS X ?
Posts 3
Added by Joe Rumsey 9 months ago

This has issues on the Retina MBP. Mostly it works, but font rendering is garbled. If I coerce mine to run at native resolution (something Apple doesn't even allow!), it works fine, but at any standard resolution it looks bad (See attached screenshot, that's supposed to say Hello World, and also the framerate display)

I'm happy to help debug, and I've tried to a little bit, but I don't know very much about, well, any of this :)

Screen Shot 2012-08-12 at 10.32.32 AM.png - Cocos2d-x Mac on Retina MBP (916.7 kB)

Imperial Penguin RE: cocos2d-x for Mac OS X ?
Posts 22
Added by Imperial Penguin 9 months ago

Hmm. I'm baffled as to why it would not show up at all like that on retina modes, but show up when you change the resolution. I would think, if anything, it would just look blurry in retina mode. Unfortunately I don't have a MBP and right now I wouldn't even have a clue where to start debugging. I'll have a look on the interwebs to see if I can find any known issues with Freetype and Retina displays. Hopefully this is something that already has a fix.

Joe Rumsey RE: cocos2d-x for Mac OS X ?
Posts 3
Added by Joe Rumsey 9 months ago

The only thing I really know about the Retina display is that if you set your resolution to 1920x1200 (the highest Apple approved resolution), then behind the scenes it's actually rendering everything at twice that (3840x2400) and then downsizing it to the actual display resolution (2880x1800)

I stepped through some stuff looking for suspicious numbers related to those resolutions, but I don't really know where to look, so not surprisingly, I didn't find anything immediately obvious. Still, my guess is that there's something somewhere that's finding and using the wrong one of those resolutions.

Imperial Penguin RE: cocos2d-x for Mac OS X ?
Posts 22
Added by Imperial Penguin 9 months ago

I've found a thread here http://www.cocos2d-iphone.org/forum/topic/36096 relating to the iPhone version that claims to fix it. In fact, it looks like there are two fixes in there. It might be 2-3 weeks before I have time to get to it though. I'm behind schedule and trying to catch up as quickly as possible. But fixing this is crucial to finishing the project I'm behind on, so it will definitely become a priority at some point in the near future, if nobody else beats me to it.

Steven Barnes RE: cocos2d-x for Mac OS X ?
Posts 20
Added by Steven Barnes 9 months ago

There is a serious bug regarding cocos2dx support for OS X. If you look in to file TargetConditionals.h, you will see that when compiling for OS X, these macros are defined:

#define TARGET_OS_MAC 1
#define TARGET_OS_WIN32 0
#define TARGET_OS_UNIX 0
#define TARGET_OS_EMBEDDED 0
#define TARGET_OS_IPHONE 0
#define TARGET_IPHONE_SIMULATOR 0

In CCPlatformConfig.h we see this code, which will always evaluate true. You need to check TARGET_OS_IPHONE==1, not defined(TARGET_OS_IPHONE).

#if ! CC_TARGET_PLATFORM && (defined(TARGET_OS_IPHONE) || defined(TARGET_IPHONE_SIMULATOR))
#undef CC_TARGET_PLATFORM
#define CC_TARGET_PLATFORM CC_PLATFORM_IOS
#define CC_SUPPORT_PVRTC
#endif

This took me a long time to figure out. Now I have to see if my game actually runs.


1 2 Next » (1-25/34)