Add backward distance in camera setting gui
This commit is contained in:
parent
d9d665f45f
commit
5d5f01b4b5
@ -55,6 +55,15 @@
|
||||
|
||||
<spacer height="2%" width="100%" />
|
||||
|
||||
<div width="100%" height="fit" layout="horizontal-row">
|
||||
<spacer width="3%" height="100%" />
|
||||
<div proportion="1" height="fit" layout="horizontal-row" >
|
||||
<label width="20%" height="100%" text_align="left" I18N="In the ui/camera screen" text="Distance"/>
|
||||
<gauge id="backward_camera_distance" proportion="1"/>
|
||||
</div>
|
||||
</div>
|
||||
<spacer height="2%" width="100%" />
|
||||
|
||||
|
||||
<div width="100%" height="fit" layout="horizontal-row">
|
||||
<spacer width="3%" height="100%" />
|
||||
|
@ -958,6 +958,11 @@ namespace UserConfigParams
|
||||
&m_camera_normal,
|
||||
"if true, use smoothing (forward-up-angle become relative to speed) when pointing forward"));
|
||||
|
||||
PARAM_PREFIX FloatUserConfigParam m_camera_backward_distance
|
||||
PARAM_DEFAULT( FloatUserConfigParam(2.0, "backward-distance",
|
||||
&m_camera_normal,
|
||||
"Distance between kart and camera (reverse)"));
|
||||
|
||||
PARAM_PREFIX FloatUserConfigParam m_camera_backward_up_angle
|
||||
PARAM_DEFAULT( FloatUserConfigParam(5, "backward-up-angle",
|
||||
&m_camera_normal,
|
||||
@ -998,6 +1003,11 @@ namespace UserConfigParams
|
||||
&m_standard_camera_settings,
|
||||
"if true, use smoothing (forward-up-angle become relative to speed) when pointing forward"));
|
||||
|
||||
PARAM_PREFIX FloatUserConfigParam m_standard_camera_backward_distance
|
||||
PARAM_DEFAULT( FloatUserConfigParam(2.0, "backward-distance",
|
||||
&m_standard_camera_settings,
|
||||
"Distance between kart and camera (reverse)"));
|
||||
|
||||
PARAM_PREFIX FloatUserConfigParam m_standard_camera_backward_up_angle
|
||||
PARAM_DEFAULT( FloatUserConfigParam(5, "backward-up-angle",
|
||||
&m_standard_camera_settings,
|
||||
@ -1034,6 +1044,11 @@ namespace UserConfigParams
|
||||
&m_drone_camera_settings,
|
||||
"if true, use smoothing (forward-up-angle become relative to speed) when pointing forward"));
|
||||
|
||||
PARAM_PREFIX FloatUserConfigParam m_drone_camera_backward_distance
|
||||
PARAM_DEFAULT( FloatUserConfigParam(2.0, "backward-distance",
|
||||
&m_drone_camera_settings,
|
||||
"Distance between kart and camera (reverse)"));
|
||||
|
||||
PARAM_PREFIX FloatUserConfigParam m_drone_camera_backward_up_angle
|
||||
PARAM_DEFAULT( FloatUserConfigParam(10, "backward-up-angle",
|
||||
&m_drone_camera_settings,
|
||||
@ -1070,6 +1085,11 @@ namespace UserConfigParams
|
||||
&m_saved_camera_settings,
|
||||
"if true, use smoothing (forward-up-angle become relative to speed) when pointing forward"));
|
||||
|
||||
PARAM_PREFIX FloatUserConfigParam m_saved_camera_backward_distance
|
||||
PARAM_DEFAULT( FloatUserConfigParam(2.0, "backward-distance",
|
||||
&m_saved_camera_settings,
|
||||
"Distance between kart and camera (reverse)"));
|
||||
|
||||
PARAM_PREFIX FloatUserConfigParam m_saved_camera_backward_up_angle
|
||||
PARAM_DEFAULT( FloatUserConfigParam(5, "backward-up-angle",
|
||||
&m_saved_camera_settings,
|
||||
|
@ -223,7 +223,7 @@ void CameraNormal::getCameraSettings(float *above_kart, float *cam_angle,
|
||||
*above_kart = 0.75f;
|
||||
*cam_angle = UserConfigParams::m_camera_backward_up_angle * DEGREE_TO_RAD;
|
||||
*sideway = 0;
|
||||
*distance = 2.0f*m_distance;
|
||||
*distance = UserConfigParams::m_camera_backward_distance;
|
||||
*smoothing = false;
|
||||
*cam_roll_angle = 0.0f;
|
||||
if (UserConfigParams::m_multitouch_controls == MULTITOUCH_CONTROLS_GYROSCOPE)
|
||||
|
@ -104,7 +104,7 @@ SpinnerWidget::SpinnerWidget(const bool gauge) : Widget(WTYPE_SPINNER)
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
void SpinnerWidget::setRange(int min, int max, float step)
|
||||
void SpinnerWidget::setRange(float min, float max, float step)
|
||||
{
|
||||
clearLabels();
|
||||
setStep(step);
|
||||
|
@ -266,7 +266,7 @@ namespace GUIEngine
|
||||
const core::stringw& getCustomText() const { return m_custom_text; }
|
||||
|
||||
/* Set a spinner with numeric values min <= i <= max, with a precision of defined by step */
|
||||
void setRange(int min, int max, float step);
|
||||
void setRange(float min, float max, float step);
|
||||
void setRange(int min, int max) { setRange(min, max, 1.0); }
|
||||
|
||||
void onPressed(int x, int y);
|
||||
|
@ -58,15 +58,17 @@ void CustomCameraSettingsDialog::beforeAddingWidgets()
|
||||
{
|
||||
#ifndef SERVER_ONLY
|
||||
getWidget<SpinnerWidget>("fov")->setRange(75, 115);
|
||||
getWidget<SpinnerWidget>("camera_distance")->setRange(0 , 20, 0.1);
|
||||
getWidget<SpinnerWidget>("camera_angle")->setRange(0 , 45);
|
||||
getWidget<SpinnerWidget>("backward_camera_angle")->setRange(0 , 45);
|
||||
getWidget<SpinnerWidget>("camera_distance")->setRange(0.05f, 20, 0.05f);
|
||||
getWidget<SpinnerWidget>("camera_angle")->setRange(0, 80);
|
||||
getWidget<SpinnerWidget>("backward_camera_distance")->setRange(0.05f, 20, 0.05f);
|
||||
getWidget<SpinnerWidget>("backward_camera_angle")->setRange(0, 80);
|
||||
if (UserConfigParams::m_camera_present == 1) // Standard camera
|
||||
{
|
||||
getWidget<LabelWidget>("camera_name")->setText(_("Standard"), false);
|
||||
getWidget<SpinnerWidget>("fov")->setValue(UserConfigParams::m_standard_camera_fov);
|
||||
getWidget<SpinnerWidget>("camera_distance")->setFloatValue(UserConfigParams::m_standard_camera_distance);
|
||||
getWidget<SpinnerWidget>("camera_angle")->setValue(UserConfigParams::m_standard_camera_forward_up_angle);
|
||||
getWidget<SpinnerWidget>("backward_camera_distance")->setFloatValue(UserConfigParams::m_standard_camera_backward_distance);
|
||||
getWidget<SpinnerWidget>("backward_camera_angle")->setValue(UserConfigParams::m_standard_camera_backward_up_angle);
|
||||
getWidget<CheckBoxWidget>("camera_smoothing")->setState(UserConfigParams::m_standard_camera_forward_smoothing);
|
||||
getWidget<CheckBoxWidget>("use_soccer_camera")->setState(UserConfigParams::m_standard_reverse_look_use_soccer_cam);
|
||||
@ -74,6 +76,7 @@ void CustomCameraSettingsDialog::beforeAddingWidgets()
|
||||
getWidget<SpinnerWidget>("fov")->setActive(false);
|
||||
getWidget<SpinnerWidget>("camera_distance")->setActive(false);
|
||||
getWidget<SpinnerWidget>("camera_angle")->setActive(false);
|
||||
getWidget<SpinnerWidget>("backward_camera_distance")->setActive(false);
|
||||
getWidget<SpinnerWidget>("backward_camera_angle")->setActive(false);
|
||||
}
|
||||
else if (UserConfigParams::m_camera_present == 2) // Drone chase camera
|
||||
@ -82,6 +85,7 @@ void CustomCameraSettingsDialog::beforeAddingWidgets()
|
||||
getWidget<SpinnerWidget>("fov")->setValue(UserConfigParams::m_drone_camera_fov);
|
||||
getWidget<SpinnerWidget>("camera_distance")->setFloatValue(UserConfigParams::m_drone_camera_distance);
|
||||
getWidget<SpinnerWidget>("camera_angle")->setValue(UserConfigParams::m_drone_camera_forward_up_angle);
|
||||
getWidget<SpinnerWidget>("backward_camera_distance")->setFloatValue(UserConfigParams::m_drone_camera_backward_distance);
|
||||
getWidget<SpinnerWidget>("backward_camera_angle")->setValue(UserConfigParams::m_drone_camera_backward_up_angle);
|
||||
getWidget<CheckBoxWidget>("camera_smoothing")->setState(UserConfigParams::m_drone_camera_forward_smoothing);
|
||||
getWidget<CheckBoxWidget>("use_soccer_camera")->setState(UserConfigParams::m_drone_reverse_look_use_soccer_cam);
|
||||
@ -89,6 +93,7 @@ void CustomCameraSettingsDialog::beforeAddingWidgets()
|
||||
getWidget<SpinnerWidget>("fov")->setActive(false);
|
||||
getWidget<SpinnerWidget>("camera_distance")->setActive(false);
|
||||
getWidget<SpinnerWidget>("camera_angle")->setActive(false);
|
||||
getWidget<SpinnerWidget>("backward_camera_distance")->setActive(false);
|
||||
getWidget<SpinnerWidget>("backward_camera_angle")->setActive(false);
|
||||
}
|
||||
else // Custom camera
|
||||
@ -98,6 +103,7 @@ void CustomCameraSettingsDialog::beforeAddingWidgets()
|
||||
getWidget<SpinnerWidget>("camera_distance")->setFloatValue(UserConfigParams::m_saved_camera_distance);
|
||||
getWidget<SpinnerWidget>("camera_angle")->setValue(UserConfigParams::m_saved_camera_forward_up_angle);
|
||||
getWidget<CheckBoxWidget>("camera_smoothing")->setState(UserConfigParams::m_saved_camera_forward_smoothing);
|
||||
getWidget<SpinnerWidget>("backward_camera_distance")->setFloatValue(UserConfigParams::m_saved_camera_backward_distance);
|
||||
getWidget<SpinnerWidget>("backward_camera_angle")->setValue(UserConfigParams::m_saved_camera_backward_up_angle);
|
||||
getWidget<CheckBoxWidget>("use_soccer_camera")->setState(UserConfigParams::m_saved_reverse_look_use_soccer_cam);
|
||||
}
|
||||
@ -129,11 +135,13 @@ GUIEngine::EventPropagation CustomCameraSettingsDialog::processEvent(const std::
|
||||
UserConfigParams::m_camera_fov = getWidget<SpinnerWidget>("fov")->getValue();
|
||||
UserConfigParams::m_camera_distance = getWidget<SpinnerWidget>("camera_distance")->getFloatValue();
|
||||
UserConfigParams::m_camera_forward_up_angle = getWidget<SpinnerWidget>("camera_angle")->getValue();
|
||||
UserConfigParams::m_camera_backward_distance = getWidget<SpinnerWidget>("backward_camera_distance")->getFloatValue();
|
||||
UserConfigParams::m_camera_backward_up_angle = getWidget<SpinnerWidget>("backward_camera_angle")->getValue();
|
||||
UserConfigParams::m_saved_camera_fov = UserConfigParams::m_camera_fov;
|
||||
UserConfigParams::m_saved_camera_distance = UserConfigParams::m_camera_distance;
|
||||
UserConfigParams::m_saved_camera_forward_up_angle = UserConfigParams::m_camera_forward_up_angle;
|
||||
UserConfigParams::m_saved_camera_forward_smoothing = UserConfigParams::m_camera_forward_smoothing;
|
||||
UserConfigParams::m_saved_camera_backward_distance = UserConfigParams::m_camera_backward_distance;
|
||||
UserConfigParams::m_saved_camera_backward_up_angle = UserConfigParams::m_camera_backward_up_angle;
|
||||
UserConfigParams::m_saved_reverse_look_use_soccer_cam = UserConfigParams::m_reverse_look_use_soccer_cam;
|
||||
}
|
||||
@ -159,6 +167,7 @@ GUIEngine::EventPropagation CustomCameraSettingsDialog::processEvent(const std::
|
||||
getWidget<SpinnerWidget>("camera_distance")->setFloatValue(UserConfigParams::m_saved_camera_distance);
|
||||
getWidget<SpinnerWidget>("camera_angle")->setValue(UserConfigParams::m_saved_camera_forward_up_angle);
|
||||
getWidget<CheckBoxWidget>("camera_smoothing")->setState(UserConfigParams::m_saved_camera_forward_smoothing);
|
||||
getWidget<SpinnerWidget>("backward_camera_distance")->setFloatValue(UserConfigParams::m_saved_camera_backward_distance);
|
||||
getWidget<SpinnerWidget>("backward_camera_angle")->setValue(UserConfigParams::m_saved_camera_backward_up_angle);
|
||||
getWidget<CheckBoxWidget>("use_soccer_camera")->setState(UserConfigParams::m_saved_reverse_look_use_soccer_cam);
|
||||
}
|
||||
|
@ -520,6 +520,7 @@ void OptionsScreenUI::eventCallback(Widget* widget, const std::string& name, con
|
||||
UserConfigParams::m_camera_distance = UserConfigParams::m_standard_camera_distance;
|
||||
UserConfigParams::m_camera_forward_up_angle = UserConfigParams::m_standard_camera_forward_up_angle;
|
||||
UserConfigParams::m_camera_forward_smoothing = UserConfigParams::m_standard_camera_forward_smoothing;
|
||||
UserConfigParams::m_camera_backward_distance = UserConfigParams::m_standard_camera_backward_distance;
|
||||
UserConfigParams::m_camera_backward_up_angle = UserConfigParams::m_standard_camera_backward_up_angle;
|
||||
UserConfigParams::m_reverse_look_use_soccer_cam = UserConfigParams::m_standard_reverse_look_use_soccer_cam;
|
||||
}
|
||||
@ -529,6 +530,7 @@ void OptionsScreenUI::eventCallback(Widget* widget, const std::string& name, con
|
||||
UserConfigParams::m_camera_distance = UserConfigParams::m_drone_camera_distance;
|
||||
UserConfigParams::m_camera_forward_up_angle = UserConfigParams::m_drone_camera_forward_up_angle;
|
||||
UserConfigParams::m_camera_forward_smoothing = UserConfigParams::m_drone_camera_forward_smoothing;
|
||||
UserConfigParams::m_camera_backward_distance = UserConfigParams::m_drone_camera_backward_distance;
|
||||
UserConfigParams::m_camera_backward_up_angle = UserConfigParams::m_drone_camera_backward_up_angle;
|
||||
UserConfigParams::m_reverse_look_use_soccer_cam = UserConfigParams::m_drone_reverse_look_use_soccer_cam;
|
||||
}
|
||||
@ -538,6 +540,7 @@ void OptionsScreenUI::eventCallback(Widget* widget, const std::string& name, con
|
||||
UserConfigParams::m_camera_distance = UserConfigParams::m_saved_camera_distance;
|
||||
UserConfigParams::m_camera_forward_up_angle = UserConfigParams::m_saved_camera_forward_up_angle;
|
||||
UserConfigParams::m_camera_forward_smoothing = UserConfigParams::m_saved_camera_forward_smoothing;
|
||||
UserConfigParams::m_camera_backward_distance = UserConfigParams::m_saved_camera_backward_distance;
|
||||
UserConfigParams::m_camera_backward_up_angle = UserConfigParams::m_saved_camera_backward_up_angle;
|
||||
UserConfigParams::m_reverse_look_use_soccer_cam = UserConfigParams::m_saved_reverse_look_use_soccer_cam;
|
||||
}
|
||||
|
@ -26,17 +26,6 @@
|
||||
|
||||
namespace GUIEngine { class Widget; }
|
||||
|
||||
struct CameraPreset
|
||||
{
|
||||
int fov;
|
||||
float distance;
|
||||
float angle;
|
||||
bool smoothing;
|
||||
float backward_angle;
|
||||
};
|
||||
|
||||
struct Input;
|
||||
|
||||
/**
|
||||
* \brief Graphics options screen
|
||||
* \ingroup states_screens
|
||||
@ -54,8 +43,6 @@ class OptionsScreenUI : public GUIEngine::Screen, public GUIEngine::ScreenSingle
|
||||
OptionsScreenUI();
|
||||
bool m_inited;
|
||||
|
||||
std::vector<CameraPreset> m_camera_presets;
|
||||
|
||||
std::map<core::stringw, std::string> m_skins;
|
||||
|
||||
void updateCamera();
|
||||
|
Loading…
Reference in New Issue
Block a user