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

Go to the source code of this file.

Functions

void XonoticTopicList_cb (string _name, string _icon)
void XonoticTopicList_clickListBoxItem (entity me, float i, vector where)
void XonoticTopicList_drawListBoxItem (entity me, int i, vector absSize, bool isSelected, bool isFocused)
bool XonoticTopicList_keyDown (entity me, float scan, float ascii, float shift)
void XonoticTopicList_resizeNotify (entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
void XonoticTopicList_setSelected (entity me, int i)

Variables

string XonoticTopicList_cb_icon
string XonoticTopicList_cb_name

Function Documentation

◆ XonoticTopicList_cb()

void XonoticTopicList_cb ( string _name,
string _icon )

Definition at line 11 of file topics.qc.

12{
15}
string XonoticTopicList_cb_name
Definition topics.qc:10
string XonoticTopicList_cb_icon
Definition topics.qc:10

References XonoticTopicList_cb_icon, and XonoticTopicList_cb_name.

Referenced by XonoticTopicList_drawListBoxItem().

◆ XonoticTopicList_clickListBoxItem()

void XonoticTopicList_clickListBoxItem ( entity me,
float i,
vector where )

Definition at line 5 of file topics.qc.

6{
8}
void m_play_click_sound(string soundfile)
Definition menu.qc:1106
const string MENU_SOUND_SELECT
Definition menu.qh:54

References entity(), m_play_click_sound(), MENU_SOUND_SELECT, and vector.

◆ XonoticTopicList_drawListBoxItem()

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

Definition at line 17 of file topics.qc.

18{
19 if (!me.source)
20 return;
21 if (!me.source.getEntry(me.source, i, XonoticTopicList_cb))
22 return;
23
24 if (isSelected)
25 draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
26 else if (isFocused)
27 {
28 me.focusedItemAlpha = getFadedAlpha(me.focusedItemAlpha, SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED);
29 draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_FOCUSED, me.focusedItemAlpha);
30 }
31 draw_Picture(me.columnIconOrigin * eX, XonoticTopicList_cb_icon, me.columnIconSize * eX + eY, '1 1 1', SKINALPHA_LISTBOX_SELECTED);
32
33 // condense text so it's shown without truncating, vertically centered
34 const vector save_fontscale = draw_fontscale;
35 const float f = draw_CondensedFontFactor(XonoticTopicList_cb_name, false, me.realFontSize, me.columnNameSize);
36 draw_fontscale.x *= f;
37 vector fs = me.realFontSize;
38 fs.x *= f;
39 draw_Text(me.realUpperMargin * eY + me.columnNameOrigin * eX, XonoticTopicList_cb_name, fs, '1 1 1', SKINALPHA_TEXT, 0);
40 draw_fontscale = save_fontscale;
41}
void draw_Picture(vector theOrigin, string pic, vector theSize, vector theColor, float theAlpha)
Definition draw.qc:72
float draw_CondensedFontFactor(string theText, float ICanHasKallerz, vector SizeThxBye, float maxWidth)
Definition draw.qc:316
void draw_Text(vector theOrigin, string theText, vector theSize, vector theColor, float theAlpha, float ICanHasKallerz)
Definition draw.qc:282
void draw_Fill(vector theOrigin, vector theSize, vector theColor, float theAlpha)
Definition draw.qc:97
#define draw_fontscale
Definition draw.qh:5
float getFadedAlpha(float currentAlpha, float startAlpha, float targetAlpha)
Definition util.qc:816
vector
Definition self.qh:92
void XonoticTopicList_cb(string _name, string _icon)
Definition topics.qc:11
const vector eY
Definition vector.qh:45
const vector eX
Definition vector.qh:44

References draw_CondensedFontFactor(), draw_Fill(), draw_fontscale, draw_Picture(), draw_Text(), entity(), eX, eY, getFadedAlpha(), vector, XonoticTopicList_cb(), XonoticTopicList_cb_icon, and XonoticTopicList_cb_name.

◆ XonoticTopicList_keyDown()

bool XonoticTopicList_keyDown ( entity me,
float scan,
float ascii,
float shift )

Definition at line 43 of file topics.qc.

44{
45 if (scan == K_ENTER || scan == K_KP_ENTER)
46 {
48 return true;
49 }
50 return SUPER(XonoticEntryList).keyDown(me, scan, ascii, shift);
51}
float K_ENTER
Definition keycodes.qc:8
float K_KP_ENTER
Definition keycodes.qc:74
const string MENU_SOUND_EXECUTE
Definition menu.qh:51
#define SUPER(cname)
Definition oo.qh:231

References entity(), K_ENTER, K_KP_ENTER, m_play_click_sound(), MENU_SOUND_EXECUTE, and SUPER.

◆ XonoticTopicList_resizeNotify()

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

Definition at line 53 of file topics.qc.

54{
55 me.itemAbsSize = '0 0 0';
56 SUPER(XonoticEntryList).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
57
58 me.itemAbsSize.y = absSize.y * me.itemHeight;
59 me.itemAbsSize.x = absSize.x * (1 - me.controlWidth);
60 me.realFontSize.y = me.fontSize / me.itemAbsSize.y;
61 me.realFontSize.x = me.fontSize / me.itemAbsSize.x;
62 me.realUpperMargin = 0.5 * (1 - me.realFontSize.y);
63 me.columnIconOrigin = 0;
64 me.columnIconSize = me.itemAbsSize.y / me.itemAbsSize.x;
65 me.columnNameOrigin = me.columnIconOrigin + me.columnIconSize + (0.5 * me.realFontSize.x);
66 me.columnNameSize = 1 - me.columnNameOrigin - me.realFontSize.x;
67}

References entity(), SUPER, and vector.

◆ XonoticTopicList_setSelected()

void XonoticTopicList_setSelected ( entity me,
int i )

Definition at line 69 of file topics.qc.

70{
71 int curr = me.selectedItem;
72 SUPER(XonoticEntryList).setSelected(me, i);
73 if (curr != me.selectedItem)
74 me.onChange(me, me.onChangeEntity);
75}

References entity(), and SUPER.

Variable Documentation

◆ XonoticTopicList_cb_icon

string XonoticTopicList_cb_icon

Definition at line 10 of file topics.qc.

Referenced by XonoticTopicList_cb(), and XonoticTopicList_drawListBoxItem().

◆ XonoticTopicList_cb_name

string XonoticTopicList_cb_name

Definition at line 10 of file topics.qc.

Referenced by XonoticTopicList_cb(), and XonoticTopicList_drawListBoxItem().