-
Notifications
You must be signed in to change notification settings - Fork 51
/
Button.h
62 lines (55 loc) · 2.01 KB
/
Button.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
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/.
*/
#pragma once
#include "Classes.h"
#include "sound.h"
// animacja dwustanowa, włącza jeden z dwóch submodeli (jednego z nich może nie być)
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
};
//---------------------------------------------------------------------------