MCPcopy Create free account
hub / github.com/Prograda/Skybolt / generateCameraInput

Method generateCameraInput

src/Skybolt/SkyboltEngine/CameraInputSystem.cpp:67–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65}
66
67void CameraInputSystem::generateCameraInput()
68{
69 sim::SecondsD dt = 0;
70 std::swap(mDtWallClock, dt);
71
72 InputDevicePtr keyboard = getFirstKeyboard(*mInputPlatform);
73
74 mInput.forwardSpeed = getAxisValueOrDefault(mAxes, CameraInputAxisType::Forward, 0.f);
75 mInput.rightSpeed = getAxisValueOrDefault(mAxes, CameraInputAxisType::Right, 0.f);
76
77 if (dt > 0)
78 {
79 mInput.yawRate /= dt;
80 mInput.tiltRate /= dt;
81 mInput.zoomRate /= dt;
82 }
83 else
84 {
85 mInput.yawRate = 0;
86 mInput.tiltRate = 0;
87 mInput.zoomRate = 0;
88 }
89
90 mInput.modifier1Pressed = keyboard ? keyboard->isButtonPressed(KC_LSHIFT) : false;
91 mInput.modifier2Pressed = keyboard ? keyboard->isButtonPressed(KC_LCONTROL) : false;
92
93 cameraInputGenerated(mInput);
94
95 mInput = sim::CameraController::Input::zero();
96}
97
98void CameraInputSystem::onEvent(const Event &evt)
99{

Callers

nothing calls this directly

Calls 3

getFirstKeyboardFunction · 0.85
getAxisValueOrDefaultFunction · 0.85
isButtonPressedMethod · 0.45

Tested by

no test coverage detected