Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm trying to get a CCControlButton to render on my game. Using a basic CCScale9Sprite as the button's background works using the following:

var myScale9Sprite = CCScale9Sprite.Create(@"UI\Button50x50");
var label = CCLabelTTF.Create("Return To City", "Arial", 70);

var button = CCControlButton.Create(label, myScale9Sprite);
button.Position = new CCPoint(200, 200);

AddChild(button);

The text doesn't fit nicely in the button. As I understand it, CCScale9Sprite's Inset properties are used to define how the content works. But every attempt I have made to use this property results in the background sprite disapearing completely. This is the offending code:

// Using a 50x50 image with a 10 pixel border
myScale9Sprite.CapInsets = new CCRect(10,10,30,30);

Any attempt to set Insets, using either CapInsets, InsetLeft, InsetRight, InsetTop, InsetBottom, or even specifying a CCRect in CCControlButton.Create results in the same issue.

Is my usage correct?

Is it just not implemented correctly in the xna branch? I had this issue with the build I have been using for the last 6 months, so downloaded the latest (2013/03/24) source from github and still have the same issue. Looking at the source, there's nothing to suggest that its not implemented.

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.