mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-20 07:59:18 +02:00
build 170715. custom sounds for cab lights, optional fallback on legacy sounds for controls without their own sound definitions
This commit is contained in:
75
Button.h
75
Button.h
@@ -7,59 +7,52 @@ obtain one at
|
||||
http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#ifndef ButtonH
|
||||
#define ButtonH
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include "Model3d.h"
|
||||
#include "parser.h"
|
||||
#include "Classes.h"
|
||||
#include "sound.h"
|
||||
|
||||
class TButton
|
||||
{ // animacja dwustanowa, włącza jeden z dwóch submodeli (jednego
|
||||
// z nich może nie być)
|
||||
private:
|
||||
TSubModel *pModelOn, *pModelOff; // submodel dla stanu załączonego i wyłączonego
|
||||
bool bOn;
|
||||
bool *bData;
|
||||
int iFeedbackBit; // Ra: bit informacji zwrotnej, do wyprowadzenia na pulpit
|
||||
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
|
||||
PSound m_soundfxincrease { nullptr }; // sound associated with increasing control's value
|
||||
PSound m_soundfxdecrease { nullptr }; // sound associated with decreasing control's value
|
||||
// methods
|
||||
// imports member data pair from the config file
|
||||
bool
|
||||
Load_mapping( cParser &Input );
|
||||
// plays the sound associated with current state
|
||||
void
|
||||
play();
|
||||
// plays specified sound
|
||||
void
|
||||
play( PSound Sound );
|
||||
|
||||
public:
|
||||
TButton();
|
||||
~TButton();
|
||||
void Clear(int i = -1);
|
||||
inline void FeedbackBitSet(int i)
|
||||
{
|
||||
iFeedbackBit = 1 << i;
|
||||
};
|
||||
inline void Turn(bool to)
|
||||
{
|
||||
bOn = to;
|
||||
Update();
|
||||
};
|
||||
inline void TurnOn()
|
||||
{
|
||||
bOn = true;
|
||||
Update();
|
||||
};
|
||||
inline void TurnOff()
|
||||
{
|
||||
bOn = false;
|
||||
Update();
|
||||
};
|
||||
inline void Switch()
|
||||
{
|
||||
bOn = !bOn;
|
||||
Update();
|
||||
};
|
||||
inline bool Active()
|
||||
{
|
||||
return (pModelOn) || (pModelOff);
|
||||
};
|
||||
void Clear(int const i = -1);
|
||||
inline void FeedbackBitSet(int const i) {
|
||||
iFeedbackBit = 1 << i; };
|
||||
void Turn( bool const State );
|
||||
inline void TurnOn() {
|
||||
Turn( true ); };
|
||||
inline void TurnOff() {
|
||||
Turn( false ); };
|
||||
inline void Switch() {
|
||||
Turn( !m_state ); };
|
||||
inline bool Active() {
|
||||
return (pModelOn) || (pModelOff); };
|
||||
void Update();
|
||||
void Init(std::string const &asName, TModel3d *pModel, bool bNewOn = false);
|
||||
void Load(cParser &Parser, TModel3d *pModel1, TModel3d *pModel2 = NULL);
|
||||
void AssignBool(bool *bValue);
|
||||
void AssignBool(bool const *bValue);
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user