Пример #1
0
        public void Draw(float length)
        {
            if (this.pointOfLine.isNullPoint())//is it possible???
            {
                return;
            }

            if (OnDrawStart != null)
            {
                if (!OnDrawStart.Invoke(this))
                {
                    return;
                }
            }

            if (OnDrawing != null)
            {
                OnDrawing.Invoke(this);
            }

            float ratio = 2 * length / this.DirectVector.Length;

            Gl.glBegin(Gl.GL_LINES);
            Gl.glVertex2f(this.pointOfLine.X - ratio * this.DirectVector.deltaX, this.pointOfLine.Y - ratio * this.DirectVector.deltaY);
            Gl.glVertex2f(this.pointOfLine.X + ratio * this.DirectVector.deltaX, this.pointOfLine.Y + ratio * this.DirectVector.deltaY);
            Gl.glEnd();

            if (OnDrawed != null)
            {
                OnDrawed.Invoke(this);
            }
        }
Пример #2
0
 private bool ActivateDrawStart()
 {
     if (OnDrawStart == null)
     {
         return(true);
     }
     return(OnDrawStart.Invoke(this));
 }
Пример #3
0
        public override void Draw(Matrix view, Matrix projection, GameTime gameTime)
        {
            graphicsDevice.SetRenderTargets(depth, diffuse, normalMap, lightMap);

            clearEffect.Parameters["Ambient"].SetValue(Ambient);
            spritebatch.Begin(effect: clearEffect);
            spritebatch.Draw(clearTexture, new Rectangle(0, 0, graphicsDevice.Viewport.Width, graphicsDevice.Viewport.Height), Color.White);
            spritebatch.End();

            OnDrawStart?.Invoke();

            lastMaterial  = null;
            currentEffect = null;
            foreach (var entity in scene.Entities)
            {
                DrawEntityRecursive(view, projection, entity, gameTime);
            }


            base.Draw(view, projection, gameTime);
        }
Пример #4
0
 void OnTouchStart(Vector2 touchPosition)
 {
     Line.RemoveAll();
     IsDrawing = true;
     OnDrawStart.SafeInvoke();
 }