Coder Social home page Coder Social logo

stubma / cocos2dx-better Goto Github PK

View Code? Open in Web Editor NEW
174.0 174.0 105.0 30.92 MB

Better cocos2d-x, without modifying cocos2d-x code. Better UI controls, better utilities, better compatibility

Makefile 0.11% C++ 66.64% Objective-C 7.49% C 12.75% Java 9.52% Lua 0.05% Python 0.13% Objective-C++ 3.27% PHP 0.01% Shell 0.04%

cocos2dx-better's People

Contributors

stubma avatar wsgfz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cocos2dx-better's Issues

label的图标问题

目前label在ios可否将图标和文字的中间部分对齐,目前全部是居下对齐,当图标比较大的时候排版不是很好控制,而且在android上也是这种情况,不能横向居中对齐,目前我想到的是重写ImageSpan,但是效果不理想,而且目前比较严重的就是在ios上设置了w,h或者scale等,显示的效果在android上可能差别很大。

Socket issue

Hi stubma,I have some problem in the CCTCPSocket sendData and init.

I found that the socket is in nonblocking mode,so send or recieve can in main thread.
And in sendData method,it just copy the data to the socket m_outBuf, the flush() method called only if the m_outBuf is not enough,.Dose is not in-time?
and in sendData() method :

if(m_outBufLen + size > kCCSocketOutputBufferDefaultSize) {
    flush();
    if(m_outBufLen + size > kCCSocketOutputBufferDefaultSize) {
        destroy();
        return false;
    }
}

if flush() dose not send anything,it may occur EINPROGRESS or EAGAIN,so it will execute:

if(m_outBufLen + size > kCCSocketOutputBufferDefaultSize) {
destroy();
return false;
}

and the socket would destroyed,but EINPROGRESS or EAGAIN is not a really socket error,we should send data when the socket buf writable.

Another issue is CCTCPSocket init method,
When socket created,it will connect to the server,it will blocking in select for blockSec.when create socket in main thread,it will blocking main thread,why not set the blockSec to zero,and check the connect event in Scheduler?

label的问题

static CGFloat getAscent(void* refCon) {
Span& span = (Span)refCon;
NSString* name = [NSString stringWithCString:span.imageName
encoding:NSUTF8StringEncoding];
UIImage* image = [s_imageMap objectForKey:name];
return (span.height != 0 ? span.height : (image.size.height * span.scaleY)) * CC_CONTENT_SCALE_FACTOR();
}

static CGFloat getDescent(void* refCon) {
return 0;
}

static CGFloat getWidth(void* refCon) {
Span& span = (Span)refCon;
NSString* name = [NSString stringWithCString:span.imageName
encoding:NSUTF8StringEncoding];
UIImage* image = [s_imageMap objectForKey:name];
return (span.width != 0 ? span.width : (image.size.width * span.scaleX)) * CC_CONTENT_SCALE_FACTOR();
}

要加上* CC_CONTENT_SCALE_FACTOR()吗?

设置颜色

label设置颜色后,图标也会变成该颜色,例如我将字设置成黑色,图标也就变黑了。

CCImage_richlabel_ios.mm line 610 CCImage & CCImage undeclared

I compile it in mac,xcode 5.0.2 and i got the error

file : CCImage_richlabel_ios.mm

