Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
entries.qc File Reference
Include dependency graph for entries.qc:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

entity EntryList_Set_StringFilterBox (entity me, entity e)
void EntryList_StringFilterBox_Change (entity box, entity me)
float EntryList_StringFilterBox_keyDown (entity me, float scan, float ascii, float shift)
void XonoticEntryList_cb (string _name, string _icon)
void XonoticEntryList_drawListBoxItem (entity me, int i, vector absSize, bool isSelected, bool isFocused)
void XonoticEntryList_refilter (entity me)
void XonoticEntryList_resizeNotify (entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
void XonoticEntryList_setSelected (entity me, int i)

Variables

string XonoticEntryList_cb_icon
string XonoticEntryList_cb_name

Function Documentation

◆ EntryList_Set_StringFilterBox()

entity EntryList_Set_StringFilterBox ( entity me,
entity e )

Definition at line 14 of file entries.qc.

15{
16 me.stringFilterBox = e;
17 return e;
18}

References entity().

◆ EntryList_StringFilterBox_Change()

void EntryList_StringFilterBox_Change ( entity box,
entity me )

Definition at line 156 of file entries.qc.

157{
158 strfree(me.stringFilter);
159 if (box.text != "")
160 me.stringFilter = strzone(box.text);
161
162 me.refilter(me);
163}
string strzone(string s)
#define strfree(this)
Definition string.qh:59

References entity(), strfree, and strzone().

Referenced by XonoticEntryList::keyDown(), XonoticGuideTab_fill(), and XonoticGuideTab_topicChangeNotify().

◆ EntryList_StringFilterBox_keyDown()

float EntryList_StringFilterBox_keyDown ( entity me,
float scan,
float ascii,
float shift )

Definition at line 106 of file entries.qc.

107{
108 // in this section, note that onChangeEntity has the ref to entryList
109 // we make use of that, instead of extending a class to add one more attrib
110 switch (scan)
111 {
112 case K_KP_ENTER:
113 case K_ENTER:
114 // move the focus to the entryList
115 me.onChangeEntity.parent.setFocus(me.onChangeEntity.parent, me.onChangeEntity);
116 return 1;
117 case K_KP_UPARROW:
118 case K_UPARROW:
119 case K_KP_DOWNARROW:
120 case K_DOWNARROW:
121 // pass the event to the entryList (to scroll up and down)
122 return me.onChangeEntity.keyDown(me.onChangeEntity, scan, ascii, shift);
123 }
124 return SUPER(XonoticInputBox).keyDown(me, scan, ascii, shift);
125}
float K_UPARROW
Definition keycodes.qc:15
float K_DOWNARROW
Definition keycodes.qc:16
float K_KP_UPARROW
Definition keycodes.qc:64
float K_ENTER
Definition keycodes.qc:8
float K_KP_DOWNARROW
Definition keycodes.qc:53
float K_KP_ENTER
Definition keycodes.qc:74
#define SUPER(cname)
Definition oo.qh:231

References entity(), K_DOWNARROW, K_ENTER, K_KP_DOWNARROW, K_KP_ENTER, K_KP_UPARROW, K_UPARROW, and SUPER.

Referenced by XonoticGuideTab_fill().

◆ XonoticEntryList_cb()

void XonoticEntryList_cb ( string _name,
string _icon )

Definition at line 8 of file entries.qc.

9{
12}
string XonoticEntryList_cb_name
Definition entries.qc:7
string XonoticEntryList_cb_icon
Definition entries.qc:7

References XonoticEntryList_cb_icon, and XonoticEntryList_cb_name.

Referenced by XonoticEntryList_drawListBoxItem(), and XonoticEntryList_refilter().

◆ XonoticEntryList_drawListBoxItem()

void XonoticEntryList_drawListBoxItem ( entity me,
int i,
vector absSize,
bool isSelected,
bool isFocused )

Definition at line 20 of file entries.qc.

21{
22 if (!me.source)
23 return;
24 if (!me.source.getEntry(me.source, i, XonoticEntryList_cb))
25 return;
26
27 if (isSelected)
28 draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
29 else if (isFocused)
30 {
31 me.focusedItemAlpha = getFadedAlpha(me.focusedItemAlpha, SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED);
32 draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_FOCUSED, me.focusedItemAlpha);
33 }
34
35 vector sz;
37 sz = me.rowsPerItem * 0.5 * me.realFontSize.x * eX;
38 else
39 {
41 if (!sz)
42 sz = '1 1 0';
43 float szr = sz.x / sz.y;
44 //if (strstrofs(XonoticEntryList_cb_icon, "map", 0) >= 0)
45 //szr = 4 / 3;
46 const float asr = me.itemAbsSize.x / me.itemAbsSize.y;
47 sz.y = 1;
48 sz.x = szr / asr;
49 draw_Picture('0 0 0', XonoticEntryList_cb_icon, sz, '1 1 1', SKINALPHA_LISTBOX_SELECTED);
50 sz.x += 0.5 * me.realFontSize.x;
51 }
52
53 // display maximum 2 lines, last potentially truncated, vertically centered
54 string s;
55 vector pos = me.realUpperMargin * eY + sz.x * eX;
56 const float maxWidth = 1 - sz.x - me.realFontSize.x;
58 s = getWrappedLine(maxWidth, me.realFontSize, draw_TextWidth_WithoutColors);
60 {
61 pos.y -= 0.5 * me.realFontSize.y;
62 draw_Text(pos, s, me.realFontSize, '1 1 1', SKINALPHA_TEXT, false);
63 s = draw_TextShortenToWidth(getWrappedLine_remaining, maxWidth, false, me.realFontSize);
64 pos.y += me.realFontSize.y;
65 }
66 draw_Text(pos, s, me.realFontSize, '1 1 1', SKINALPHA_TEXT, false);
67}
string getWrappedLine(float maxWidth, vector theFontSize, textLengthUpToWidth_widthFunction_t tw)
Definition util.qc:995
string getWrappedLine_remaining
Definition util.qh:147
void XonoticEntryList_cb(string _name, string _icon)
Definition entries.qc:8
string draw_TextShortenToWidth(string theText, float maxWidth, float ICanHasKallerz, vector SizeThxBye)
Definition draw.qc:377
float draw_TextWidth_WithoutColors(string s, vector theFontSize)
Definition draw.qc:396
void draw_Picture(vector theOrigin, string pic, vector theSize, vector theColor, float theAlpha)
Definition draw.qc:72
void draw_Text(vector theOrigin, string theText, vector theSize, vector theColor, float theAlpha, float ICanHasKallerz)
Definition draw.qc:282
vector draw_PictureSize(string pic)
Definition draw.qc:80
void draw_Fill(vector theOrigin, vector theSize, vector theColor, float theAlpha)
Definition draw.qc:97
string draw_PreloadPicture(string pic)
Definition draw.qc:60
float getFadedAlpha(float currentAlpha, float startAlpha, float targetAlpha)
Definition util.qc:816
vector
Definition self.qh:92
const vector eY
Definition vector.qh:45
const vector eX
Definition vector.qh:44

