mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 19:49:19 +02:00
Buttons for spring brake
This commit is contained in:
33
Train.cpp
33
Train.cpp
@@ -4407,12 +4407,27 @@ void TTrain::OnCommand_springbraketoggle(TTrain *Train, command_data const &Comm
|
|||||||
OnCommand_springbrakedisable(Train, Command);
|
OnCommand_springbrakedisable(Train, Command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (Command.action == GLFW_RELEASE) {
|
||||||
|
// release
|
||||||
|
// visual feedback
|
||||||
|
Train->ggSpringBrakeOffButton.UpdateValue(0.0, Train->dsbSwitch);
|
||||||
|
Train->ggSpringBrakeOnButton.UpdateValue(0.0, Train->dsbSwitch);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void TTrain::OnCommand_springbrakeenable(TTrain *Train, command_data const &Command) {
|
void TTrain::OnCommand_springbrakeenable(TTrain *Train, command_data const &Command) {
|
||||||
if (Command.action == GLFW_PRESS) {
|
if (Command.action == GLFW_PRESS) {
|
||||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||||
Train->mvOccupied->SpringBrakeActivate(true);
|
Train->mvOccupied->SpringBrakeActivate(true);
|
||||||
|
// visual feedback
|
||||||
|
Train->ggSpringBrakeOnButton.UpdateValue(1.0, Train->dsbSwitch);
|
||||||
|
Train->ggSpringBrakeToggleButton.UpdateValue(1.0, Train->dsbSwitch);
|
||||||
|
Train->ggSpringBrakeOffButton.UpdateValue(0.0, Train->dsbSwitch);
|
||||||
|
}
|
||||||
|
else if (Command.action == GLFW_RELEASE) {
|
||||||
|
// release
|
||||||
|
// visual feedback
|
||||||
|
Train->ggSpringBrakeOnButton.UpdateValue(0.0, Train->dsbSwitch);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -4420,6 +4435,15 @@ void TTrain::OnCommand_springbrakedisable(TTrain *Train, command_data const &Com
|
|||||||
if (Command.action == GLFW_PRESS) {
|
if (Command.action == GLFW_PRESS) {
|
||||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||||
Train->mvOccupied->SpringBrakeActivate(false);
|
Train->mvOccupied->SpringBrakeActivate(false);
|
||||||
|
// visual feedback
|
||||||
|
Train->ggSpringBrakeOffButton.UpdateValue(1.0, Train->dsbSwitch);
|
||||||
|
Train->ggSpringBrakeToggleButton.UpdateValue(0.0, Train->dsbSwitch);
|
||||||
|
Train->ggSpringBrakeOnButton.UpdateValue(0.0, Train->dsbSwitch);
|
||||||
|
}
|
||||||
|
else if (Command.action == GLFW_RELEASE) {
|
||||||
|
// release
|
||||||
|
// visual feedback
|
||||||
|
Train->ggSpringBrakeOffButton.UpdateValue(0.0, Train->dsbSwitch);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
void TTrain::OnCommand_springbrakeshutofftoggle(TTrain *Train, command_data const &Command) {
|
void TTrain::OnCommand_springbrakeshutofftoggle(TTrain *Train, command_data const &Command) {
|
||||||
@@ -6379,6 +6403,9 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
ggMainButton.Update();
|
ggMainButton.Update();
|
||||||
ggSecurityResetButton.Update();
|
ggSecurityResetButton.Update();
|
||||||
ggReleaserButton.Update();
|
ggReleaserButton.Update();
|
||||||
|
ggSpringBrakeToggleButton.Update();
|
||||||
|
ggSpringBrakeOnButton.Update();
|
||||||
|
ggSpringBrakeOffButton.Update();
|
||||||
ggUniveralBrakeButton1.Update();
|
ggUniveralBrakeButton1.Update();
|
||||||
ggUniveralBrakeButton2.Update();
|
ggUniveralBrakeButton2.Update();
|
||||||
ggUniveralBrakeButton3.Update();
|
ggUniveralBrakeButton3.Update();
|
||||||
@@ -7575,6 +7602,9 @@ void TTrain::clear_cab_controls()
|
|||||||
ggMainOnButton.Clear();
|
ggMainOnButton.Clear();
|
||||||
ggSecurityResetButton.Clear();
|
ggSecurityResetButton.Clear();
|
||||||
ggReleaserButton.Clear();
|
ggReleaserButton.Clear();
|
||||||
|
ggSpringBrakeToggleButton.Clear();
|
||||||
|
ggSpringBrakeOnButton.Clear();
|
||||||
|
ggSpringBrakeOffButton.Clear();
|
||||||
ggUniveralBrakeButton1.Clear();
|
ggUniveralBrakeButton1.Clear();
|
||||||
ggUniveralBrakeButton2.Clear();
|
ggUniveralBrakeButton2.Clear();
|
||||||
ggUniveralBrakeButton3.Clear();
|
ggUniveralBrakeButton3.Clear();
|
||||||
@@ -8239,6 +8269,9 @@ bool TTrain::initialize_gauge(cParser &Parser, std::string const &Label, int con
|
|||||||
{ "main_on_bt:", ggMainOnButton },
|
{ "main_on_bt:", ggMainOnButton },
|
||||||
{ "security_reset_bt:", ggSecurityResetButton },
|
{ "security_reset_bt:", ggSecurityResetButton },
|
||||||
{ "releaser_bt:", ggReleaserButton },
|
{ "releaser_bt:", ggReleaserButton },
|
||||||
|
{ "springbraketoggle_bt:", ggSpringBrakeToggleButton },
|
||||||
|
{ "springbrakeon_bt:", ggSpringBrakeOnButton },
|
||||||
|
{ "springbrakeoff_bt:", ggSpringBrakeOffButton },
|
||||||
{ "universalbrake1_bt:", ggUniveralBrakeButton1 },
|
{ "universalbrake1_bt:", ggUniveralBrakeButton1 },
|
||||||
{ "universalbrake2_bt:", ggUniveralBrakeButton2 },
|
{ "universalbrake2_bt:", ggUniveralBrakeButton2 },
|
||||||
{ "universalbrake3_bt:", ggUniveralBrakeButton3 },
|
{ "universalbrake3_bt:", ggUniveralBrakeButton3 },
|
||||||
|
|||||||
3
Train.h
3
Train.h
@@ -416,6 +416,9 @@ public: // reszta może by?publiczna
|
|||||||
TGauge ggMainButton; // EZT
|
TGauge ggMainButton; // EZT
|
||||||
TGauge ggSecurityResetButton;
|
TGauge ggSecurityResetButton;
|
||||||
TGauge ggReleaserButton;
|
TGauge ggReleaserButton;
|
||||||
|
TGauge ggSpringBrakeToggleButton;
|
||||||
|
TGauge ggSpringBrakeOnButton;
|
||||||
|
TGauge ggSpringBrakeOffButton;
|
||||||
TGauge ggUniveralBrakeButton1;
|
TGauge ggUniveralBrakeButton1;
|
||||||
TGauge ggUniveralBrakeButton2;
|
TGauge ggUniveralBrakeButton2;
|
||||||
TGauge ggUniveralBrakeButton3;
|
TGauge ggUniveralBrakeButton3;
|
||||||
|
|||||||
@@ -570,6 +570,15 @@ drivermouse_input::default_bindings() {
|
|||||||
{ "releaser_bt:", {
|
{ "releaser_bt:", {
|
||||||
user_command::independentbrakebailoff,
|
user_command::independentbrakebailoff,
|
||||||
user_command::none } },
|
user_command::none } },
|
||||||
|
{ "springbraketoggle_bt:",{
|
||||||
|
user_command::springbraketoggle,
|
||||||
|
user_command::none } },
|
||||||
|
{ "springbrakeon_bt:",{
|
||||||
|
user_command::springbrakeenable,
|
||||||
|
user_command::none } },
|
||||||
|
{ "springbrakeoff_bt:",{
|
||||||
|
user_command::springbrakedisable,
|
||||||
|
user_command::none } },
|
||||||
{ "universalbrake1_bt:",{
|
{ "universalbrake1_bt:",{
|
||||||
user_command::universalbrakebutton1,
|
user_command::universalbrakebutton1,
|
||||||
user_command::none } },
|
user_command::none } },
|
||||||
|
|||||||
Reference in New Issue
Block a user