iphone - Cocos2D CCLabelTTF diplays solid rectangle -
i need implement debug layer in ios application getting feedback testers.
found this solution on github want: transparent layer on top of application, can print debug info.
the cocos2d-debug-layer uses cclabelttf
display debug messages.
i have inserted api code , works expected. problem messages appear solid rectangle, while appear correctly.
i have tried change cclabelttf
’s color, , has effect, changes text , background color also. if don’t change color (leave defaults), prints white rectangle.
i have found cclabelttf
’s background cannot changed. cannot set background transparent.
i use cocosdebuglayer
this:
initializing in gamescene.m
:
+(id) scene { ccscene *scene = [ccscene node]; seraphingame *layer = [seraphingame node]; [scene addchild: layer]; //add debug layer cocosdebuglayer *debuglayer = [cocosdebuglayer node]; [scene addchild:debuglayer z:10000]; [[nsnotificationcenter defaultcenter] postnotificationname:@"logmessage" object:@"init scene"]; return scene; }
sending log messages several places in same .m
file:
[[nsnotificationcenter defaultcenter] postnotificationname:@"logmessage" object:@"other log message"];
the first line printed right: "init scene"
but thereafter, prints solid blocks.
the label's font helvetica available default. can not problem, because messages appear right not.
this code creating cclabelttf
s:
-(void)logmessage:(nsnotification*)notification { nsstring *message = [notification object]; cclabelttf *logmsg = [cclabelttf labelwithstring:message fontname:@"helvetica" fontsize:12]; [logmsg setanchorpoint:cgpointzero]; [self addchild:logmsg]; [logmessages addobject:logmsg]; [logmsg release]; [self updatelog]; }
Comments
Post a Comment