DayZ 1.24
Loading...
Searching...
No Matches
CallQueue Class Reference

DragQueue Class provide callbacks while mouse is dragging. Callback function must have exact arguments: More...

Collaboration diagram for CallQueue:
[legend]

Private Member Functions

void DragQueue ()
 
override void Tick ()
 System function, don't call it.
 

Private Attributes

ref Param3< int, int, boolm_mouse_params
 

Detailed Description

DragQueue Class provide callbacks while mouse is dragging. Callback function must have exact arguments:

When mouse button is released, callback function is called one more time with is_dragging = false. Then all callbacks are automatically removed from queue.


usage:

class XYZ
{
void UpdateDrag(int mouse_x, int mouse_y, bool is_dragging);
}
...
GetGame().GetDragQueue().Call(this, "UpdateDrag"); // calls "UpdateDrag" function on "this"

Definition at line 147 of file tools.c.

Member Function Documentation

◆ DragQueue()

void CallQueue::DragQueue ( )
inlineprivate

Definition at line 151 of file tools.c.

152 {
153 m_mouse_params = new Param3<int, int, bool>(0, 0, true);
154 }
ref Param3< int, int, bool > m_mouse_params
Definition tools.c:149

◆ Tick()

override void CallQueue::Tick ( )
inlineprivate

System function, don't call it.

Definition at line 159 of file tools.c.

160 {
161 if (m_processing) return;
162
163 m_processing = true;
164
165 int last_index = 0;
166 int mouse_x;
167 int mouse_y;
168 bool is_holding = false;
170
171 if (GetMouseState(MouseState.LEFT) & 0x80000000)
172 is_holding = true;
173
175
176 if (!is_holding || mouse_x != m_mouse_params.param1 || mouse_y != m_mouse_params.param2)
177 {
178 m_mouse_params.param1 = mouse_x;
179 m_mouse_params.param2 = mouse_y;
180 m_mouse_params.param3 = is_holding;
181
182 while (Count() > last_index)
183 {
184 ctx = Get(last_index);
185 if (!ctx.IsValid())
187 else
188 {
189 ctx.CallParams(m_mouse_params);
190 last_index++;
191 }
192 }
193 }
194
195 // clear queue when mouse button is released
196 if (!is_holding)
197 Clear();
198
199 m_processing = false;
200 }
void Remove(Object object)
array< ref PlayerStatBase > Get()
void Clear(bool clearFile=false)
MouseState
Definition EnSystem.c:311
proto native int GetMouseState(MouseState index)
proto void GetMousePos(out int x, out int y)

References Clear(), Count, Get(), GetMousePos(), GetMouseState(), and Remove().

Member Data Documentation

◆ m_mouse_params

ref Param3<int, int, bool> CallQueue::m_mouse_params
private

Definition at line 149 of file tools.c.


The documentation for this class was generated from the following file: