public void Update(Cursor cursor) { if (myFunction != null) { textData = myFunction.Invoke(); } else { if (functionParameter != null) { textData = functionParameter(objeto); } } if (aligment == Aligment.Center && bold == false) { this.left = (rectangle.Width / 2 - GLFont.GlSize(fontId, textData) / 2); } else { if (aligment == Aligment.Center && bold == true) { //this.left = (rectangle.Width / 2 - Sprite.FontBoldWidth(textFont, textData) / 2); } } if (aligment == Aligment.Right) { this.left = (rectangle.Width - GLFont.GlSize(fontId, textData)); } }
public Button(Rectangle rectangle, string text, OnClick onClick) { base.zOrder = 0; this.text = text; this.areaRectangle = rectangle; base.onClick = onClick; texNormalS = "normal.jpg"; texPressedS = "pressed.jpg"; textHoverS = "hover.jpg"; texCurrent = texNormal; textWidth = GLFont.GlSize("verdana", 18, text); textPosition = new Vector2(areaRectangle.X + (areaRectangle.Width - textWidth) / 2, areaRectangle.Y + ((areaRectangle.Height - 15) / 2) + 14); this.fontId = GLFont.GetFontId("verdana", 18); }