]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/menu/xonotic/dialog_settings_input.c
Add menu_mouse_absolute and hud_cursormode to the menu
[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                 me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "menu_mouse_absolute", _("Use system mouse positioning")));
63                         makeMulti(e, "hud_cursormode");
64         me.TR(me);
65                 me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "m_accelerate", _("Enable built in mouse acceleration")));
66         me.TR(me);
67                 if(cvar_type("vid_dgamouse") & CVAR_TYPEFLAG_ENGINE)
68                         me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "vid_dgamouse", _("Disable system mouse acceleration")));
69                 else if(cvar_type("apple_mouse_noaccel") & CVAR_TYPEFLAG_ENGINE)
70                         me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "apple_mouse_noaccel", _("Disable system mouse acceleration")));
71                 else
72                 {
73                         me.TD(me, 1, 3, e = makeXonoticCheckBox(0, string_null, _("Disable system mouse acceleration")));
74                         e.disabled = 1; // the option is never available in this case, just there for show
75                 }
76
77         me.TR(me);
78         me.TR(me);
79                 me.TD(me, 1, 3, e = makeXonoticTextLabel(0.5, _("Other")));
80                         e.isBold = TRUE;
81                         e.alpha = 0.5;
82         me.TR(me);
83                 me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "con_closeontoggleconsole", _("Pressing \"enter console\" key also closes it")));
84         me.TR(me);
85                 me.TD(me, 1, 3, e = makeXonoticCheckBox(1, "cl_movement_track_canjump", _("Automatically repeat jumping if holding jump")));
86                         e.sendCvars = TRUE;
87         me.TR(me);
88         me.TR(me);
89                 if(cvar_type("joy_enable") & CVAR_TYPEFLAG_ENGINE)
90                 {
91                         me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "joy_enable", _("Use joystick input")));
92                         setDependent(e, "joy_detected", 1, 10000000);
93                 }
94                 else if(cvar_type("joystick") & CVAR_TYPEFLAG_ENGINE)
95                 {
96                         me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "joystick", _("Use joystick input")));
97                         setDependent(e, "joy_detected", 1, 10000000);
98                 }
99                 else
100                 {
101                         me.TD(me, 1, 3, e = makeXonoticCheckBox(0, string_null, _("Use joystick input")));
102                         e.disabled = 1; // the option is never available in this case, just there for show
103                 }
104 }
105 #endif