mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 16:19:19 +02:00
merge, with tmj renderer
This commit is contained in:
48
Gauge.h
48
Gauge.h
@@ -10,6 +10,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
#pragma once
|
||||
|
||||
#include "Classes.h"
|
||||
#include "sound.h"
|
||||
|
||||
typedef enum
|
||||
{ // typ ruchu
|
||||
@@ -21,35 +22,44 @@ typedef enum
|
||||
gt_Digital // licznik cyfrowy, np. kilometrów
|
||||
} TGaugeType;
|
||||
|
||||
class TGauge // zmienne "gg"
|
||||
{ // animowany wskaźnik, mogący przyjmować wiele stanów pośrednich
|
||||
// animowany wskaźnik, mogący przyjmować wiele stanów pośrednich
|
||||
class TGauge {
|
||||
|
||||
private:
|
||||
TGaugeType eType; // typ ruchu
|
||||
double fFriction{ 0.0 }; // hamowanie przy zliżaniu się do zadanej wartości
|
||||
double fDesiredValue{ 0.0 }; // wartość docelowa
|
||||
double fValue{ 0.0 }; // wartość obecna
|
||||
double fOffset{ 0.0 }; // wartość początkowa ("0")
|
||||
double fScale{ 1.0 }; // wartość końcowa ("1")
|
||||
double fStepSize; // nie używane
|
||||
TGaugeType eType { gt_Unknown }; // typ ruchu
|
||||
double fFriction { 0.0 }; // hamowanie przy zliżaniu się do zadanej wartości
|
||||
double fDesiredValue { 0.0 }; // wartość docelowa
|
||||
double fValue { 0.0 }; // wartość obecna
|
||||
double fOffset { 0.0 }; // wartość początkowa ("0")
|
||||
double fScale { 1.0 }; // wartość końcowa ("1")
|
||||
char cDataType; // typ zmiennej parametru: f-float, d-double, i-int
|
||||
union
|
||||
{ // wskaźnik na parametr pokazywany przez animację
|
||||
union {
|
||||
// wskaźnik na parametr pokazywany przez animację
|
||||
float *fData;
|
||||
double *dData;
|
||||
double *dData { nullptr };
|
||||
int *iData;
|
||||
};
|
||||
sound *m_soundfxincrease { nullptr }; // sound associated with increasing control's value
|
||||
sound *m_soundfxdecrease { nullptr }; // sound associated with decreasing control's value
|
||||
std::map<int, sound*> m_soundfxvalues; // sounds associated with specific values
|
||||
// methods
|
||||
// imports member data pair from the config file
|
||||
bool
|
||||
Load_mapping( cParser &Input );
|
||||
// plays specified sound
|
||||
void
|
||||
play( sound* Sound );
|
||||
|
||||
public:
|
||||
TGauge();
|
||||
~TGauge();
|
||||
void Clear();
|
||||
void Init(TSubModel *NewSubModel, TGaugeType eNewTyp, double fNewScale = 1,
|
||||
double fNewOffset = 0, double fNewFriction = 0, double fNewValue = 0);
|
||||
bool Load(cParser &Parser, TModel3d *md1, TModel3d *md2 = NULL, double mul = 1.0);
|
||||
TGauge() = default;
|
||||
inline
|
||||
void Clear() { *this = TGauge(); }
|
||||
void Init(TSubModel *NewSubModel, TGaugeType eNewTyp, double fNewScale = 1, double fNewOffset = 0, double fNewFriction = 0, double fNewValue = 0);
|
||||
bool Load(cParser &Parser, TModel3d *md1, TModel3d *md2 = nullptr, double mul = 1.0);
|
||||
void PermIncValue(double fNewDesired);
|
||||
void IncValue(double fNewDesired);
|
||||
void DecValue(double fNewDesired);
|
||||
void UpdateValue(double fNewDesired);
|
||||
void UpdateValue(double fNewDesired, sound *Fallbacksound = nullptr );
|
||||
void PutValue(double fNewDesired);
|
||||
double GetValue() const;
|
||||
void Update();
|
||||
|
||||
Reference in New Issue
Block a user