protected virtual void RenderArrow(Vec2d pos, Vec2d arrow, double distance, double arrlen, Color4 col) { Vec2d end = pos + arrow; Vec2d smallArr = new Vec2d(arrow); smallArr.SetLength(smallArr.GetLength() - arrlen); Vec2d rot1 = pos + smallArr; Vec2d rot2 = pos + smallArr; rot1.rotateAround(end, Math.PI / 6); rot2.rotateAround(end, -Math.PI / 6); GL.Begin(BeginMode.LineStrip); GL.Color4(col); GL.Vertex3(pos.X, pos.Y, distance); GL.Vertex3(end.X, end.Y, distance); GL.Vertex3(rot1.X, rot1.Y, distance); GL.Vertex3(end.X, end.Y, distance); GL.Vertex3(rot2.X, rot2.Y, distance); GL.Color3(1.0, 1.0, 1.0); GL.End(); }
public void Calculate(Rect2d target, int window_width, int window_height, double mapW, double mapH, bool moveDown, bool capCorrection = true) { Rect2d cameraBox = GetOffsetBox(window_width, window_height); Vec2d playerPos = target.GetMiddle(); // Wenn man aus der Mittleren Box rausläuft - Offset Verschieben //############################################################################### Vec2d moveCorrection = cameraBox.GetDistanceTo(playerPos); if (moveDown && moveCorrection.Y == 0 && playerPos.Y != cameraBox.tl.Y) { moveCorrection.Y -= 5; } // Offset NICHT verschieben wenn amn damit die Grenzen der aktuellen Zone verletzten Würde //############################################################################### Vec2d zoneCorrection = GetVisionZoneCorrection(Value + moveCorrection, playerPos, window_width, window_height); Vec2d realCorrection = moveCorrection + zoneCorrection; if (capCorrection) { realCorrection.DoMaxLength(MAX_CORRECTION_SPEED); } if (realCorrection.GetLength() < 0.001) { realCorrection = Vec2d.Zero; } Value += realCorrection; }