References draw_Fill(), draw_Picture(), draw_PictureSize(), draw_PreloadPicture(), draw_Text(), draw_TextShortenToWidth(), draw_TextWidth_WithoutColors(), entity(), eX, eY, getFadedAlpha(), getWrappedLine(), getWrappedLine_remaining, vector, XonoticEntryList_cb(), XonoticEntryList_cb_icon, and XonoticEntryList_cb_name.

◆ XonoticEntryList_refilter()

void XonoticEntryList_refilter ( entity me)

Definition at line 127 of file entries.qc.

128{
129 if (!me.source)
130 {
131 me.nItems = 0;
132 return;
133 }
134 string oldName;
135 if (me.selectedItem >= 0) // if negative we just switched source
136 {
137 me.source.getEntry(me.source, me.selectedItem, XonoticEntryList_cb);
138 oldName = XonoticEntryList_cb_name; // keep oldName selected if still present
139 }
140 else
141 oldName = "";
142
143 int newSelectedItem = 0;
144 me.nItems = me.source.reload(me.source, me.stringFilter);
145 for (int i = 0, n = me.nItems; i < n; ++i)
146 if (me.source.getEntry(me.source, i, XonoticEntryList_cb))
147 {
148 if (XonoticEntryList_cb_icon != "")
150 if (XonoticEntryList_cb_name == oldName)
151 newSelectedItem = i;
152 }
153 me.setSelected(me, newSelectedItem);
154}

References draw_PreloadPicture(), entity(), XonoticEntryList_cb(), XonoticEntryList_cb_icon, and XonoticEntryList_cb_name.

◆ XonoticEntryList_resizeNotify()

void XonoticEntryList_resizeNotify ( entity me,
vector relOrigin,
vector relSize,
vector absOrigin,
vector absSize )

Definition at line 165 of file entries.qc.

166{
167 me.itemAbsSize = '0 0 0';
168 SUPER(XonoticEntryList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
169
170 me.itemAbsSize.y = absSize.y * me.itemHeight;
171 me.itemAbsSize.x = absSize.x * (1 - me.controlWidth);
172 me.realFontSize.y = me.fontSize / me.itemAbsSize.y;
173 me.realFontSize.x = me.fontSize / me.itemAbsSize.x;
174 me.realUpperMargin = 0.5 * (1 - me.realFontSize.y);
175}

References entity(), SUPER, and vector.

◆ XonoticEntryList_setSelected()

void XonoticEntryList_setSelected ( entity me,
int i )

Definition at line 177 of file entries.qc.

178{
179 SUPER(XonoticEntryList).setSelected(me, i);
180 me.onChange(me, me.onChangeEntity);
181}

References entity(), and SUPER.

Variable Documentation

◆ XonoticEntryList_cb_icon

string XonoticEntryList_cb_icon

◆ XonoticEntryList_cb_name

string XonoticEntryList_cb_name