RigsofRods
Soft-body Physics Simulation
TyrePressure.h
Go to the documentation of this file.
1 /*
2  This source file is part of Rigs of Rods
3  Copyright 2005-2012 Pierre-Michel Ricordel
4  Copyright 2007-2012 Thomas Fischer
5  Copyright 2015-2020 Petr Ohlidal
6 
7  For more information, see http://www.rigsofrods.org/
8 
9  Rigs of Rods is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License version 3, as
11  published by the Free Software Foundation.
12 
13  Rigs of Rods is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>.
20 */
21 
22 #pragma once
23 
26 
27 #include "Application.h"
28 
29 #include <vector>
30 
31 namespace RoR {
32 
35 
38 
42 {
43 public:
45 
46  void AddBeam(int beam_id) { m_pressure_beams.push_back(beam_id); }
47  bool IsEnabled() const { return m_pressure_beams.size() != 0; }
48  void UpdateInputEvents(float dt);
49  bool ModifyTyrePressure(float v);
50  float GetCurPressure() const { return m_ref_tyre_pressure; }
51  bool IsPressurizing() const { return m_pressure_pressed; }
52 
53 private:
55  std::vector<int> m_pressure_beams;
56  bool m_pressure_pressed = false;
58  float m_ref_tyre_pressure = 50.f;
59 };
60 
63 
64 } // namespace RoR
RoR::TyrePressure::m_pressure_pressed
bool m_pressure_pressed
Definition: TyrePressure.h:56
RoR::TyrePressure::m_ref_tyre_pressure
float m_ref_tyre_pressure
Definition: TyrePressure.h:58
RoR::TyrePressure::ModifyTyrePressure
bool ModifyTyrePressure(float v)
Definition: TyrePressure.cpp:64
RoR::TyrePressure::IsPressurizing
bool IsPressurizing() const
Definition: TyrePressure.h:51
RoR::TyrePressure::m_pressure_pressed_timer
float m_pressure_pressed_timer
Definition: TyrePressure.h:57
RefCountingObjectPtr< Actor >
RoR::TyrePressure
Land vehicle feat Simulates tyre pressurization by adjusting springness of in-wheel beams.
Definition: TyrePressure.h:41
RoR::TyrePressure::m_pressure_beams
std::vector< int > m_pressure_beams
Definition: TyrePressure.h:55
RoR::TyrePressure::m_actor
ActorPtr m_actor
Definition: TyrePressure.h:54
Application.h
Central state/object manager and communications hub.
RoR::TyrePressure::AddBeam
void AddBeam(int beam_id)
Definition: TyrePressure.h:46
RoR::TyrePressure::GetCurPressure
float GetCurPressure() const
Definition: TyrePressure.h:50
RoR::TyrePressure::TyrePressure
TyrePressure(ActorPtr a)
Definition: TyrePressure.h:44
RoR::TyrePressure::IsEnabled
bool IsEnabled() const
Definition: TyrePressure.h:47
RoR
Definition: AppContext.h:36
RoR::TyrePressure::UpdateInputEvents
void UpdateInputEvents(float dt)
Definition: TyrePressure.cpp:32