Advertisement
Tkap1

Untitled

Nov 8th, 2023 (edited)
1,073
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3. ButtonState = {
  4.     eventCountThisFrame: number;
  5.     isDown: boolean;
  6. }
  7.  
  8. ButtonStates[] = []
  9.  
  10.  
  11. onmousedown()
  12. {
  13.     if button == left {
  14.         // or use an enum
  15.         ButtonStates[0].eventCountThisFrame += 1;
  16.         ButtonStates[0].isDown = true;
  17.     }
  18.     if button == right {
  19.         // or use an enum
  20.         ButtonStates[1].eventCountThisFrame += 1;
  21.         ButtonStates[1].isDown = true;
  22.     }
  23. }
  24.  
  25.  
  26. render()
  27. {
  28.     // do all the shit
  29.  
  30.     for each buttonstate
  31.     {
  32.         ButtonStates[i].eventCountThisFrame = 0;
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement