This project is read-only.

Change a buttons size?

Feb 11, 2012 at 10: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...

Feb 15, 2012 at 6:19 AM
Edited Feb 15, 2012 at 6: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
Feb 23, 2012 at 4:00 AM

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