]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/menu/xonotic/dialog_settings_input.c
2f2c1c01cc53efe717542899f90baff1b60f56d6
[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, 14.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.5, _("Key Bindings")));
27                         e.isBold = TRUE;
28                         e.alpha = 0.5;
29         me.TR(me);
30                 me.TD(me, me.rows - 2.5, 3, kb = makeXonoticKeyBinder());
31         me.gotoRC(me, me.rows - 1.5, 0);
32                 me.TD(me, 1, 1, e = makeXonoticButton(_("Change key..."), '0 0 0'));
33                         e.onClick = KeyBinder_Bind_Change;
34                         e.onClickEntity = kb;
35                         kb.keyGrabButton = e;
36                 me.TD(me, 1, 1, e = makeXonoticButton(_("Edit..."), '0 0 0'));
37                         e.onClick = KeyBinder_Bind_Edit;
38                         e.onClickEntity = kb;
39                         kb.userbindEditButton = e;
40                         kb.userbindEditDialog = main.userbindEditDialog;
41                         main.userbindEditDialog.keybindBox = kb;
42                 me.TD(me, 1, 1, e = makeXonoticButton(_("Clear"), '0 0 0'));
43                         e.onClick = KeyBinder_Bind_Clear;
44                         e.onClickEntity = kb;
45                         kb.clearButton = e;
46
47         // todo:
48         // add menu_mouse_absolute and hud_cursormode here
49
50         me.gotoRC(me, 0, 3.2); me.setFirstColumn(me, me.currentColumn);
51                 me.TD(me, 1, 3, e = makeXonoticTextLabel(0.5, _("Mouse")));
52                         e.isBold = TRUE;
53                         e.alpha = 0.5;
54         me.TR(me);
55                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Sensitivity:")));
56                 me.TD(me, 1, 2, e = makeXonoticSlider(1, 32, 0.2, "sensitivity"));
57         me.TR(me);
58                 me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "m_filter", _("Smooth aiming")));
59         me.TR(me);
60                 me.TD(me, 1, 3, e = makeXonoticCheckBox(1.022, "m_pitch", _("Invert aiming")));
61         me.TR(me);
62                 if(cvar_type("vid_dgamouse") & CVAR_TYPEFLAG_ENGINE)
63                         me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "vid_dgamouse", _("Disable system mouse acceleration")));
64                 else if(cvar_type("apple_mouse_noaccel") & CVAR_TYPEFLAG_ENGINE)
65                         me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "apple_mouse_noaccel", _("Disable system mouse acceleration")));
66                 else
67                 {
68                         me.TD(me, 1, 3, e = makeXonoticCheckBox(0, string_null, _("Disable system mouse acceleration")));
69                         e.disabled = 1; // the option is never available in this case, just there for show
70                 }
71         me.TR(me);
72                 me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "m_accelerate", _("Enable built in mouse acceleration")));
73
74         me.TR(me);
75         me.TR(me);
76                 me.TD(me, 1, 3, e = makeXonoticTextLabel(0.5, _("Other")));
77                         e.isBold = TRUE;
78                         e.alpha = 0.5;
79         me.TR(me);
80                 me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "con_closeontoggleconsole", _("Pressing \"enter console\" key also closes it")));
81         me.TR(me);
82                 me.TD(me, 1, 3, e = makeXonoticCheckBox(1, "cl_movement_track_canjump", _("Automatically repeat jumping if holding jump")));
83                         e.sendCvars = TRUE;
84         me.TR(me);
85         me.TR(me);
86                 if(cvar_type("joy_enable") & CVAR_TYPEFLAG_ENGINE)
87                 {
88                         me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "joy_enable", _("Use joystick input")));
89                         setDependent(e, "joy_detected", 1, 10000000);
90                 }
91                 else if(cvar_type("joystick") & CVAR_TYPEFLAG_ENGINE)
92                 {
93                         me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "joystick", _("Use joystick input")));
94                         setDependent(e, "joy_detected", 1, 10000000);
95                 }
96                 else
97                 {
98                         me.TD(me, 1, 3, e = makeXonoticCheckBox(0, string_null, _("Use joystick input")));
99                         e.disabled = 1; // the option is never available in this case, just there for show
100                 }
101 }
102 #endif