File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -71,11 +71,7 @@ void Game::Update(GLFWwindow* window)
7171
7272 TrailPart currentTrail = TrailPart (xpos, ypos, g_config.fadeTime );
7373
74- // Add the current cursor position to trail
75- this ->AddPart (currentTrail);
76-
77- // interpolate trail
78-
74+ // Calculate previous index BEFORE adding current trail
7975 int prevIndex;
8076 if (this ->currentIndex != 0 ) {
8177 prevIndex = this ->currentIndex - 1 ;
@@ -84,6 +80,11 @@ void Game::Update(GLFWwindow* window)
8480 prevIndex = g_config.maxParticles - 1 ;
8581 }
8682
83+ // Add the current cursor position to trail
84+ this ->AddPart (currentTrail);
85+
86+ // interpolate trail
87+
8788 TrailPart previousTrail = this ->parts [prevIndex];
8889
8990 glm::vec2 pos1 = glm::vec2 (previousTrail.x , previousTrail.y );
Original file line number Diff line number Diff line change @@ -164,11 +164,13 @@ void WindowsOverlay::Update()
164164 if (GetCursorPos (&cursorPos)) {
165165 TrailPart currentTrail (static_cast <float >(cursorPos.x ), static_cast <float >(cursorPos.y ), g_config.fadeTime );
166166
167+ // Calculate previous index BEFORE adding current trail
168+ size_t prevIndex = (m_currentIndex == 0 ) ? m_trailParts.size () - 1 : m_currentIndex - 1 ;
169+
167170 // Add the current cursor position to trail (match OpenGL version exactly)
168171 AddTrailPart (currentTrail);
169172
170173 // Interpolate trail between current and previous position ONLY (like OpenGL Game.cpp)
171- size_t prevIndex = (m_currentIndex == 0 ) ? m_trailParts.size () - 1 : m_currentIndex - 1 ;
172174 const TrailPart& previousTrail = m_trailParts[prevIndex];
173175
174176 float dx = currentTrail.x - previousTrail.x ;
You can’t perform that action at this time.
0 commit comments