Skip to content

Commit

Permalink
Start circle
Browse files Browse the repository at this point in the history
  • Loading branch information
DragonDev07 committed Nov 6, 2024
1 parent c82cdc9 commit 0260927
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion src/main/kotlin/org/rowlandhall/meepmeep/MeepMeep.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import org.rowlandhall.meepmeep.roadrunner.trajectorysequence.sequencesegment.Wa
import org.rowlandhall.meepmeep.roadrunner.ui.TrajectoryProgressSliderMaster
import java.awt.AlphaComposite
import java.awt.BasicStroke
import java.awt.Color
import java.awt.Font
import java.awt.Graphics2D
import java.awt.Image
Expand Down Expand Up @@ -759,6 +760,7 @@ constructor(private val windowX: Int, private val windowY: Int, private val fps:
val arrowHeadLength = 1.5
val arrowLinesAngle = 45.0.toRadians()
val endTrimDistance = 2.5
val startCircleRadius = 7.0

entityList.forEach { entity ->
if (entity is RoadRunnerBotEntity) {
Expand Down Expand Up @@ -810,12 +812,39 @@ constructor(private val windowX: Int, private val windowY: Int, private val fps:
g.color = entity.colorScheme.botBodyColor
g.draw(path)

// Draw starting point circle
if (i == 0) {
val startPoint =
(trajectory.start().vec() + shiftVector).toScreenCoord()

val originalStroke = g.stroke
val originalColor = g.color
g.stroke = BasicStroke(
3.0f,
BasicStroke.CAP_ROUND,
BasicStroke.JOIN_ROUND
)
g.color = Color(34,139,34)

g.drawOval(
(startPoint.x - startCircleRadius).toInt(),
(startPoint.y - startCircleRadius).toInt(),
(startCircleRadius * 2).toInt(),
(startCircleRadius * 2).toInt()
)

g.stroke = originalStroke
g.color = originalColor
}



// Calculate & draw arrow endpoints
lastDrawnPoint?.let { lastPoint ->
val secondToLastPoint = trajectory.path[pathLength - endTrimDistance - 0.1].vec() + shiftVector
val directionVector = lastPoint - secondToLastPoint
val pathHeading = atan2(directionVector.y, directionVector.x)

// Calculate arrow endpoints
val screenArrowEndVec1 = (lastPoint + Vector2d(
arrowHeadLength,
Expand Down

0 comments on commit 0260927

Please sign in to comment.