| 215 | |
| 216 | void SDLInput_BufferMouseWheel(float dy) |
| 217 | { |
| 218 | GInput.mouse.BufferWheel(dy); |
| 219 | } |
| 220 | |
| 221 | void ProcessMouse_SDL(DWORD timeDelta) |
| 222 | { |
| 223 | if (!GWorld->IsUserInputEnabled()) |
| 224 | { |
| 225 | GInput.mouse.DiscardBuffered(); |
| 226 | return; |
| 227 | } |
| 228 | |
| 229 | // Compute cursor clamp from aspect settings |
| 230 | MouseState::CursorClamp clamp; |
| 231 | const MouseState::CursorClamp* clampPtr = nullptr; |
| 232 | if (::Poseidon::GEngine) |
| 233 | { |
| 234 | AspectSettings as; |
| 235 | ::Poseidon::GEngine->GetAspectSettings(as); |
| 236 | float screenTopX = as.uiTopLeftX / (as.uiTopLeftX - as.uiBottomRightX); |
| 237 | float screenTopY = as.uiTopLeftY / (as.uiTopLeftY - as.uiBottomRightY); |
| 238 | float screenBotX = (1 - as.uiTopLeftX) / (as.uiBottomRightX - as.uiTopLeftX); |
| 239 | float screenBotY = (1 - as.uiTopLeftY) / (as.uiBottomRightY - as.uiTopLeftY); |
| 240 | clamp.minX = screenTopX * 2 - 1; |
| 241 | clamp.maxX = screenBotX * 2 - 1; |
| 242 | clamp.minY = screenTopY * 2 - 1; |
| 243 | clamp.maxY = screenBotY * 2 - 1; |
| 244 | clampPtr = &clamp; |
| 245 | } |
| 246 | |
| 247 | // Aiming spans the full window, so it uses the window aspect ratio |
| 248 | // (Width/Height). The cursor's coordinates are relative to the HUD region, |
| 249 | // so it uses that region's aspect ratio (Width2D/Height2D) — this keeps its |
| 250 | // speed consistent and unaffected by the HUD width limit. Both fall back to |
| 251 | // the 4:3 reference when the engine size is unavailable. |
no test coverage detected