]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/menu/xonotic/dialog_settings_input.c
Check for joy_detected when displaying "Use joystick input" checkbox
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / dialog_settings_input.c
1 #ifdef INTERFACE
2 CLASS(XonoticInputSettingsTab) EXTENDS(XonoticTab)
3         METHOD(XonoticInputSettingsTab, fill, void(entity))
4         ATTRIB(XonoticInputSettingsTab, title, string, _("Input"))
5         ATTRIB(XonoticInputSettingsTab, intendedWidth, float, 0.9)
6         ATTRIB(XonoticInputSettingsTab, rows, float, 15.5)
7         ATTRIB(XonoticInputSettingsTab, columns, float, 6.2) // added extra .2 for center space
8 ENDCLASS(XonoticInputSettingsTab)
9 entity makeXonoticInputSettingsTab();
10 #endif
11
12 #ifdef IMPLEMENTATION
13 entity makeXonoticInputSettingsTab()
14 {
15         entity me;
16         me = spawnXonoticInputSettingsTab();
17         me.configureDialog(me);
18         return me;
19 }
20 void XonoticInputSettingsTab_fill(entity me)
21 {
22         entity e;
23         entity kb;
24
25         me.TR(me);
26                 me.TD(me, 1, 3, e = makeXonoticTextLabel(0, _("Key bindings:")));
27         me.TR(me);
28                 me.TD(me, me.rows - 4, 3, kb = makeXonoticKeyBinder());
29         me.gotoRC(me, me.rows - 3, 0);
30                 me.TD(me, 1, 1, e = makeXonoticButton(_("Change key..."), '0 0 0'));
31                         e.onClick = KeyBinder_Bind_Change;
32                         e.onClickEntity = kb;
33                         kb.keyGrabButton = e;
34                 me.TD(me, 1, 1, e = makeXonoticButton(_("Edit..."), '0 0 0'));
35                         e.onClick = KeyBinder_Bind_Edit;
36                         e.onClickEntity = kb;
37                         kb.userbindEditButton = e;
38                         kb.userbindEditDialog = main.userbindEditDialog;
39                         main.userbindEditDialog.keybindBox = kb;
40                 me.TD(me, 1, 1, e = makeXonoticButton(_("Clear"), '0 0 0'));
41                         e.onClick = KeyBinder_Bind_Clear;
42                         e.onClickEntity = kb;
43                         kb.clearButton = e;
44
45         me.gotoRC(me, 0, 3.2); me.setFirstColumn(me, me.currentColumn);
46                 me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "con_closeontoggleconsole", _("Pressing \"enter console\" key also closes it")));
47         me.TR(me);
48                 me.TD(me, 1, 3, e = makeXonoticCheckBox(1, "cl_movement_track_canjump", _("Automatically repeat jumping if holding jump")));
49         me.TR(me);
50         me.TR(me);
51                 if(cvar_type("joy_enable") & CVAR_TYPEFLAG_ENGINE)
52                 {
53                         me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "joy_enable", _("Use joystick input")));
54                         setDependent(e, "joy_detected", 1, 10000000);
55                 }
56                 else if(cvar_type("joystick") & CVAR_TYPEFLAG_ENGINE)
57                 {
58                         me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "joystick", _("Use joystick input")));
59                         setDependent(e, "joy_detected", 1, 10000000);
60                 }
61                 else
62                 {
63                         me.TD(me, 1, 3, e = makeXonoticCheckBox(0, string_null, _("Use joystick input")));
64                         e.disabled = 1; // the option is never available in this case, just there for show
65                 }
66         me.TR(me);
67         me.TR(me);
68                 me.TD(me, 1, 3, e = makeXonoticTextLabel(0, _("Mouse:")));
69         me.TR(me);
70                 me.TDempty(me, 0.2);
71                 me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Sensitivity:")));
72                 me.TD(me, 1, 2, e = makeXonoticSlider(1, 32, 0.2, "sensitivity"));
73         me.TR(me);
74                 me.TDempty(me, 0.2);
75                 me.TD(me, 1, 2.8, e = makeXonoticCheckBox(0, "m_filter", _("Smooth aiming")));
76         me.TR(me);
77                 me.TDempty(me, 0.2);
78                 me.TD(me, 1, 2.8, e = makeXonoticCheckBox(1.022, "m_pitch", _("Invert aiming")));
79         me.TR(me);
80                 me.TDempty(me, 0.2);
81                 if(cvar_type("vid_dgamouse") & CVAR_TYPEFLAG_ENGINE)
82                         me.TD(me, 1, 2.8, e = makeXonoticCheckBox(0, "vid_dgamouse", _("Disable system mouse acceleration")));
83                 else if(cvar_type("apple_mouse_noaccel") & CVAR_TYPEFLAG_ENGINE)
84                         me.TD(me, 1, 2.8, e = makeXonoticCheckBox(0, "apple_mouse_noaccel", _("Disable system mouse acceleration")));
85                 else
86                 {
87                         me.TD(me, 1, 2.8, e = makeXonoticCheckBox(0, string_null, _("Disable system mouse acceleration")));
88                         e.disabled = 1; // the option is never available in this case, just there for show
89                 }
90         me.TR(me);
91                 me.TDempty(me, 0.2);
92                 me.TD(me, 1, 2.8, e = makeXonoticCheckBox(0, "m_accelerate", _("Enable built in mouse acceleration")));
93
94
95         me.gotoRC(me, me.rows - 1.25, 0);
96                 me.TD(me, 1, me.columns, makeXonoticCommandButton(_("Apply immediately"), '0 0 0', "sendcvar cl_movement_track_canjump", COMMANDBUTTON_APPLY));
97 }
98 #endif