public HudTextBoard(string pText, float px, float py, int width, int height, int textSize, CenterMode hor = CenterMode.Min, CenterMode ver = CenterMode.Min) { this.x = px; this.y = py; this._text = pText; _easyDraw = new EasyDraw(width, height, false); _easyDraw.TextFont("data/Gaiatype.ttf", 12); if (!string.IsNullOrEmpty(pText)) { _easyDraw.TextSize(textSize); _easyDraw.TextDimensions(_text, out var w, out var h); var wr = Mathf.Round(w); var hr = Mathf.Round(h); if (wr <= 0) { wr = 10; } if (hr <= 0) { hr = 10; } _easyDraw = new EasyDraw(wr, hr, false); } _easyDraw.TextFont("data/Gaiatype.ttf", 12); _easyDraw.TextSize(textSize); _easyDraw.TextAlign(hor, ver); AddChild(_easyDraw); if (hor == CenterMode.Center) { _textX = _easyDraw.width * 0.5f; } else if (hor == CenterMode.Max) { _textX = _easyDraw.width; } if (ver == CenterMode.Center) { _textY = _easyDraw.height * 0.5f; } else if (ver == CenterMode.Max) { _textY = _easyDraw.height; } SetText(_text); }
public MeatStand(float givenX, float givenY, float givenRotation) : base(givenX, givenY, "MeatStand.png", givenRotation) { _buyMenu = new Sprite("buyScreen.png"); _buyMenu2 = new Sprite("buyScreen2.png"); _exitButton = new Sprite("exitCross.png"); _buyMenu.SetOrigin(_buyMenu.width / 2, _buyMenu.height / 2); _buyMenu.SetXY(game.width - _buyMenu.width + 150, game.height - _buyMenu.height + 150); _buyMenu2.SetOrigin(_buyMenu.width / 2, _buyMenu.height / 2); _buyMenu2.SetXY(game.width - _buyMenu.width + 150, game.height - _buyMenu.height + 150); _exitButton.SetXY(_buyMenu.x + 500, _buyMenu.y - 325); _menuShown = false; scale = 0.85f; _boughtItem = new EasyDraw(1920, 1080); _boughtItem.TextSize(16); _boughtItem.SetColor(0, 0, 0); }