-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathmenu_example.cfg
More file actions
239 lines (220 loc) · 8.3 KB
/
menu_example.cfg
File metadata and controls
239 lines (220 loc) · 8.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
// ----------------------------------------------------------------------------
// CUSTOM IMGUI MENU CONFIG EXAMPLE
// This file is both a working example and documentation for the menu format.
// Save as, for example: valve/menu_example.cfg
//
// Load in-game with:
// exec_menu menu_example.cfg
//
// GLOBAL IMGUI STYLE (OPTIONAL)
//
// These commands (stylecolor/stylevar/stylevar2) must appear BEFORE the first
// 'window' directive. They override the built-in default style used by the
// code. You can remove this whole section if you like the default style.
// ----------------------------------------------------------------------------
// stylecolor <Name> R G B A -- all values are floats [0..1]
stylecolor Text 1.00 1.00 1.00 1.00
stylecolor WindowBg 0.06 0.06 0.06 0.94
stylecolor Button 0.26 0.59 0.98 0.40
stylecolor ButtonHovered 0.26 0.59 0.98 1.00
stylecolor ButtonActive 0.06 0.53 0.98 1.00
// stylevar <Name> value -- single float style variables
stylevar Alpha 1.0
stylevar WindowRounding 3.0
// stylevar2 <Name> X Y -- ImVec2 style variables
stylevar2 WindowPadding 8 8
stylevar2 ItemSpacing 8 4
// ----------------------------------------------------------------------------
// window "Title" { ... }
//
// - Title must be in quotes.
// - Everything inside { } are menu items or sub-blocks (submenu/tabbar/tab).
// ----------------------------------------------------------------------------
window "Example Menu"
{
// ------------------------------------------------------------------------
// text "Label"
// - Draws a simple text label.
// ------------------------------------------------------------------------
text "Example custom ImGui menu built from cfg"
// Blank line and separator line for readability
separator
// ------------------------------------------------------------------------
// cvar_check "Label" "cvar"
// - Displays the current value of a console variable (cvar).
// - Automatically detects and shows:
// • int (e.g. fps_max -> 101)
// • float (e.g. sensitivity -> 2.5)
// • string (e.g. name -> Player)
// - Read-only: does NOT modify the cvar value.
// - If the cvar does not exist, shows "<not found>".
// ------------------------------------------------------------------------
cvar_check "Sensitivity" "sensitivity"
cvar_check "FPS limit" "fps_max"
cvar_check "Player name" "name"
separator
// ------------------------------------------------------------------------
// IMAGE
//
// image "texture_path" width height
//
// Supported image formats:
// bmp, jpg, tga, png
// ------------------------------------------------------------------------
image "gfx/env/2desertbk.tga" 125 125
separator
// ------------------------------------------------------------------------
// IMAGE BUTTONS
//
// image_button "Label" "command" "texture_path" width height
//
// Supported image formats:
// bmp, jpg, tga, png
// ------------------------------------------------------------------------
image_button "null" "null" "gfx/env/2desertbk.tga" 64 64
same_line
image_button "null" "null" "gfx/env/2desertbk.tga" 64 64
same_line
image_button "null" "null" "gfx/env/2desertbk.tga" 64 64
separator
// ------------------------------------------------------------------------
// BUTTONS
// button "Label" "command"
//
// IMPORTANT: Label and command MUST be on the SAME LINE, both in quotes.
// ------------------------------------------------------------------------
button "Say: Hello" "say Hello from cfg menu!"
same_line
button "Rofl" "kill"
separator
// ------------------------------------------------------------------------
// CHECKBOXES
// checkbox "Label" "cvar_name"
//
// - The checkbox is bound to a cvar
// ------------------------------------------------------------------------
checkbox "HUD Visualization" "hud_vis"
checkbox "Show FPS" "cl_showfps"
checkbox "Show viewmodel" "r_drawviewmodel"
separator
// ------------------------------------------------------------------------
// SUBMENUS
// submenu "Title" { ... }
//
// - Collapsible section.
// - You can nest submenus inside each other.
// ------------------------------------------------------------------------
submenu "HL1 Sounds"
{
text "Play Half-Life 1 sounds using the 'play' command"
submenu "Weapons"
{
button "Glock fire" "play weapons/pl_gun3.wav"
button "MP5 fire" "play weapons/hks1.wav"
button "Shotgun fire" "play weapons/sbarrel1.wav"
separator
submenu "Explosions"
{
button "Grenade explode" "play weapons/explode3.wav"
button "Satchel explode" "play weapons/explode4.wav"
button "Big explosion" "play weapons/explode5.wav"
}
}
submenu "NPC Voices"
{
button "Scientist pain" "play scientist/sci_pain4.wav"
button "Barney: Need help" "play barney/c2a5_ba_helpme.wav"
button "Hgrunt: bastard!" "play hgrunt/bastard!.wav"
}
}
// ------------------------------------------------------------------------
// TAB BARS
// tabbar "BarName" { ... tabs ... }
// tab "TabName" { ... items ... }
//
// - tabbar defines a group of tabs.
// - Inside tabbar, you define multiple tab blocks.
// - Each tab must have a body { ... } with content.
// ------------------------------------------------------------------------
tabbar "MainTabs"
{
tab "Gameplay"
{
text "Some (cheat) commands:"
checkbox "Cheats" "sv_cheats"
button "Noclip" "noclip"
button "God mode" "god"
button "Give all" "impulse 101"
}
tab "Maps"
{
text "Select a map:"
button "Crossfire" "map crossfire"
button "Anomalous Materials""map c1a0"
}
}
separator
// ------------------------------------------------------------------------
// SLIDER_FLOAT
// slider_float "Label" "cvar_name" min max
// ------------------------------------------------------------------------
text "Float slider:"
slider_float "Gamma" "gamma" 0.0 3.0
// ------------------------------------------------------------------------
// SLIDER_INT
// slider_int "Label" "cvar_name" min max
// ------------------------------------------------------------------------
text "Integer slider:"
slider_int "Net graph" "net_graph" 0 2
// ------------------------------------------------------------------------
// COLOR_CVAR
// color_cvar "Label" "cvar_name"
// ------------------------------------------------------------------------
text "CVar-based color:"
color_cvar "HUD main color" "hud_color"
// ------------------------------------------------------------------------
// SPACE
// space
//
// - Inserts a vertical empty gap between items.
// - Unlike separator, it does NOT draw a line, only adds spacing.
// ------------------------------------------------------------------------
space
separator
// ------------------------------------------------------------------------
// CONDITION
//
// condition "cvar" <operator> value { ... }
//
// Supported operators:
// == != > >= < <=
//
// The block { ... } will be shown ONLY if the condition is true.
// You can place ANY menu items inside the condition block:
// - text
// - button
// - checkbox
// - submenu
// - tab
// - tabbar
// ------------------------------------------------------------------------
condition "sv_cheats" != 1
{
text "Cheats are DISABLED"
space
button "Enable cheats" "sv_cheats 1"
}
condition "sv_cheats" >= 1
{
text "Cheats are ENABLED"
space
button "Disable cheats" "sv_cheats 0"
}
separator
space
// ------------------------------------------------------------------------
// CLOSE MENU BUTTON
// close_menu "Label"
// ------------------------------------------------------------------------
close_menu "Close"
}