DDNet documentation
Loading...
Searching...
No Matches
envelope_editor.h
Go to the documentation of this file.
1/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
2/* If you are missing that file, acquire a complete release at teeworlds.com. */
3
4#ifndef GAME_EDITOR_ENVELOPE_EDITOR_H
5#define GAME_EDITOR_ENVELOPE_EDITOR_H
6
7#include <game/client/ui.h>
11#include <game/mapitems.h>
12
13#include <memory>
14#include <vector>
15
16class CEnvelope;
17
19{
20public:
21 class CState
22 {
23 public:
29
30 void Reset(CEditor *pEditor);
31 };
32
33 void OnReset() override;
34 void Render(CUIRect View);
35
36private:
37 void RenderColorBar(CUIRect ColorBar, const std::shared_ptr<CEnvelope> &pEnvelope);
38
39 void UpdateHotEnvelopeObject(const CUIRect &View, const CEnvelope *pEnvelope, int ActiveChannels);
40
41 void ZoomAdaptOffsetX(float ZoomFactor, const CUIRect &View);
42 void UpdateZoomEnvelopeX(const CUIRect &View);
43
44 void ZoomAdaptOffsetY(float ZoomFactor, const CUIRect &View);
45 void UpdateZoomEnvelopeY(const CUIRect &View);
46
47 void ResetZoomEnvelope(const std::shared_ptr<CEnvelope> &pEnvelope, int ActiveChannels);
48 void RemoveTimeOffsetEnvelope(const std::shared_ptr<CEnvelope> &pEnvelope);
49
50 float ScreenToEnvelopeX(const CUIRect &View, float x) const;
51 float EnvelopeToScreenX(const CUIRect &View, float x) const;
52 float ScreenToEnvelopeY(const CUIRect &View, float y) const;
53 float EnvelopeToScreenY(const CUIRect &View, float y) const;
54 float ScreenToEnvelopeDeltaX(const CUIRect &View, float DeltaX);
55 float ScreenToEnvelopeDeltaY(const CUIRect &View, float DeltaY);
56
57 const char m_RedoButtonId = 0;
58 const char m_UndoButtonId = 0;
62 const char m_DeleteButtonId = 0;
63 const char m_MoveRightButtonId = 0;
64 const char m_MoveLeftButtonId = 0;
65 const char m_ZoomOutButtonId = 0;
66 const char m_ResetZoomButtonId = 0;
67 const char m_ZoomInButtonId = 0;
68 const char m_EnvelopeSelectorId = 0;
69 const char m_PrevEnvelopeButtonId = 0;
70 const char m_NextEnvelopeButtonId = 0;
72 const char m_EnvelopeEditorId = 0;
76 std::vector<float> m_vAccurateDragValuesX;
77 std::vector<float> m_vAccurateDragValuesY;
81 std::vector<float> m_vInitialPositionsX;
82 std::vector<float> m_vInitialPositionsY;
83
85 {
86 public:
88 static CUi::EPopupMenuFunctionResult Render(void *pContext, CUIRect View, bool Active);
89
90 private:
91 int m_aValues[4] = {0};
94 float m_CurrentTime = 0.0f;
95 float m_CurrentValue = 0.0f;
96 const char m_ColorPickerButtonId = 0;
97 const char m_DeleteButtonId = 0;
98 };
100
102 {
103 public:
105 static CUi::EPopupMenuFunctionResult Render(void *pContext, CUIRect View, bool Active);
106
107 private:
108 const char m_ProjectOntoButtonId = 0;
109 };
111
113 {
114 public:
116 static CUi::EPopupMenuFunctionResult Render(void *pContext, CUIRect View, bool Active);
117
118 private:
119 const char m_aButtonIds[NUM_CURVETYPES - 1] = {0};
120 };
122
124 {
125 public:
128 static CUi::EPopupMenuFunctionResult Render(void *pContext, CUIRect View, bool Active);
129
130 private:
131 const char m_aButtonIds[NUM_CURVETYPES] = {0};
132 };
134};
135
136#endif
Definition component.h:13
Definition editor.h:108
@ MAX_CHANNELS
Definition mapitems.h:490
Definition envelope_editor.h:124
CEnvelopeEditor * m_pEnvelopeEditor
Definition envelope_editor.h:126
const char m_aButtonIds[NUM_CURVETYPES]
Definition envelope_editor.h:131
static CUi::EPopupMenuFunctionResult Render(void *pContext, CUIRect View, bool Active)
Definition envelope_editor.cpp:2021
int m_SelectedPoint
Definition envelope_editor.h:127
Definition envelope_editor.h:113
static CUi::EPopupMenuFunctionResult Render(void *pContext, CUIRect View, bool Active)
Definition envelope_editor.cpp:1948
const char m_aButtonIds[NUM_CURVETYPES - 1]
Definition envelope_editor.h:119
CEnvelopeEditor * m_pEnvelopeEditor
Definition envelope_editor.h:115
Definition envelope_editor.h:102
CEnvelopeEditor * m_pEnvelopeEditor
Definition envelope_editor.h:104
const char m_ProjectOntoButtonId
Definition envelope_editor.h:108
static CUi::EPopupMenuFunctionResult Render(void *pContext, CUIRect View, bool Active)
Definition envelope_editor.cpp:1931
Definition envelope_editor.h:85
CLineInputNumber m_ValueInput
Definition envelope_editor.h:92
float m_CurrentValue
Definition envelope_editor.h:95
const char m_ColorPickerButtonId
Definition envelope_editor.h:96
CLineInputNumber m_TimeInput
Definition envelope_editor.h:93
CEnvelopeEditor * m_pEnvelopeEditor
Definition envelope_editor.h:87
const char m_DeleteButtonId
Definition envelope_editor.h:97
float m_CurrentTime
Definition envelope_editor.h:94
int m_aValues[4]
Definition envelope_editor.h:91
static CUi::EPopupMenuFunctionResult Render(void *pContext, CUIRect View, bool Active)
Definition envelope_editor.cpp:1765
Definition envelope_editor.h:22
vec2 m_Offset
Definition envelope_editor.h:27
CSmoothValue m_ZoomX
Definition envelope_editor.h:24
int m_ActiveChannels
Definition envelope_editor.h:28
bool m_ResetZoom
Definition envelope_editor.h:26
void Reset(CEditor *pEditor)
Definition envelope_editor.cpp:121
CSmoothValue m_ZoomY
Definition envelope_editor.h:25
Definition envelope_editor.h:19
std::vector< float > m_vInitialPositionsX
Definition envelope_editor.h:81
vec2 m_MouseStart
Definition envelope_editor.h:78
void UpdateZoomEnvelopeX(const CUIRect &View)
Definition envelope_editor.cpp:1652
void ZoomAdaptOffsetY(float ZoomFactor, const CUIRect &View)
Definition envelope_editor.cpp:1659
void Render(CUIRect View)
Definition envelope_editor.cpp:146
std::vector< float > m_vAccurateDragValuesX
Definition envelope_editor.h:76
const char m_MoveLeftButtonId
Definition envelope_editor.h:64
float ScreenToEnvelopeX(const CUIRect &View, float x) const
Definition envelope_editor.cpp:1726
CPopupEnvelopeCurveType m_PopupEnvelopeCurveType
Definition envelope_editor.h:133
const char m_EnvelopeEditorId
Definition envelope_editor.h:72
CLineInput m_NameInput
Definition envelope_editor.h:73
const char m_EnvelopeSelectorId
Definition envelope_editor.h:68
void UpdateZoomEnvelopeY(const CUIRect &View)
Definition envelope_editor.cpp:1665
std::vector< float > m_vInitialPositionsY
Definition envelope_editor.h:82
const char m_aChannelButtonIds[CEnvPoint::MAX_CHANNELS]
Definition envelope_editor.h:71
float ScreenToEnvelopeDeltaX(const CUIRect &View, float DeltaX)
Definition envelope_editor.cpp:1746
void RemoveTimeOffsetEnvelope(const std::shared_ptr< CEnvelope > &pEnvelope)
Definition envelope_editor.cpp:1756
CPopupEnvelopePointCurveType m_PopupEnvelopePointCurveType
Definition envelope_editor.h:121
const char m_UndoButtonId
Definition envelope_editor.h:58
const char m_ZoomOutButtonId
Definition envelope_editor.h:65
float EnvelopeToScreenX(const CUIRect &View, float x) const
Definition envelope_editor.cpp:1731
const char m_MoveRightButtonId
Definition envelope_editor.h:63
const char m_NewPositionEnvelopeButtonId
Definition envelope_editor.h:61
float EnvelopeToScreenY(const CUIRect &View, float y) const
Definition envelope_editor.cpp:1741
const char m_NewSoundEnvelopeButtonId
Definition envelope_editor.h:59
const char m_PrevEnvelopeButtonId
Definition envelope_editor.h:69
const char m_DeleteButtonId
Definition envelope_editor.h:62
float ScreenToEnvelopeY(const CUIRect &View, float y) const
Definition envelope_editor.cpp:1736
CPopupEnvelopePoint m_PopupEnvelopePoint
Definition envelope_editor.h:99
std::vector< float > m_vAccurateDragValuesY
Definition envelope_editor.h:77
void OnReset() override
Definition envelope_editor.cpp:132
void ResetZoomEnvelope(const std::shared_ptr< CEnvelope > &pEnvelope, int ActiveChannels)
Definition envelope_editor.cpp:1672
void UpdateHotEnvelopeObject(const CUIRect &View, const CEnvelope *pEnvelope, int ActiveChannels)
Definition envelope_editor.cpp:1582
int m_EnvelopeEditorButtonUsed
Definition envelope_editor.h:74
EEnvelopeEditorOp m_Operation
Definition envelope_editor.h:75
const char m_RedoButtonId
Definition envelope_editor.h:57
CPopupEnvelopePointMulti m_PopupEnvelopePointMulti
Definition envelope_editor.h:110
vec2 m_Midpoint
Definition envelope_editor.h:80
void ZoomAdaptOffsetX(float ZoomFactor, const CUIRect &View)
Definition envelope_editor.cpp:1646
void RenderColorBar(CUIRect ColorBar, const std::shared_ptr< CEnvelope > &pEnvelope)
Definition envelope_editor.cpp:1484
const char m_NewColorEnvelopeButtonId
Definition envelope_editor.h:60
const char m_ResetZoomButtonId
Definition envelope_editor.h:66
const char m_ZoomInButtonId
Definition envelope_editor.h:67
vec2 m_ScaleFactor
Definition envelope_editor.h:79
const char m_NextEnvelopeButtonId
Definition envelope_editor.h:70
float ScreenToEnvelopeDeltaY(const CUIRect &View, float DeltaY)
Definition envelope_editor.cpp:1751
Definition envelope.h:11
Definition lineinput.h:215
Definition lineinput.h:25
Definition smooth_value.h:12
Definition ui_rect.h:12
EPopupMenuFunctionResult
Definition ui.h:310
EEnvelopeEditorOp
Definition editor_trackers.h:57
@ NUM_CURVETYPES
Definition mapitems.h:48
Definition ui.h:293
vector2_base< float > vec2
Definition vmath.h:168