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); } }
private bool ActivateDrawStart() { if (OnDrawStart == null) { return(true); } return(OnDrawStart.Invoke(this)); }
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); }
void OnTouchStart(Vector2 touchPosition) { Line.RemoveAll(); IsDrawing = true; OnDrawStart.SafeInvoke(); }