]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/menu/xonotic/dialog_settings_input.c
Merge branch 'master' into divVerent/rank-change
[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, 17)
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                         me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "joy_enable", _("Use joystick input")));
53                 else if(cvar_type("joystick") & CVAR_TYPEFLAG_ENGINE)
54                         me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "joystick", _("Use joystick input")));
55                 else
56                 {
57                         me.TD(me, 1, 3, e = makeXonoticCheckBox(0, string_null, _("Use joystick input")));
58                         e.disabled = 1; // the option is never available in this case, just there for show
59                 }
60         me.TR(me);
61         me.TR(me);
62                 me.TD(me, 1, 3, e = makeXonoticTextLabel(0, _("Mouse:")));
63         me.TR(me);
64                 me.TDempty(me, 0.2);
65                 me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Sensitivity:")));
66                 me.TD(me, 1, 2, e = makeXonoticSlider(1, 32, 0.2, "sensitivity"));
67         me.TR(me);
68                 me.TDempty(me, 0.2);
69                 me.TD(me, 1, 2.8, e = makeXonoticCheckBox(0, "m_filter", _("Smooth aiming")));
70         me.TR(me);
71                 me.TDempty(me, 0.2);
72                 me.TD(me, 1, 2.8, e = makeXonoticCheckBox(1.022, "m_pitch", _("Invert aiming")));
73         me.TR(me);
74                 me.TDempty(me, 0.2);
75                 if(cvar_type("vid_dgamouse") & CVAR_TYPEFLAG_ENGINE)
76                         me.TD(me, 1, 2.8, e = makeXonoticCheckBox(0, "vid_dgamouse", _("Disable system mouse acceleration")));
77                 else if(cvar_type("apple_mouse_noaccel") & CVAR_TYPEFLAG_ENGINE)
78                         me.TD(me, 1, 2.8, e = makeXonoticCheckBox(0, "apple_mouse_noaccel", _("Disable system mouse acceleration")));
79                 else
80                 {
81                         me.TD(me, 1, 2.8, e = makeXonoticCheckBox(0, string_null, _("Disable system mouse acceleration")));
82                         e.disabled = 1; // the option is never available in this case, just there for show
83                 }
84         me.TR(me);
85                 me.TDempty(me, 0.2);
86                 me.TD(me, 1, 2.8, e = makeXonoticCheckBox(0, "m_accelerate", _("Enable built in mouse acceleration")));
87                 
88         
89         me.gotoRC(me, me.rows - 1, 0);
90                 me.TD(me, 1, me.columns, makeXonoticCommandButton(_("Apply immediately"), '0 0 0', "sendcvar cl_movement_track_canjump", COMMANDBUTTON_APPLY));
91 }
92 #endif