stubma / cocos2dx-better Goto Github PK
View Code? Open in Web Editor NEWBetter cocos2d-x, without modifying cocos2d-x code. Better UI controls, better utilities, better compatibility
Better cocos2d-x, without modifying cocos2d-x code. Better UI controls, better utilities, better compatibility
null
目前label在ios可否将图标和文字的中间部分对齐,目前全部是居下对齐,当图标比较大的时候排版不是很好控制,而且在android上也是这种情况,不能横向居中对齐,目前我想到的是重写ImageSpan,但是效果不理想,而且目前比较严重的就是在ios上设置了w,h或者scale等,显示的效果在android上可能差别很大。
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?
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设置颜色后,图标也会变成该颜色,例如我将字设置成黑色,图标也就变黑了。
null
null
你好,请问有没有绑定lua的版本呢
null
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!
例如通过网络下载放在其它路径的文件
能否在RichLabel支持不实际生成Texture得到Size的功能?这样在聊天类的场景就可以预先计算对话的列表高度,可以提高性能。
我做了个测试,创建一千个CClabelTTF,内存会上涨再下降到原来状态,但是CCRichLabelTTF就不会下降到理想状态,初步判断,android端的实现有内存泄漏的问题,具体原因我正在查找,待会晚上看看能不能找到原因。
[color=ffff0000]红色[/color] 现实出来是白色文字,几乎没有红色痕迹。[color=ff0000ff]蓝色[/color]显示出来时蓝色,什么原因?
好久没来了,一直很忙,今天来看了下,发现还在更新。
一直用着你的label,真的很不错,也非常感谢,不过现在没怎么跟进了,而且我已经开始转用3.x了,以后有时间希望还可以多交流。
一般是跳转到某些activity才会出现该问题,加上了reloadAll还是会出现。
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.
null
null
什么时候需要get embedded image bound,不明白加这个的用途。
null
例如,我想让该图标的大小为15x15,那么可以scale图片到该范围内。
null
目前在安卓上有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上奔溃,现在我没有时间找到原因,不知道你能解决不。
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;
^
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....
Hi,I saw WiEngine support Animation Tool like MotionWelder,Could you port it to cocos2d-x please?
我是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)
我是这样写的:
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);
null
这样在用CCRichLabelTTF时很方便组合。
这样更好用,每个link带一个userobject,这样,回调的时候可以准确的判断是哪个link了。
而且,目前的link不支持换行,例如我setDimensions后,就无法支持了。
如题
我看到您在label里面加了CCMenu,这样会不会有点击权限的问题?而且我感觉CCMenu设计的很不好。
我目前的做法是单独继承自您的label,然后在里面让其继承于CCTouchDelegate,这样label其实就可以支持点击了,这时候就可以设置点击事件的回调。至于link,可能就得判断点击位置是不是在label的指定区域,如果在,那么就回调link事件。这样设计的好处是,去掉了CCMenu,不用创建menuitem了。但是又引入了CCTouchDelegate。
其实用CCMenu也ok,但是点击权限不知道好不好控制。
null
能不能帮忙看下,或者指点下
for example:
time_t timer = time(0);
tm* t = localtime(&timer);
in day = t->tm_yday + 1;
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.