static bool _initWithString(const char * pText, CCImage::ETextAlign eAlign, const char * pFontName, int nSize, tImageInfo* pInfo, CCPoint* outShadowStrokePadding, LinkMetaList* linkMetas) {
bool bRet = false;

error info :
Semantic issue Use of undeclared Identifier 'CCImage'; did you mean 'CGImage'

and then I add #include "CCImage.h" #include "CCGemetry.h" in the head!
but it got same error! why?
I am new in mac programming, and this is first time i'am using mac machine!
somebody help me!

memory leaks on Android !

我做了个测试,创建一千个CClabelTTF,内存会上涨再下降到原来状态,但是CCRichLabelTTF就不会下降到理想状态,初步判断,android端的实现有内存泄漏的问题,具体原因我正在查找,待会晚上看看能不能找到原因。

Android平台文字颜色问题

[color=ffff0000]红色[/color] 现实出来是白色文字,几乎没有红色痕迹。[color=ff0000ff]蓝色[/color]显示出来时蓝色,什么原因?

好久没来了

好久没来了,一直很忙,今天来看了下,发现还在更新。
一直用着你的label,真的很不错,也非常感谢,不过现在没怎么跟进了,而且我已经开始转用3.x了,以后有时间希望还可以多交流。

Crash

Change The Font File On IOS, CRASH AGAIN!

Just Test With TTF File:http://pan.baidu.com/share/link?shareid=3476960079&uk=2014516696

change name to yahei.ttf, copy toe font dir.
Test with:
CCRichLabelTTF* label = CCRichLabelTTF::create("[font=font/yahei.ttf][color=ffffffff]W[/color]orld![/font]", "Helvetica", 30);

Crash, File :CCImage_richlabel.mm
if(frame)
CFRelease(frame);

YOU SHOULD TEST THE LIB DEEPLY ENOUGH.

Crash

你们竟然如此害怕出现问题?没有验证之下,就关闭一个issue?
字体文件:
64beb673-01e0-4534-a957-a70e55c691cf

Post名称:
8158fe4e-582f-4fbd-9e01-c6ceca982701

代码段:
64b149af-9a4f-4af3-bc53-f2b4f6bad0d5

Crash:
465a3551-446d-4f7b-abeb-9a6050d5e399

One suggestion

image

put these import statments into .mm file will be better~

iOS project Target Dependency

screen shot 2013-12-09 at 6 38 33 pm

It's better to add target dependency to let Xcode compile sub-project automatically.

Test cpp as well.

Thanks for great work!

新bug

目前在安卓上有2个bug,
1.在
......
if(!sizeOnly) {
// save padding
nativeSaveShadowStrokePadding(startX, Math.max(0, height - layout.getHeight() - startY));

            // create bitmap and canvas
            Bitmap bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888);
            Canvas c = new Canvas(bitmap);

......
之前还是需要判断width和height的大小,这个我目前就是加上了:
if(width > 0 && height > 0)
的条件解决。
2.如果我使用[color=ff000000][/color],也就是标签中间是空字符,在android上奔溃,现在我没有时间找到原因,不知道你能解决不。

Building Error

Hi,I built the code in XCode,but some erros appeared as follow:
In file included from /Users/apple/Documents/project_cocos2dx/TestDemo/cocos2dx-common/cocos2dx-common/src/CCAssetInputStream.cpp:26:
In file included from /Users/apple/Documents/project_cocos2dx/TestDemo/cocos2dx-common/cocos2dx-common/include/CCMoreMacros.h:47:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:8:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:409:1: error: expected unqualified-id
@Class NSString, Protocol;
^

crash after setLinkTarget

setLinkTarget not stable enough,crash on :
function : extractLinkMeta

CGFloat startOffsetX = CTLineGetOffsetForStringIndex(line, linkStart, NULL) / CC_CONTENT_SCALE_FACTOR();

EXC_BAD_ACCESS

Even Just Use Link Tag Will Crash On IOS.

Just Test With: [link bg=3f7f7f7f bg_click=9fffff00]显示[/link]

Crash, Not Crash,Crash,Not Crash,I am crazy....

MotionWelder support

Hi,I saw WiEngine support Animation Tool like MotionWelder,Could you port it to cocos2d-x please?

demo跑不起来... cocos2d-x-2.2

我是cocos2dx新手,下载了您的开源工程,参照README把工程目录放到和"cocos2d-x"同一个父目录下,但是TestCpp跑不起来。
报错信息为:
Undefined symbols for architecture i386:
"CocosDenshion::SimpleAudioEngine::sharedEngine()", referenced from:
cocos2d::CCResourceLoader::CDMusicTask::load() in libcocos2dxcommon.a(CCResourceLoader.o)
cocos2d::CCResourceLoader::CDEffectTask::load() in libcocos2dxcommon.a(CCResourceLoader.o)
"CocosDenshion::SimpleAudioEngine::preloadEffect(char const_)", referenced from:
cocos2d::CCResourceLoader::CDEffectTask::load() in libcocos2dxcommon.a(CCResourceLoader.o)
"CocosDenshion::SimpleAudioEngine::preloadBackgroundMusic(char const_)", referenced from:
cocos2d::CCResourceLoader::CDMusicTask::load() in libcocos2dxcommon.a(CCResourceLoader.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

重新把cocos2dx-common的项目文件拖进去依旧报此错误。
是不是静态库的依赖我设置的不对啊?恳请不吝赐教!

小问题

java文件第333行我改成了这样的判断:
case IMAGE:
{
if(openSpan != null && openSpan.imageName.length() > 0) {
原来只判断了
if(openSpan != null)

CCRichLabel ,显示不出来

我是这样写的:
CCRichLabelTTF* pRichLab = CCRichLabelTTF::create("Hell[color=ffff0000]o[/color]", "Arial", TITLE_FONT_SIZE);
pRichLab->setPosition(ccp(origin.x + visibleSize.width/2, origin.y + 100));
pRichLab->setColor(ccBLUE);
this->addChild(pRichLab, 10);

link最好支持userobject

这样更好用,每个link带一个userobject,这样,回调的时候可以准确的判断是哪个link了。
而且,目前的link不支持换行,例如我setDimensions后,就无法支持了。

关于link的小问题

我看到您在label里面加了CCMenu,这样会不会有点击权限的问题?而且我感觉CCMenu设计的很不好。
我目前的做法是单独继承自您的label,然后在里面让其继承于CCTouchDelegate,这样label其实就可以支持点击了,这时候就可以设置点击事件的回调。至于link,可能就得判断点击位置是不是在label的指定区域,如果在,那么就回调link事件。这样设计的好处是,去掉了CCMenu,不用创建menuitem了。但是又引入了CCTouchDelegate。
其实用CCMenu也ok,但是点击权限不知道好不好控制。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.