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 bool IsPointOperationActive() const;
36
37private:
38 void RenderColorBar(CUIRect ColorBar, const std::shared_ptr<CEnvelope> &pEnvelope);
39 void RenderPointTimeTooltip(CUIRect View, int PointIndex, const std::shared_ptr<CEnvelope> &pEnvelope);
40 void RenderPointValueTooltip(CUIRect View, int PointIndex, const std::shared_ptr<CEnvelope> &pEnvelope);
41 void RenderTangentInTooltip(CUIRect View, int PointIndex, int Channel, const std::shared_ptr<CEnvelope> &pEnvelope);
42 void RenderTangentOutTooltip(CUIRect View, int PointIndex, int Channel, const std::shared_ptr<CEnvelope> &pEnvelope);
43 void RenderTangentTooltip(CUIRect View, int PointIndex, int Channel, CFixedTime Time, int Value, const std::shared_ptr<CEnvelope> &pEnvelope);
44 void RenderScaleTooltip(CUIRect View, const std::shared_ptr<CEnvelope> &pEnvelope);
45 void RenderTimebarTooltip(CUIRect View, const std::shared_ptr<CEnvelope> &pEnvelope);
46 void RenderTooltip(CUIRect *pTooltipRect, CUIRect Boundary);
47
48 void UpdateHotEnvelopeObject(const CUIRect &View, const CEnvelope *pEnvelope, int ActiveChannels);
49
50 void ZoomAdaptOffsetX(float ZoomFactor, const CUIRect &View);
51 void UpdateZoomEnvelopeX(const CUIRect &View);
52
53 void ZoomAdaptOffsetY(float ZoomFactor, const CUIRect &View);
54 void UpdateZoomEnvelopeY(const CUIRect &View);
55
56 void ResetZoomEnvelope(const std::shared_ptr<CEnvelope> &pEnvelope, int ActiveChannels);
57 void RemoveTimeOffsetEnvelope(const std::shared_ptr<CEnvelope> &pEnvelope);
58
59 float ScreenToEnvelopeX(const CUIRect &View, float x) const;
60 float EnvelopeToScreenX(const CUIRect &View, float x) const;
61 float ScreenToEnvelopeY(const CUIRect &View, float y) const;
62 float EnvelopeToScreenY(const CUIRect &View, float y) const;
63 float ScreenToEnvelopeDeltaX(const CUIRect &View, float DeltaX);
64 float ScreenToEnvelopeDeltaY(const CUIRect &View, float DeltaY);
65
66 const char m_RedoButtonId = 0;
67 const char m_UndoButtonId = 0;
71 const char m_DeleteButtonId = 0;
72 const char m_MoveRightButtonId = 0;
73 const char m_MoveLeftButtonId = 0;
74 const char m_ZoomOutButtonId = 0;
75 const char m_ResetZoomButtonId = 0;
76 const char m_ZoomInButtonId = 0;
77 const char m_EnvelopeSelectorId = 0;
78 const char m_PrevEnvelopeButtonId = 0;
79 const char m_NextEnvelopeButtonId = 0;
81 const char m_EnvelopeEditorId = 0;
82 const char m_ScaleOperationId = 0;
86 std::vector<float> m_vAccurateDragValuesX;
87 std::vector<float> m_vAccurateDragValuesY;
91 std::vector<float> m_vInitialPositionsX;
92 std::vector<float> m_vInitialPositionsY;
93
95 {
96 public:
98 static CUi::EPopupMenuFunctionResult Render(void *pContext, CUIRect View, bool Active);
99
100 private:
101 int m_aValues[4] = {0};
104 float m_CurrentTime = 0.0f;
105 float m_CurrentValue = 0.0f;
106 const char m_ColorPickerButtonId = 0;
107 const char m_DeleteButtonId = 0;
108 };
110
112 {
113 public:
115 static CUi::EPopupMenuFunctionResult Render(void *pContext, CUIRect View, bool Active);
116
117 private:
118 const char m_ProjectOntoButtonId = 0;
119 };
121
123 {
124 public:
126 static CUi::EPopupMenuFunctionResult Render(void *pContext, CUIRect View, bool Active);
127
128 private:
129 const char m_aButtonIds[NUM_CURVETYPES - 1] = {0};
130 };
132
134 {
135 public:
138 static CUi::EPopupMenuFunctionResult Render(void *pContext, CUIRect View, bool Active);
139
140 private:
141 const char m_aButtonIds[NUM_CURVETYPES] = {0};
142 };
144};
145
146#endif
Definition component.h:13
Definition editor.h:108
@ MAX_CHANNELS
Definition mapitems.h:510
Definition envelope_editor.h:134
CEnvelopeEditor * m_pEnvelopeEditor
Definition envelope_editor.h:136
const char m_aButtonIds[NUM_CURVETYPES]
Definition envelope_editor.h:141
static CUi::EPopupMenuFunctionResult Render(void *pContext, CUIRect View, bool Active)
Definition envelope_editor.cpp:2336
int m_SelectedPoint
Definition envelope_editor.h:137
Definition envelope_editor.h:123
static CUi::EPopupMenuFunctionResult Render(void *pContext, CUIRect View, bool Active)
Definition envelope_editor.cpp:2263
const char m_aButtonIds[NUM_CURVETYPES - 1]
Definition envelope_editor.h:129
CEnvelopeEditor * m_pEnvelopeEditor
Definition envelope_editor.h:125
Definition envelope_editor.h:112
CEnvelopeEditor * m_pEnvelopeEditor
Definition envelope_editor.h:114
const char m_ProjectOntoButtonId
Definition envelope_editor.h:118
static CUi::EPopupMenuFunctionResult Render(void *pContext, CUIRect View, bool Active)
Definition envelope_editor.cpp:2246
Definition envelope_editor.h:95
CLineInputNumber m_ValueInput
Definition envelope_editor.h:102
float m_CurrentValue
Definition envelope_editor.h:105
const char m_ColorPickerButtonId
Definition envelope_editor.h:106
CLineInputNumber m_TimeInput
Definition envelope_editor.h:103
CEnvelopeEditor * m_pEnvelopeEditor
Definition envelope_editor.h:97
const char m_DeleteButtonId
Definition envelope_editor.h:107
float m_CurrentTime
Definition envelope_editor.h:104
int m_aValues[4]
Definition envelope_editor.h:101
static CUi::EPopupMenuFunctionResult Render(void *pContext, CUIRect View, bool Active)
Definition envelope_editor.cpp:2080
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:130
CSmoothValue m_ZoomY
Definition envelope_editor.h:25
Definition envelope_editor.h:19
std::vector< float > m_vInitialPositionsX
Definition envelope_editor.h:91
vec2 m_MouseStart
Definition envelope_editor.h:88
void UpdateZoomEnvelopeX(const CUIRect &View)
Definition envelope_editor.cpp:1967
void RenderTimebarTooltip(CUIRect View, const std::shared_ptr< CEnvelope > &pEnvelope)
Definition envelope_editor.cpp:1838
void ZoomAdaptOffsetY(float ZoomFactor, const CUIRect &View)
Definition envelope_editor.cpp:1974
void Render(CUIRect View)
Definition envelope_editor.cpp:155
std::vector< float > m_vAccurateDragValuesX
Definition envelope_editor.h:86
const char m_MoveLeftButtonId
Definition envelope_editor.h:73
float ScreenToEnvelopeX(const CUIRect &View, float x) const
Definition envelope_editor.cpp:2041
void RenderScaleTooltip(CUIRect View, const std::shared_ptr< CEnvelope > &pEnvelope)
Definition envelope_editor.cpp:1804
void RenderPointValueTooltip(CUIRect View, int PointIndex, const std::shared_ptr< CEnvelope > &pEnvelope)
Definition envelope_editor.cpp:1711
CPopupEnvelopeCurveType m_PopupEnvelopeCurveType
Definition envelope_editor.h:143
const char m_EnvelopeEditorId
Definition envelope_editor.h:81
CLineInput m_NameInput
Definition envelope_editor.h:83
const char m_EnvelopeSelectorId
Definition envelope_editor.h:77
const char m_ScaleOperationId
Definition envelope_editor.h:82
void RenderTooltip(CUIRect *pTooltipRect, CUIRect Boundary)
Definition envelope_editor.cpp:1866
void UpdateZoomEnvelopeY(const CUIRect &View)
Definition envelope_editor.cpp:1980
std::vector< float > m_vInitialPositionsY
Definition envelope_editor.h:92
const char m_aChannelButtonIds[CEnvPoint::MAX_CHANNELS]
Definition envelope_editor.h:80
void RenderTangentTooltip(CUIRect View, int PointIndex, int Channel, CFixedTime Time, int Value, const std::shared_ptr< CEnvelope > &pEnvelope)
Definition envelope_editor.cpp:1778
float ScreenToEnvelopeDeltaX(const CUIRect &View, float DeltaX)
Definition envelope_editor.cpp:2061
void RemoveTimeOffsetEnvelope(const std::shared_ptr< CEnvelope > &pEnvelope)
Definition envelope_editor.cpp:2071
CPopupEnvelopePointCurveType m_PopupEnvelopePointCurveType
Definition envelope_editor.h:131
const char m_UndoButtonId
Definition envelope_editor.h:67
const char m_ZoomOutButtonId
Definition envelope_editor.h:74
float EnvelopeToScreenX(const CUIRect &View, float x) const
Definition envelope_editor.cpp:2046
void RenderTangentInTooltip(CUIRect View, int PointIndex, int Channel, const std::shared_ptr< CEnvelope > &pEnvelope)
Definition envelope_editor.cpp:1764
const char m_MoveRightButtonId
Definition envelope_editor.h:72
const char m_NewPositionEnvelopeButtonId
Definition envelope_editor.h:70
float EnvelopeToScreenY(const CUIRect &View, float y) const
Definition envelope_editor.cpp:2056
const char m_NewSoundEnvelopeButtonId
Definition envelope_editor.h:68
const char m_PrevEnvelopeButtonId
Definition envelope_editor.h:78
const char m_DeleteButtonId
Definition envelope_editor.h:71
float ScreenToEnvelopeY(const CUIRect &View, float y) const
Definition envelope_editor.cpp:2051
CPopupEnvelopePoint m_PopupEnvelopePoint
Definition envelope_editor.h:109
void RenderPointTimeTooltip(CUIRect View, int PointIndex, const std::shared_ptr< CEnvelope > &pEnvelope)
Definition envelope_editor.cpp:1677
std::vector< float > m_vAccurateDragValuesY
Definition envelope_editor.h:87
void OnReset() override
Definition envelope_editor.cpp:141
void ResetZoomEnvelope(const std::shared_ptr< CEnvelope > &pEnvelope, int ActiveChannels)
Definition envelope_editor.cpp:1987
void UpdateHotEnvelopeObject(const CUIRect &View, const CEnvelope *pEnvelope, int ActiveChannels)
Definition envelope_editor.cpp:1897
int m_EnvelopeEditorButtonUsed
Definition envelope_editor.h:84
void RenderTangentOutTooltip(CUIRect View, int PointIndex, int Channel, const std::shared_ptr< CEnvelope > &pEnvelope)
Definition envelope_editor.cpp:1771
EEnvelopeEditorOp m_Operation
Definition envelope_editor.h:85
const char m_RedoButtonId
Definition envelope_editor.h:66
CPopupEnvelopePointMulti m_PopupEnvelopePointMulti
Definition envelope_editor.h:120
vec2 m_Midpoint
Definition envelope_editor.h:90
bool IsPointOperationActive() const
Definition envelope_editor.cpp:1568
void ZoomAdaptOffsetX(float ZoomFactor, const CUIRect &View)
Definition envelope_editor.cpp:1961
void RenderColorBar(CUIRect ColorBar, const std::shared_ptr< CEnvelope > &pEnvelope)
Definition envelope_editor.cpp:1576
const char m_NewColorEnvelopeButtonId
Definition envelope_editor.h:69
const char m_ResetZoomButtonId
Definition envelope_editor.h:75
const char m_ZoomInButtonId
Definition envelope_editor.h:76
vec2 m_ScaleFactor
Definition envelope_editor.h:89
const char m_NextEnvelopeButtonId
Definition envelope_editor.h:79
float ScreenToEnvelopeDeltaY(const CUIRect &View, float DeltaY)
Definition envelope_editor.cpp:2066
Definition envelope.h:11
Definition mapitems.h:259
Definition lineinput.h:216
Definition lineinput.h:27
Definition smooth_value.h:12
Definition ui_rect.h:12
EPopupMenuFunctionResult
Definition ui.h:346
EEnvelopeEditorOp
Definition editor_trackers.h:57
@ NUM_CURVETYPES
Definition mapitems.h:48
Definition ui.h:297
vector2_base< float > vec2
Definition vmath.h:168