Exemple #1
0
        public override void InternalRender(RenderContext context)
        {
            base.InternalRender(context);

            if (_filler == null)
            {
                return;
            }

            var v = _value;

            if (v < Minimum)
            {
                v = Minimum;
            }

            if (v > Maximum)
            {
                v = Maximum;
            }

            var delta = Maximum - Minimum;

            if (delta.IsZero())
            {
                return;
            }

            var filledPart = (v - Minimum) / delta;

            if (filledPart.EpsilonEquals(0.0f))
            {
                return;
            }

            var bounds = ActualBounds;

            if (Orientation == Orientation.Horizontal)
            {
                _filler.Draw(context.Batch,
                             new Rectangle(bounds.X, bounds.Y, (int)(filledPart * bounds.Width), bounds.Height),
                             Color.White);
            }
            else
            {
                _filler.Draw(context.Batch,
                             new Rectangle(bounds.X, bounds.Y, bounds.Width, (int)(filledPart * bounds.Height)),
                             Color.White);
            }
        }
Exemple #2
0
        private void DrawIfNotNull(IRenderable skyPart, WSceneView view)
        {
            if (skyPart == null)
            {
                return;
            }

            skyPart.Draw(view);
        }
Exemple #3
0
        public void Render(Camera camera, IRenderable renderable)
        {
            var viewport = camera.Viewport;

            Gl.Viewport(viewport.X, viewport.Y, viewport.Width, viewport.Height);

            if (camera.IsVisible(renderable))
            {
                renderable.Draw(camera);
            }
        }
Exemple #4
0
        public override void Update(GameTime gameTime)
        {
            if (Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }

            AllScenes[ActiveScene].update(gameTime);

            render.Draw(AllScenes[ActiveScene], sprt);

            base.Update(gameTime);
        }
Exemple #5
0
        private void Render()
        {
            if (Device == null) // If the device is empty don't bother rendering
            {
                return;
            }

            Device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, System.Drawing.Color.Blue, 1.0f, 0); // Clear the window to blue
            Device.BeginScene();

            // Move Camera
            cam.move();
            SetupMatrices();

            // Draw Model
            model.Draw(Device);

            // UI
            //Panel.Render(Device);

            Device.EndScene();
            Device.Present();
        }
Exemple #6
0
 public void Draw(SpriteBatch spriteBatch)
 {
     Sprite.Draw(spriteBatch, MapCoordinates * GameDriver.CellSize);
 }
Exemple #7
0
        /// <summary>
        /// Draws texture region taking into account the context transformations
        /// </summary>
        /// <param name="renderable"></param>
        /// <param name="rectangle"></param>
        /// <param name="color"></param>
        public void Draw(IRenderable renderable, Point location, Color?color = null)
        {
            var c = color != null ? color.Value : Color.White;

            renderable.Draw(Batch, new Rectangle(location.X, location.Y, renderable.Size.X, renderable.Size.Y), c * Opacity);
        }
Exemple #8
0
        /// <summary>
        /// Draws texture region taking into account the context transformations
        /// </summary>
        /// <param name="renderable"></param>
        /// <param name="rectangle"></param>
        /// <param name="color"></param>
        public void Draw(IRenderable renderable, Rectangle rectangle, Color?color = null)
        {
            var c = color != null ? color.Value : Color.White;

            renderable.Draw(Batch, rectangle, c * Opacity);
        }
Exemple #9
0
 public void Draw(IRenderable renderable, GameTime gt)
 {
     renderable.Draw(gt);
 }