17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 22:39:19 +02:00
Files
maszyna/vehicle/Button.cppm
maj00r b8f040e6fd propagate template headers transitively, import Console where used
AnimModel.cpp reaches cParser through the simulation core, not a direct
import, so the previous pass missed it; the propagation now follows the
whole import closure. Train.cpp, drivermode.cpp and Globals.cpp call
Console:: inside _WIN32 guards without importing eu07.console - invisible
on Linux, where those blocks are skipped.
2026-09-10 01:41:24 +02:00

85 lines
2.4 KiB
C++

/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
distributed with this file, You can
obtain one at
http://mozilla.org/MPL/2.0/.
*/
// animacja dwustanowa, włącza jeden z dwóch submodeli (jednego z nich może nie być)
module;
#include <array>
#include <chrono>
#include <cstddef>
#include <deque>
#include <limits>
#include <mutex>
#include <ostream>
#include <type_traits>
#include <unordered_map>
#include <utility>
#include <sstream>
#include <vector>
#include <cstdint>
#include <string>
export module eu07.simcore:button;
import :fwd;
import eu07.utilities.parser;
import eu07.glm;
import eu07.utilities.classes;
import eu07.audio.sound;
export {
class TButton {
public:
// methods
TButton() = default;
void Clear(int const i = -1);
inline
void FeedbackBitSet( int const i ) {
iFeedbackBit = 1 << i; };
void Turn( bool const State );
inline
bool GetValue() const {
return m_state; }
inline
bool Active() {
return pModelOn != nullptr || pModelOff != nullptr; }
void Update( bool const Power = true );
bool Init( std::string const &asName, TModel3d const *pModel, bool bNewOn = false );
void Load( cParser &Parser, TDynamicObject const *Owner );
void AssignBool(bool const *bValue);
// returns offset of submodel associated with the button from the model centre
glm::vec3 model_offset() const;
void gain(float new_volume);
inline uint8_t b() { return m_state ? 1 : 0; };
private:
// methods
// imports member data pair from the config file
bool
Load_mapping( cParser &Input );
// plays the sound associated with current state
void
play();
// members
TSubModel
*pModelOn { nullptr },
*pModelOff { nullptr }; // submodel dla stanu załączonego i wyłączonego
bool m_state { false };
bool const *bData { nullptr };
int iFeedbackBit { 0 }; // Ra: bit informacji zwrotnej, do wyprowadzenia na pulpit
sound_source m_soundfxincrease { sound_placement::internal, EU07_SOUND_CABCONTROLSCUTOFFRANGE }; // sound associated with increasing control's value
sound_source m_soundfxdecrease { sound_placement::internal, EU07_SOUND_CABCONTROLSCUTOFFRANGE }; // sound associated with decreasing control's value
};
//---------------------------------------------------------------------------
} // export