Exemplo n.º 1
0
        /// <summary>
        ///     This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(_background);

            // TODO: Add your drawing code here
            if (_nuklearContext.BeginTitled("demo2", "demo2", new RectangleF(50, 50, 200, 200),
                                            Nuklear.NK_WINDOW_BORDER | Nuklear.NK_WINDOW_MOVABLE | Nuklear.NK_WINDOW_SCALABLE |
                                            Nuklear.NK_WINDOW_MINIMIZABLE | Nuklear.NK_WINDOW_TITLE))
            {
                _nuklearContext.LayoutRowStatic(30, 80, 1);
                _nuklearContext.LayoutRowDynamic(30, 1);
                _nuklearContext.ButtonText("Button");
                _nuklearContext.LayoutRowDynamic(30, 2);
                if (_nuklearContext.OptionLabel("Tea", _isTea))
                {
                    _isTea = true;
                }

                if (_nuklearContext.OptionLabel("Coffee", !_isTea))
                {
                    _isTea = false;
                }

                _nuklearContext.ButtonColor(Color.Red);
                _nuklearContext.LayoutRowDynamic(30, 1);
                _nuklearContext.LayoutRowDynamic(30, 2);
                _nuklearContext.LabelColored("background", nk_text_align.NK_TEXT_LEFT, _background);

                if (_nuklearContext.ComboBeginColor(_background, new Vector2(_nuklearContext.WidgetWidth(), 400)))
                {
                    _nuklearContext.LayoutRowDynamic(120, 1);
                    _background = _nuklearContext.ColorPicker(_background.ToColorf(), 0).ToColor();
                    _nuklearContext.LayoutRowDynamic(25, 1);
                    _background.R = (byte)_nuklearContext.Propertyi("#R", 0, _background.R, 255, 1, 1);
                    _background.G = (byte)_nuklearContext.Propertyi("#G", 0, _background.G, 255, 1, 1);
                    _background.B = (byte)_nuklearContext.Propertyi("#B", 0, _background.B, 255, 1, 1);
                    _background.A = (byte)_nuklearContext.Propertyi("#A", 0, _background.A, 255, 1, 1);
                    _nuklearContext.ComboEnd();
                }

                _nuklearContext.LayoutRowDynamic(30, 1);
                _nuklearContext.LabelColored("Native Allocations: " + NativeMemory.Allocations, nk_text_align.NK_TEXT_LEFT, _background);
            }

            _nuklearContext.End();

            _nuklearContext.Draw();

            _perfGraph.Update(gameTime.ElapsedGameTime.TotalSeconds);

            _nvgContext.BeginFrame(_graphics.PreferredBackBufferWidth, _graphics.PreferredBackBufferHeight, 1.0f);
            _perfGraph.Render(_nvgContext, 5, 5);
            _nvgContext.EndFrame();

            /*			_spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied);
             * _spriteBatch.Draw(_nuklearContext.Textures[0], Vector2.Zero, Color.White);
             * _spriteBatch.End();*/

            base.Draw(gameTime);
        }
Exemplo n.º 2
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(_background);

            // TODO: Add your drawing code here
            if (_nuklearContext.BeginTitled("demo2", "demo2", new Rectangle(50, 50, 200, 200),
                                            Nuklear.NK_WINDOW_BORDER | Nuklear.NK_WINDOW_MOVABLE | Nuklear.NK_WINDOW_SCALABLE |
                                            Nuklear.NK_WINDOW_MINIMIZABLE | Nuklear.NK_WINDOW_TITLE))
            {
                _nuklearContext.LayoutRowStatic(30, 80, 1);
                _nuklearContext.LayoutRowDynamic(30, 1);
                _nuklearContext.ButtonText("Button");
                _nuklearContext.LayoutRowDynamic(30, 2);
                if (_nuklearContext.OptionLabel("Tea", _isTea))
                {
                    _isTea = true;
                }

                if (_nuklearContext.OptionLabel("Coffee", !_isTea))
                {
                    _isTea = false;
                }

                _nuklearContext.ButtonColor(Color.Red);
                _nuklearContext.LayoutRowDynamic(30, 1);
                _nuklearContext.LayoutRowDynamic(30, 2);
                _nuklearContext.LabelColored("background", Nuklear.NK_TEXT_LEFT, _background);

                if (_nuklearContext.ComboBeginColor(_background, new Vector2(_nuklearContext.WidgetWidth(), 400)))
                {
                    _nuklearContext.LayoutRowDynamic(120, 1);
                    _background = _nuklearContext.ColorPicker(_background, 0);
                    _nuklearContext.LayoutRowDynamic(25, 1);
                    _background.R = (byte)_nuklearContext.Propertyi("#R", 0, _background.R, 255, 1, 1);
                    _background.G = (byte)_nuklearContext.Propertyi("#G", 0, _background.G, 255, 1, 1);
                    _background.B = (byte)_nuklearContext.Propertyi("#B", 0, _background.B, 255, 1, 1);
                    _background.A = (byte)_nuklearContext.Propertyi("#A", 0, _background.A, 255, 1, 1);
                    _nuklearContext.ComboEnd();
                }

                _nuklearContext.LayoutRowDynamic(30, 1);
                _nuklearContext.LabelColored("Sichem Allocated: " + Pointer.AllocatedTotal, Nuklear.NK_TEXT_LEFT, _background);
            }
            _nuklearContext.End();

            _nuklearContext.Draw();

/*			_spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied);
 *                      _spriteBatch.Draw(_nuklearContext.Textures[0], Vector2.Zero, Color.White);
 *                      _spriteBatch.End();*/

            base.Draw(gameTime);
        }