Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ HandleClick()

void Terraria.UI.UserInterface.HandleClick ( InputPointerCache cache,
GameTime time,
bool isDown,
UIElement mouseElement )
inlineprivate

Definition at line 207 of file UserInterface.cs.

208 {
209 if (isDown && !cache.WasDown && mouseElement != null)
210 {
211 cache.LastDown = mouseElement;
212 cache.MouseDownEvent(mouseElement, new UIMouseEvent(mouseElement, MousePosition));
213 if (cache.LastClicked == mouseElement && time.TotalGameTime.TotalMilliseconds - cache.LastTimeDown < 500.0)
214 {
215 cache.DoubleClickEvent(mouseElement, new UIMouseEvent(mouseElement, MousePosition));
216 cache.LastClicked = null;
217 }
218 cache.LastTimeDown = time.TotalGameTime.TotalMilliseconds;
219 }
220 else if (!isDown && cache.WasDown && cache.LastDown != null)
221 {
222 UIElement lastDown = cache.LastDown;
223 if (lastDown.ContainsPoint(MousePosition))
224 {
225 cache.ClickEvent(lastDown, new UIMouseEvent(lastDown, MousePosition));
226 cache.LastClicked = cache.LastDown;
227 }
228 cache.MouseUpEvent(lastDown, new UIMouseEvent(lastDown, MousePosition));
229 cache.LastDown = null;
230 }
231 cache.WasDown = isDown;
232 }

References Terraria.UI.UserInterface.MousePosition.

Referenced by Terraria.UI.UserInterface.Update().