public override void Start() { _margin = 15; _background = GraphicsHelper.CreateGradiantTexture(Color.LightSteelBlue, Color.Linen, Screen.VirtualWidth, Screen.VirtualHeight); _backgroundRect = new Rectangle(0, 0, Screen.VirtualWidth, Screen.VirtualHeight); var tempVec2 = GUI.Skin.Font.MeasureString("C3DE Demos"); _titleSize = 2.5f; _titleRect = new Vector2(Screen.VirtualWidthPerTwo - tempVec2.X * _titleSize / 2, tempVec2.Y + 5); tempVec2 = GUI.Skin.Font.MeasureString("Gets the source : https://github.com/demonixis/C3DE"); _footerRect = new Vector2(Screen.VirtualWidthPerTwo - tempVec2.X / 2, Screen.VirtualHeight - tempVec2.Y - 5); _demos = new DemoWidget[Application.SceneManager.Count - 1]; for (int i = 0; i < _demos.Length; i++) { _demos[i] = new DemoWidget(Application.SceneManager[i + 1].Name, i + 1); } float x = Screen.VirtualWidthPerTwo - ButtonWidth / 2; float y = Screen.VirtualHeightPerTwo - ((ButtonHeight + _margin) * _demos.Length) / 2; for (int i = 0; i < _demos.Length; i++) { _demos[i].SetPosition(x, y + i * (ButtonHeight + _margin)); } }
public void Generate() { var skyTop = GraphicsHelper.CreateTexture(new Color(168, 189, 255), 64, 64); var skySide = GraphicsHelper.CreateGradiantTexture(new Color(168, 189, 255), Color.White, 64, 64); var skyBottom = GraphicsHelper.CreateTexture(Color.White, 64, 64); Generate(Application.GraphicsDevice, Application.Content, new Texture2D[] { skySide, skySide, skyTop, skyBottom, skySide, skySide }, 1000.0f); }
public override void Start() { _check1Result = true; _check2Result = false; _slider1Value = 20; _slider2Value = 0.8f; _slider3Value = 0.45f; _text1Value = "Welcome to the Graphics User Interface module"; _text2Value = "This is a label which you can use to display informations.\nIt's multiline you just have to use the '\\n' character."; _background = GraphicsHelper.CreateGradiantTexture(Color.LightSkyBlue, Color.LightSteelBlue, 64, 64); _backgroundRect = Screen.VirtualScreenRect; var width = 600; var height = 390; _boxRect = new Rectangle(Screen.VirtualWidthPerTwo - width / 2, Screen.VirtualHeightPerTwo - (height >> 1), width, height); var temp1 = GUI.Skin.Font.MeasureString(_text1Value); var temp2 = GUI.Skin.Font.MeasureString(_text2Value); var margin = _boxRect.X + 50; _text1Position = new Vector2(margin, _boxRect.Y + 50); _text2Position = new Vector2(margin, _text1Position.Y + temp1.Y + 30); _check1Rect = new Rectangle(margin, (int)(_text2Position.Y + temp2.Y + 20), 300, 30); _check2Rect = new Rectangle(margin, _check1Rect.Bottom + 10, 300, 30); _slider1Rect = new Rectangle(margin, _check2Rect.Bottom + 20, 250, 30); _slider2Rect = new Rectangle(margin, _slider1Rect.Bottom + 10, 250, 30); _text3Position = new Vector2(_slider1Rect.Right + 10, _slider1Rect.Y); _text4Position = new Vector2(_slider2Rect.Right + 10, _slider2Rect.Y); _slider3Rect = new Rectangle(_boxRect.Right - 35, _boxRect.Y + (_boxRect.Height >> 1) - (350 >> 1), 30, 350); _btn1Rect = new Rectangle(_boxRect.X, _boxRect.Bottom + 10, 150, 45); _btn2Rect = new Rectangle(_boxRect.Right - 150, _boxRect.Bottom + 10, 150, 45); }
public void LoadContent(ContentManager content) { Box = GraphicsHelper.CreateBorderTexture(Color.White, new Color(0.08f, 0.12f, 0.16f, 0.7f), 128, 128, 1); Border = GraphicsHelper.CreateBorderTexture(Color.White, new Color(0.08f, 0.12f, 0.16f, 0.7f), 128, 128, 1); Buttons[0] = GraphicsHelper.CreateBorderTexture(Color.White, new Color(0.08f, 0.12f, 0.16f, 0.7f), 128, 48, 1); Buttons[1] = GraphicsHelper.CreateBorderTexture(Color.WhiteSmoke, new Color(0.16f, 0.19f, 0.23f, 0.7f), 128, 48, 1); Buttons[2] = GraphicsHelper.CreateBorderTexture(Color.LightGray, new Color(0.19f, 0.23f, 0.27f, 0.7f), 128, 48, 1); Checkbox[0] = GraphicsHelper.CreateBorderTexture(Color.White, new Color(0.08f, 0.12f, 0.16f, 0.7f), 48, 48, 2); Checkbox[1] = GraphicsHelper.CreateTexture(Color.DarkGray, 1, 1); Checkbox[2] = GraphicsHelper.CreateTexture(Color.White, 1, 1); Sliders[0] = GraphicsHelper.CreateTexture(new Color(0.08f, 0.12f, 0.16f, 0.7f), 1, 1); Sliders[1] = GraphicsHelper.CreateGradiantTexture(Color.LightBlue, Color.CadetBlue, 16, 16); if (!string.IsNullOrEmpty(_fontName)) { Font = content.Load <SpriteFont>(_fontName); } }
public override Texture2D GetTexture(Rectangle rectangle) { return(GraphicsHelper.CreateGradiantTexture(GameManager.GraphicsDeviceManager.GraphicsDevice, ColorA, ColorB, rectangle.Width + rectangle.Y, rectangle.Height + rectangle.X)); }