Forums » C++ Framework » cocos2d-x for Mac OS X ? »
| Wasin Thonkaew | cocos2d-x for Mac OS X ? | ||||
|---|---|---|---|---|---|
|
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 ? | ||||
|
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. cocos2d-x for mac.zip (284.8 kB) Enjoy Coding, Enjoy Life. |
||||
| Wasin Thonkaew | RE: cocos2d-x for Mac OS X ? | ||||
|
Added by Wasin Thonkaew about 1 year ago
That's okay. I can wait until you guys merge it. |
||||
| Alex Leutgoeb | RE: cocos2d-x for Mac OS X ? | ||||
|
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 ? | ||||
|
Added by joseph pinkasfeld about 1 year ago
I use this with the last cocos2d-x release to make nice video of my new cocos2d-x game
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 |
||||
| Andrey Kiryushkin | RE: cocos2d-x for Mac OS X ? | ||||
|
Added by Andrey Kiryushkin 12 months ago
Hey Joseph, |
||||
| joseph pinkasfeld | RE: cocos2d-x for Mac OS X ? | ||||
|
Added by joseph pinkasfeld 12 months ago
it will be available here |
||||
| Andrey Kiryushkin | RE: cocos2d-x for Mac OS X ? | ||||
|
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! |
||||
| Imperial Penguin | RE: cocos2d-x for Mac OS X ? | ||||
|
Added by Imperial Penguin 12 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 ? | ||||
|
Added by Imperial Penguin 12 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 ? | ||||
|
Added by Wasin Thonkaew 12 months ago
Thanks everyone for bumping this up, great to see working version on Mac! |
||||
| Imperial Penguin | RE: cocos2d-x for Mac OS X ? | ||||
|
Added by Imperial Penguin 12 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 ? | ||||
|
Added by Wenzhi Cai 12 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 ? | ||||
|
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 ? | ||||
|
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). |
||||
| Johan Sundhage | RE: cocos2d-x for Mac OS X ? | ||||
|
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 ? | ||||
|
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 ? | ||||
|
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: 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: |
||||
| Imperial Penguin | RE: cocos2d-x for Mac OS X ? | ||||
|
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 ? | ||||
|
When will Mac code ready for use and bundled in stable version of Cocos2dx? |
||||
| Minggo Zhang | RE: cocos2d-x for Mac OS X ? | ||||
|
Added by Minggo Zhang 10 months ago
Big thanks to Nat Weiss. |
||||
| Joe Rumsey | RE: cocos2d-x for Mac OS X ? | ||||
|
Added by Joe Rumsey 10 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 ? | ||||
|
Added by Imperial Penguin 10 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 ? | ||||
|
Added by Joe Rumsey 10 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 ? | ||||
|
Added by Imperial Penguin 10 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 ? | ||||
|
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: 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). |
