Esempio n. 1
0
        public override void Init(Game1 game)
        {
            Color = Color.White;

            var skin = new Skin(game.GreyImageMap, game.GreyMap);
            var text = new Text(game.GreySpriteFont, Color.Black);

            //Simply subscribe to the events demonstrated below
            _gui = new Gui(game, skin, text);
            _gui.CharEntered += CharEntered;
            _gui.KeyDown += KeyDown;
            _gui.KeyUp += KeyUp;
            _gui.MouseDoubleClick += MouseDoubleClick;
            _gui.MouseDown += MouseDown;
            _gui.MouseHover += MouseHover;
            _gui.MouseUp += MouseUp;
            _gui.MouseWheel += MouseWheel;

            _gui.AddWidget(_hasMouse = new Label(100, 10 + 30 * 0, "Test1"));
            _gui.AddWidget(_charEntered = new Label(100, 10 + 30 * 1, "Test2"));
            _gui.AddWidget(_keyDown = new Label(100, 10 + 30 * 2, "Test3"));
            _gui.AddWidget(_keyUp = new Label(100, 10 + 30 * 3, "Test3"));
            _gui.AddWidget(_doubleClick = new Label(100, 10 + 30 * 4, "Test4"));
            _gui.AddWidget(_mouseDown = new Label(100, 10 + 30 * 5, "Test5"));
            _gui.AddWidget(_mouseHover = new Label(100, 10 + 30 * 6, "Test6"));
            _gui.AddWidget(_mouseUp = new Label(100, 10 + 30 * 7, "Test7"));
            _gui.AddWidget(_mouseWheel = new Label(100, 10 + 30 * 8, "Test7"));
        }
Esempio n. 2
0
        /// <summary>
        /// Ładowanie graficznych kontentów i ogolnie wszstkich
        /// </summary>
        protected override void LoadContent()
        {
            GreyImageMap = Game.Content.Load<Texture2D>("ImageMap");
                GreyMap = File.OpenText(Game.Content.RootDirectory + @"\Map.txt").ReadToEnd();
                GreySpriteFont = Game.Content.Load<SpriteFont>("font");

                var skin = new Skin(GreyImageMap, GreyMap);
                //var text = new Text(GreySpriteFont, Color.LightGray);

                TextRenderer text = new Ruminate.GUI.Framework.TextRenderer(GreySpriteFont, Color.White);
                PanelHeader = new Ruminate.GUI.Framework.Text(GreySpriteFont, Color.White);

                TextBox login = new TextBox(16, 16);
                TextBox haslo = new TextBox(8, 8);

                myGui = new Gui(this.Game, skin, text);
                myGui.AddWidget(login);

                spriteBatch = new SpriteBatch(this.GraphicsDevice);
                // ladowanie fontu z assetow
                //contentFont = Game.Content.Load<SpriteFont>("font");

                komunikat = "Zarejestruj swoje konto, aby grac";

                Vector2 wymiarKom = GreySpriteFont.MeasureString(komunikat);
                wspNaSrodek = new Vector2((GraphicsDevice.Viewport.TitleSafeArea.Width - wymiarKom.X) / 2, (GraphicsDevice.Viewport.TitleSafeArea.Height - wymiarKom.Y) / 2);

                base.LoadContent();
        }