rustyray_sys/consts.rs
1use bitmask_enum::bitmask;
2
3/// Mouse buttons
4#[repr(i32)]
5#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
6pub enum MouseButton {
7 /// Mouse button left
8 Left,
9 /// Mouse button right
10 Right,
11 /// Mouse button middle (pressed wheel)
12 Middle,
13 /// Mouse button side (advanced mouse device)
14 Side,
15 /// Mouse button extra (advanced mouse device)
16 Extra,
17 /// Mouse button forward (advanced mouse device)
18 Forward,
19 /// Mouse button back (advanced mouse device)
20 Back,
21}
22
23/// Mouse cursor
24#[repr(i32)]
25#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
26pub enum MouseCursor {
27 /// Default pointer shape
28 Default,
29 /// Arrow shape
30 Arrow,
31 /// Text writing cursor shape
32 Ibeam,
33 /// Cross shape
34 Crosshair,
35 /// Pointing hand cursor
36 PointingHand,
37 /// Horizontal resize/move arrow shape
38 ResizeEW,
39 /// Vertical resize/move arrow shape
40 ResizeNS,
41 /// Top-left to bottom-right diagonal resize/move arrow shape
42 ResizeNWSE,
43 /// Top-right to bottom-left diagonal resize/move arrow shape
44 ResizeNESW,
45 /// The omnidirectional resize/move cursor shape
46 ResizeAll,
47 /// The operation-not-allowed shape
48 NotAllowed,
49}
50
51/// Gamepad buttons
52#[repr(i32)]
53#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
54pub enum GamepadButton {
55 /// Unknown button, just for error checking
56 UNKNOWN = 0,
57 /// Gamepad left DPAD up button
58 LeftFaceUp,
59 /// Gamepad left DPAD right button
60 LeftFaceRight,
61 /// Gamepad left DPAD down button
62 LeftFaceDown,
63 /// Gamepad left DPAD left button
64 LeftFaceLeft,
65 /// Gamepad right button up (i.e. PS3: Triangle, Xbox: Y)
66 RightFaceUp,
67 /// Gamepad right button right (i.e. PS3: Circle, Xbox: B)
68 RightFaceRight,
69 /// Gamepad right button down (i.e. PS3: Cross, Xbox: A)
70 RightFaceDown,
71 /// Gamepad right button left (i.e. PS3: Square, Xbox: X)
72 RightFaceLeft,
73 /// Gamepad top/back trigger left (first), it could be a trailing button
74 LeftTrigger1,
75 /// Gamepad top/back trigger left (second), it could be a trailing button
76 LeftTrigger2,
77 /// Gamepad top/back trigger right (first), it could be a trailing button
78 RightTrigger1,
79 /// Gamepad top/back trigger right (second), it could be a trailing button
80 RightTrigger2,
81 /// Gamepad center buttons, left one (i.e. PS3: Select)
82 MiddleLeft,
83 /// Gamepad center buttons, middle one (i.e. PS3: PS, Xbox: XBOX)
84 Middle,
85 /// Gamepad center buttons, right one (i.e. PS3: Start)
86 MiddleRight,
87 /// Gamepad joystick pressed button left
88 LeftThumb,
89 /// Gamepad joystick pressed button right
90 RightThumb,
91}
92
93/// Gamepad axis
94#[repr(i32)]
95#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
96pub enum GamepadAxis {
97 /// Gamepad left stick X axis
98 LeftX,
99 /// Gamepad left stick Y axis
100 LeftY,
101 /// Gamepad right stick X axis
102 RightX,
103 /// Gamepad right stick Y axis
104 RightY,
105 /// Gamepad back trigger left, pressure level: [1..-1]
106 TriggerLeft,
107 /// Gamepad back trigger right, pressure level: [1..-1]
108 TriggerRight,
109}
110
111/// Material map index
112#[repr(i32)]
113#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
114pub enum MaterialMap {
115 /// Albedo material (same as: [MATERIAL_MAP_DIFFUSE])
116 Albedo,
117 /// Metalness material (same as: [MATERIAL_MAP_SPECULAR])
118 Metalness,
119 /// Normal material
120 Normal,
121 /// Roughness material
122 Roughness,
123 /// Ambient occlusion material
124 Occlusion,
125 /// Emission material
126 Emission,
127 /// Heightmap material
128 Height,
129 /// Cubemap material (**NOTE**: Uses GL_TEXTURE_CUBE_MAP)
130 Cubemap,
131 /// Irradiance material (**NOTE**: Uses GL_TEXTURE_CUBE_MAP)
132 Irradiance,
133 /// Prefilter material (**NOTE**: Uses GL_TEXTURE_CUBE_MAP)
134 Prefilter,
135 /// BRDF material
136 BRDF,
137}
138
139pub const MATERIAL_MAP_DIFFUSE: MaterialMap = MaterialMap::Albedo;
140pub const MATERIAL_MAP_SPECULAR: MaterialMap = MaterialMap::Metalness;
141
142/// [crate::texture::Texture] parameters: filter mode
143/// - **NOTE 1**: Filtering considers mipmaps if available in the texture
144/// - **NOTE 2**: Filter is accordingly set for minification and magnification
145#[repr(i32)]
146#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
147pub enum TextureFilter {
148 /// No filter, just pixel approximation
149 Point,
150 /// Linear filtering
151 Bilinear,
152 /// Trilinear filtering (linear with mipmaps)
153 Trilinear,
154 /// Anisotropic filtering 4x
155 Anisotropic4X,
156 /// Anisotropic filtering 8x
157 Anisotropic8X,
158 /// Anisotropic filtering 16x
159 Anisotropic16X,
160}
161
162/// [crate::texture::Texture] parameters: wrap mode
163#[repr(i32)]
164#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
165pub enum TextureWrap {
166 /// Repeats [crate::texture::Texture] in tiled mode
167 Repeat,
168 /// Clamps [crate::texture::Texture] to edge pixel in tiled mode
169 Clamp,
170 /// Mirrors and repeats the [crate::texture::Texture] in tiled mode
171 MirrorRepeat,
172 /// Mirrors and clamps to border the [crate::texture::Texture] in tiled mode
173 MirrorClamp,
174}
175
176/// Font type, defines generation method
177#[repr(i32)]
178#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
179pub enum FontType {
180 /// Default font generation, anti-alised
181 Default,
182 /// Bitmap font generation, no anti-aliasing
183 Bitmap,
184 /// SDF font generation, requires external shader
185 SDF,
186}
187
188/// Color blending modes (pre-defined)
189#[repr(i32)]
190#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
191pub enum BlendMode {
192 /// Blend textures considering alpha (default)
193 Alpha,
194 /// Blend textures adding colors
195 Additive,
196 /// Blend textures multiplying colors
197 Multiplied,
198 /// Blend textures adding colors (alternative)
199 AddColors,
200 /// Blend textures subtracting colors (alternative)
201 SubtractColors,
202 /// Blend premultiplied textures considering alpha
203 AlphaPremultiply,
204 /// Blend textures using custom src/dst factors (use rlSetBlendFactors())
205 Custom,
206 /// Blend textures using custom rgb/alpha separate src/dst factors (use rlSetBlendFactorsSeparate())
207 CustomSeparate,
208}
209
210/// Gesture
211#[bitmask(u32)]
212pub enum Gesture {
213 /// No gesture
214 None,
215 /// Tap gesture
216 Tap,
217 /// Double tap gesture
218 DoubleTap,
219 /// Hold gesture
220 Hold,
221 /// Drag gesture
222 Drag,
223 /// Swipe right gesture
224 SwipeRight,
225 /// Swipe left gesture
226 SwipeLeft,
227 /// Swipe up gesture
228 SwipeUp,
229 /// Swipe down gesture
230 SwipeDown,
231 /// Pinch in gesture
232 PinchIn,
233 /// Pinch out gesture
234 PinchOut,
235}
236
237/// Camera system modes
238#[repr(i32)]
239#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
240pub enum CameraMode {
241 /// Camera custom, controlled by user ([crate::ffi::update_camera] does nothing)
242 Custom,
243 /// Camera free mode
244 Free,
245 /// Camera orbital, around target, zoom supported
246 Orbital,
247 /// Camera first person
248 FirstPerson,
249 /// Camera third person
250 ThridPerson,
251}
252
253/// Camera projection
254#[repr(i32)]
255#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
256pub enum CameraProjection {
257 /// Perspective projection
258 Perspective,
259 /// Orthographic projection
260 Orthographic,
261}
262
263/// N-patch layout
264#[repr(i32)]
265#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
266pub enum NPatchLayout {
267 /// Npatch layout: 3x3 tiles
268 NinePatch,
269 /// Npatch layout: 1x3 tiles
270 ThreePatchVertical,
271 /// Npatch layout: 3x1 tiles
272 ThreePatchHorizontal,
273}
274
275/// Trace log level
276///
277/// **NOTE**: Organized by priority level
278#[repr(i32)]
279#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
280pub enum TraceLogLevel {
281 /// Display all logs
282 All,
283 /// Trace logging, intended for interal use only
284 Trace,
285 /// Debug logging, used for internal debugging, it should be disabled on release builds
286 Debug,
287 /// Info logging, used for program execution info
288 Info,
289 /// Warning logging, used for recoverable failures
290 Warning,
291 /// Error logging, used for unrecoverable failures
292 Error,
293 /// Fatal logging, used to abort program: exit(EXIT_FAILURE)
294 Fatal,
295 /// Disable logging
296 None,
297}
298
299/// Keyboard keys (US keyboard layout)
300///
301/// **NOTE**: Use [crate::ffi::get_key_pressed] to allow redefining
302/// required keys for alternative layouts
303#[repr(i32)]
304#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
305pub enum KeyboardKey {
306 /// Key: NULL, used for no key pressed
307 Null = 0,
308 // Alphanumeric keys
309 /// Key: `'`
310 Apostrophe = 39,
311 /// Key: `,`
312 Comma = 44,
313 /// Key: `-`
314 Minus = 45,
315 /// Key: `.`
316 Period = 46,
317 /// Key: `/`
318 Slash = 47,
319 /// Key: `0`
320 Zero = 48,
321 /// Key: `1`
322 One = 49,
323 /// Key: `2`
324 Two = 50,
325 /// Key: `3`
326 Three = 51,
327 /// Key: `4`
328 Four = 52,
329 /// Key: `5`
330 Five = 53,
331 /// Key: `6`
332 Six = 54,
333 /// Key: `7`
334 Seven = 55,
335 /// Key: `8`
336 Eight = 56,
337 /// Key: `9`
338 Nine = 57,
339 /// Key: `;`
340 Semicolon = 59,
341 /// Key: `=`
342 Equal = 61,
343 /// Key: `A` | `a`
344 A = 65,
345 /// Key: `B` | `b`
346 B = 66,
347 /// Key: `C` | `c`
348 C = 67,
349 /// Key: `D` | `d`
350 D = 68,
351 /// Key: `E` | `e`
352 E = 69,
353 /// Key: `F` | `f`
354 F = 70,
355 /// Key: `G` | `g`
356 G = 71,
357 /// Key: `H` | `h`
358 H = 72,
359 /// Key: `I` | `i`
360 I = 73,
361 /// Key: `J` | `j`
362 J = 74,
363 /// Key: `K` | `k`
364 K = 75,
365 /// Key: `L` | `l`
366 L = 76,
367 /// Key: `M` | `m`
368 M = 77,
369 /// Key: `N` | `n`
370 N = 78,
371 /// Key: `O` | `o`
372 O = 79,
373 /// Key: `P` | `p`
374 P = 80,
375 /// Key: `Q` | `q`
376 Q = 81,
377 /// Key: `R` | `r`
378 R = 82,
379 /// Key: `S` | `s`
380 S = 83,
381 /// Key: `T` | `t`
382 T = 84,
383 /// Key: `U` | `u`
384 U = 85,
385 /// Key: `V` | `v`
386 V = 86,
387 /// Key: `W` | `w`
388 W = 87,
389 /// Key: `X` | `x`
390 X = 88,
391 /// Key: `Y` | `y`
392 Y = 89,
393 /// Key: `Z` | `z`
394 Z = 90,
395 /// Key: `[`
396 LeftBracket = 91,
397 /// Key: `\`
398 Backslash = 92,
399 /// Key: `]`
400 RightBracket = 93,
401 /// Key `\``
402 Grave = 96,
403 // Function keys
404 /// Key: `Space`
405 Space = 32,
406 /// Key: `Esc`
407 Escape = 256,
408 /// Key: `Enter`
409 Enter = 257,
410 /// Key: `Tab`
411 Tab = 258,
412 /// Key: `Backspace`
413 Backspace = 259,
414 /// Key: `Ins`
415 Insert = 260,
416 /// Key: `Del`
417 Delete = 261,
418 /// Key: `Cursor right`
419 Right = 262,
420 /// Key: `Cursor left`
421 Left = 263,
422 /// Key: `Cursor down`
423 Down = 264,
424 /// Key: `Cursor up`
425 Up = 265,
426 /// Key: `Page up`
427 PageUp = 266,
428 /// Key: `Page down`
429 PageDown = 267,
430 /// Key: `Home`
431 Home = 268,
432 /// Key: `End`
433 End = 269,
434 /// Key: `Caps lock`
435 CapsLock = 280,
436 /// Key: `Scroll lock`
437 ScrollLock = 281,
438 /// Key: `Num lock`
439 NumLock = 282,
440 /// Key: `Print screen`
441 PrintScreen = 283,
442 /// Key: `Pause`
443 Pause = 284,
444 /// Key: `F1`
445 F1 = 290,
446 /// Key: `F2`
447 F2 = 291,
448 /// Key: `F3`
449 F3 = 292,
450 /// Key: `F4`
451 F4 = 293,
452 /// Key: `F5`
453 F5 = 294,
454 /// Key: `F6`
455 F6 = 295,
456 /// Key: `F7`
457 F7 = 296,
458 /// Key: `F8`
459 F8 = 297,
460 /// Key: `F9`
461 F9 = 298,
462 /// Key: `F10`
463 F10 = 299,
464 /// Key: `F11`
465 F11 = 300,
466 /// Key: `F12`
467 F12 = 301,
468 /// Key: `Shift left`
469 LeftShift = 340,
470 /// Key: `Control left`
471 LeftControl = 341,
472 /// Key: `Alt left`
473 LeftAlt = 342,
474 /// Key: `Super left`
475 LeftSuper = 343,
476 /// Key: `Shift right`
477 RightShift = 344,
478 /// Key: `Control right`
479 RightControl = 345,
480 /// Key: `Alt right`
481 RightAlt = 346,
482 /// Key: `Super right`
483 RightSuper = 347,
484 /// Key: `KB menu`
485 KBMenu = 348,
486 // Keypad keys
487 /// Key: `Keypad 0`
488 KP0 = 320,
489 /// Key: `Keypad 1`
490 KP1 = 321,
491 /// Key: `Keypad 2`
492 KP2 = 322,
493 /// Key: `Keypad 3`
494 KP3 = 323,
495 /// Key: `Keypad 4`
496 KP4 = 324,
497 /// Key: `Keypad 5`
498 KP5 = 325,
499 /// Key: `Keypad 6`
500 KP6 = 326,
501 /// Key: `Keypad 7`
502 KP7 = 327,
503 /// Key: `Keypad 8`
504 KP8 = 328,
505 /// Key: `Keypad 9`
506 KP9 = 329,
507 /// Key: `Keypad .`
508 KPDecimal = 330,
509 /// Key: `Keypad /`
510 KPDivide = 331,
511 /// Key: `Keypad *`
512 KPMultiply = 332,
513 /// Key: `Keypad -`
514 KPSubtract = 333,
515 /// Key: `Keypad +`
516 KPAdd = 334,
517 /// Key: `Keypad Enter`
518 KPEnter = 335,
519 /// Key: `Keypad =`
520 KPEqual = 336,
521 // Android key button
522 /// Key: `Android back button`
523 Back = 4,
524 /// Key: `Android menu button`
525 Menu = 5,
526 /// Key: `Android volume up button`
527 VolumeUp = 24,
528 /// Key: `Android volume down button`
529 VolumeDown = 25,
530}
531
532/// System/Window config flags
533///
534/// **NOTE**: Every bit registers one state (use it with bit masks)
535///
536/// By default all flags are set to `0`
537#[bitmask(u32)]
538pub enum ConfigFlag {
539 /// Set to run program in fullscreen
540 FullscreenMode = 1 << 1,
541 /// Set to allow resizable window
542 WindowResizable = 1 << 2,
543 /// Set to disable window decoration (frame and buttons)
544 WindowUndecorated = 1 << 3,
545 /// Set to allow transparent framebuffer
546 WindowTransparent = 1 << 4,
547 /// Set to try enabling MSAA 4X
548 Msaa4xHint = 1 << 5,
549 /// Set to try enabling V-Sync on GPU
550 VsyncHint = 1 << 6,
551 /// Set to hide window
552 WindowHidden = 1 << 7,
553 /// Set to allow windows running while
554 WindowAlwaysRun = 1 << 8,
555 /// Set to minimize window (iconify)
556 WindowMinimized = 1 << 9,
557 /// Set to maximize window (expanded to monitor)
558 WindowMaximized = 1 << 10,
559 /// Set to window non focused
560 WindowUnfocused = 1 << 11,
561 /// Set to window always on top
562 WindowTopmost = 1 << 12,
563 /// Set to support HighDPI
564 WindowHighdpi = 1 << 13,
565 /// Set to support mouse passthrough, only supported when [ConfigFlag::WindowUndecorated]
566 WindowMousePassthrough = 1 << 14,
567 /// Set to run program in borderless windowed mode
568 BorderlessWindowedMode = 1 << 15,
569 /// Set to try enabling interlaced video format (for V3D)
570 InterlacedHint = 1 << 16,
571}