Change a buttons size?

Feb 11, 2012 at 9:43 PM

Is this possible, due to it renders the text to a image? 

I thought that you mught add a Text Origin or something like that,

to make it render in the middle.

I haven't send much time in this inception of LocationComponent, so I'm not quite sure...

Coordinator
Feb 15, 2012 at 5:19 AM
Edited Feb 15, 2012 at 5:20 AM

Not as of now but it would be very easy to add in. I'll try to do it sometime this week. If you want to have a go at it take a look at Button.cs and make it so that you can set the width for LocationComponent.Size in the Init function.

 

protected internal override void Init() {

	_slidingDoorRenderer = (SlidingDoorRenderer)InstanceData.DefaultRenderers["Button"];
        _textRenderer = (TextRenderer)InstanceData.DefaultRenderers["TextRenderer"];

        var size = _textRenderer.Font.MeasureString(Label);
        LocationComponent.Size = new Vector2(
                size.X + (2 * _slidingDoorRenderer.EndWidth), //Your width here
                _slidingDoorRenderer.Height); //Height
}
Coordinator
Feb 23, 2012 at 3:00 AM

You can now adjust a buttons width. The text automatically centers its self for what ever width you specify.