Xonotic
item.qc
Go to the documentation of this file.
1 #include "item.qh"
2 
3 #include "item/container.qh"
4 #include "item/borderimage.qh"
5 
6  METHOD(MenuItem, destroy, void(MenuItem this))
7  {
8  // free memory associated with this
9  }
10 
11  METHOD(MenuItem, relinquishFocus, void(MenuItem this))
12  {
13  entity par = this.parent;
14  if (!par) return;
15  if (par.instanceOfContainer) par.setFocus(par, NULL);
16  }
17 
18  METHOD(MenuItem, resizeNotify, void(MenuItem this, vector relOrigin, vector relSize, vector absOrigin, vector absSize))
19  {
20  this.origin = absOrigin;
21  this.size = absSize;
22  }
23 
25  METHOD(MenuItem, draw, void(MenuItem this))
26  {
27  if (!autocvar_menu_showboxes) return;
28  vector rgb = '1 0 1';
29  float a = fabs(autocvar_menu_showboxes);
30 
31  // don't draw containers and border images
32  if (this.instanceOfContainer || this.instanceOfBorderImage)
33  {
34  rgb = '0 0 0';
35  a = 0;
36  }
37 
38  #if 0
39  // hack to detect multi drawing
40  float r = random() * 3;
41  if (r >= 2) rgb = '1 0 0';
42  else if (r >= 1) rgb = '0 1 0';
43  else rgb = '0 0 1';
44  #endif
45  if (autocvar_menu_showboxes < 0)
46  {
47  draw_Fill('0 0 0', '0.5 0.5 0', rgb, a);
48  draw_Fill('0.5 0.5 0', '0.5 0.5 0', rgb, a);
49  }
50  else if (autocvar_menu_showboxes > 0)
51  {
52  draw_Fill('0 0 0', '1 1 0', rgb, a);
53  }
54  }
55 
56  METHOD(MenuItem, showNotify, void(MenuItem this))
57  {}
58 
59  METHOD(MenuItem, hideNotify, void(MenuItem this))
60  {}
61 
62  METHOD(MenuItem, keyDown, float(MenuItem this, float scan, float ascii, float shift))
63  {
64  return 0; // unhandled
65  }
66 
67  METHOD(MenuItem, keyUp, float(MenuItem this, float scan, float ascii, float shift))
68  {
69  return 0; // unhandled
70  }
71 
72  METHOD(MenuItem, mouseMove, float(MenuItem this, vector pos))
73  {
74  return 0; // unhandled
75  }
76 
77  METHOD(MenuItem, mousePress, bool(MenuItem this, vector pos))
78  {
79  return false; // unhandled
80  }
81 
82  METHOD(MenuItem, mouseDrag, float(MenuItem this, vector pos))
83  {
84  return 0; // unhandled
85  }
86 
87  METHOD(MenuItem, mouseRelease, float(MenuItem this, vector pos))
88  {
89  return 0; // unhandled
90  }
91 
92  void m_play_focus_sound();
93 
94  METHOD(MenuItem, focusEnter, void(MenuItem this))
95  {
96  if (this.allowFocusSound) m_play_focus_sound();
97  }
98 
99  METHOD(MenuItem, focusLeave, void(MenuItem this))
100  {}
101 
102  METHOD(MenuItem, toString, string(MenuItem this))
103  {
104  return string_null;
105  }
string string_null
Definition: nil.qh:9
entity parent
Definition: animhost.qc:7
entity() spawn
void m_play_focus_sound()
Definition: menu.qc:988
origin
Definition: ent_cs.qc:114
#define METHOD(cname, name, prototype)
Definition: oo.qh:257
vector size
Definition: csprogsdefs.qc:114
Definition: item.qh:8
#define NULL
Definition: post.qh:17
int autocvar_menu_showboxes
Definition: item.qc:24
vector(float skel, float bonenum) _skel_get_boneabs_hidden