From 392d81cf260bd372755254abffc73c56f84828c1 Mon Sep 17 00:00:00 2001 From: Braedon Lewis Date: Sun, 19 Mar 2023 23:39:36 -0400 Subject: [PATCH] Add enums and update example --- generator/Program.cs | 76 +++++- raylib-beef/src/Program.bf | 20 +- raylib-beef/src/test/Enums/BlendMode.bf | 25 ++ raylib-beef/src/test/Enums/CameraMode.bf | 19 ++ .../src/test/Enums/CameraProjection.bf | 13 + raylib-beef/src/test/Enums/ConfigFlags.bf | 39 +++ raylib-beef/src/test/Enums/CubemapLayout.bf | 21 ++ raylib-beef/src/test/Enums/FontType.bf | 15 ++ raylib-beef/src/test/Enums/GamepadAxis.bf | 21 ++ raylib-beef/src/test/Enums/GamepadButton.bf | 45 ++++ raylib-beef/src/test/Enums/Gesture.bf | 31 +++ raylib-beef/src/test/Enums/KeyboardKey.bf | 229 ++++++++++++++++++ .../src/test/Enums/MaterialMapIndex.bf | 31 +++ raylib-beef/src/test/Enums/MouseButton.bf | 23 ++ raylib-beef/src/test/Enums/MouseCursor.bf | 31 +++ raylib-beef/src/test/Enums/NPatchLayout.bf | 15 ++ raylib-beef/src/test/Enums/PixelFormat.bf | 51 ++++ .../src/test/Enums/ShaderAttributeDataType.bf | 17 ++ .../src/test/Enums/ShaderLocationIndex.bf | 61 +++++ .../src/test/Enums/ShaderUniformDataType.bf | 27 +++ raylib-beef/src/test/Enums/TextureFilter.bf | 21 ++ raylib-beef/src/test/Enums/TextureWrap.bf | 17 ++ raylib-beef/src/test/Enums/TraceLogLevel.bf | 25 ++ raylib-beef/src/test/Raylib.bf | 92 +++++++ 24 files changed, 957 insertions(+), 8 deletions(-) create mode 100644 raylib-beef/src/test/Enums/BlendMode.bf create mode 100644 raylib-beef/src/test/Enums/CameraMode.bf create mode 100644 raylib-beef/src/test/Enums/CameraProjection.bf create mode 100644 raylib-beef/src/test/Enums/ConfigFlags.bf create mode 100644 raylib-beef/src/test/Enums/CubemapLayout.bf create mode 100644 raylib-beef/src/test/Enums/FontType.bf create mode 100644 raylib-beef/src/test/Enums/GamepadAxis.bf create mode 100644 raylib-beef/src/test/Enums/GamepadButton.bf create mode 100644 raylib-beef/src/test/Enums/Gesture.bf create mode 100644 raylib-beef/src/test/Enums/KeyboardKey.bf create mode 100644 raylib-beef/src/test/Enums/MaterialMapIndex.bf create mode 100644 raylib-beef/src/test/Enums/MouseButton.bf create mode 100644 raylib-beef/src/test/Enums/MouseCursor.bf create mode 100644 raylib-beef/src/test/Enums/NPatchLayout.bf create mode 100644 raylib-beef/src/test/Enums/PixelFormat.bf create mode 100644 raylib-beef/src/test/Enums/ShaderAttributeDataType.bf create mode 100644 raylib-beef/src/test/Enums/ShaderLocationIndex.bf create mode 100644 raylib-beef/src/test/Enums/ShaderUniformDataType.bf create mode 100644 raylib-beef/src/test/Enums/TextureFilter.bf create mode 100644 raylib-beef/src/test/Enums/TextureWrap.bf create mode 100644 raylib-beef/src/test/Enums/TraceLogLevel.bf diff --git a/generator/Program.cs b/generator/Program.cs index 01b75f5..8d122c2 100644 --- a/generator/Program.cs +++ b/generator/Program.cs @@ -45,6 +45,43 @@ namespace RaylibBeefGenerator StructBf(API.Structs[i]); } + Callbacks(); + + for (int i = 0; i < API.Enums.Count; i++) + { + Enum(API.Enums[i]); + } + + Console.WriteLine("Successfully Generated Bindings!"); + Console.ReadLine(); + } + + public static void Enum(Enum @enum) + { + OutputString.Clear(); + OutputString = new(); + + UniversalHeader(); + + AppendLine($"/// {@enum.Description}"); + AppendLine($"public enum {@enum.Name} : c_int"); + AppendLine("{"); + IncreaseTab(); + + for (int i = 0; i < @enum.Values.Count; i++) + { + AppendLine($"/// {@enum.Values[i].Description}"); + AppendLine($"{@enum.Values[i].Name} = {@enum.Values[i].Value_},"); + } + + DecreaseTab(); + AppendLine("}"); + + WriteToFile($@"Enums\{@enum.Name}"); + } + + public static void Callbacks() + { OutputString.Clear(); OutputString = new(); @@ -65,9 +102,6 @@ namespace RaylibBeefGenerator AppendLine("}"); WriteToFile("Callbacks"); - - Console.WriteLine("Successfully Generated Bindings!"); - Console.ReadLine(); } public static void StructBf(Struct structu) @@ -150,7 +184,12 @@ namespace RaylibBeefGenerator for (int i = 1; i < API.Defines.Count; i++) { var define = API.Defines[i]; - // AppendLine($"public static {define.Type.ConvertTypes()} {define.Name.ConvertName()} = ") + if (define.Type == "UNKNOWN" || define.Type == "MACRO" || define.Type == "GUARD") continue; + + if (!string.IsNullOrEmpty(define.Description)) AppendLine($"/// {define.Description}"); + var defineType = define.Type.ConvertTypes(); + AppendLine($"public const {defineType} {define.Name.ConvertName()} = {define.Value.ToString().ParseValue(defineType)};"); + AppendLine(""); } for (int i = 0; i < API.Functions.Count; i++) @@ -201,6 +240,30 @@ namespace RaylibBeefGenerator Console.WriteLine($"Generated {name}.bf"); } + public static string ParseValue(this string inputValue, string type) + { + if (inputValue.StartsWith("CLITERAL")) + { + inputValue = inputValue.Remove(0, 9); + inputValue = inputValue.Remove(type.Length, 1); + inputValue = inputValue.Remove(type.Length + 1, 1); + inputValue = inputValue.Remove(inputValue.Length - 2, 1); + inputValue = inputValue.Replace('{', '('); + inputValue = inputValue.Replace('}', ')'); + } + else if (type == "String" || type == "char8*") + { + inputValue = $"\"{inputValue}\""; + } + else if (type == "float") + { + if (!inputValue.EndsWith(")")) + inputValue = inputValue + "f"; + } + + return inputValue; + } + /// /// Converts the API types to Beef types. /// @@ -212,6 +275,11 @@ namespace RaylibBeefGenerator input = ReplaceWholeWord(input, "long", "int32"); input = ReplaceWholeWord(input, "va_list", "void*"); input = ReplaceWholeWord(input, "short", "uint16"); + input = ReplaceWholeWord(input, "INT", "int"); + input = ReplaceWholeWord(input, "STRING", "char8*"); + input = ReplaceWholeWord(input, "FLOAT", "float"); + input = ReplaceWholeWord(input, "FLOAT_MATH", "float"); + input = ReplaceWholeWord(input, "COLOR", "Color"); if (input.StartsWith("const")) input = input.Remove(0, 6); diff --git a/raylib-beef/src/Program.bf b/raylib-beef/src/Program.bf index 6cf2485..5b5b5a6 100644 --- a/raylib-beef/src/Program.bf +++ b/raylib-beef/src/Program.bf @@ -1,17 +1,29 @@ -namespace beef; - using Raylib; +namespace beef; + class Program { public static int Main() { - InitWindow(1280, 720, "Raylib Beef"); + InitWindow(1280, 720, "Raylib Beef 4.5"); while (!WindowShouldClose()) { BeginDrawing(); - DrawText("Hello!", 20, 20, 20, Color(200, 200, 200, 255)); + ClearBackground(RAYWHITE); + + var beefMain = Color(165, 47, 78, 255); + var beefOutline = Color(243, 157, 157, 255); + + DrawRectangle(GetScreenWidth() / 2 - 128, GetScreenHeight() / 2 - 128, 256, 256, beefOutline); + DrawRectangle(GetScreenWidth() / 2 - 112, GetScreenHeight() / 2 - 112, 224, 224, beefMain); + + DrawText("raylib", GetScreenWidth() / 2 - 44, GetScreenHeight() / 2, 50, beefOutline); + DrawText("beef", GetScreenWidth() / 2 - 62, GetScreenHeight() / 2 + 46, 50, beefOutline); + + DrawRectangle(GetScreenWidth() / 2 + 54, GetScreenHeight() / 2 + 54, 42, 42, beefOutline); + DrawRectangle(GetScreenWidth() / 2 + 62, GetScreenHeight() / 2 + 62, 26, 26, RAYWHITE); EndDrawing(); } diff --git a/raylib-beef/src/test/Enums/BlendMode.bf b/raylib-beef/src/test/Enums/BlendMode.bf new file mode 100644 index 0000000..82be280 --- /dev/null +++ b/raylib-beef/src/test/Enums/BlendMode.bf @@ -0,0 +1,25 @@ +using System; +using System.Interop; + +namespace Raylib; + +/// Color blending modes (pre-defined) +public enum BlendMode : c_int +{ + /// Blend textures considering alpha (default) + BLEND_ALPHA = 0, + /// Blend textures adding colors + BLEND_ADDITIVE = 1, + /// Blend textures multiplying colors + BLEND_MULTIPLIED = 2, + /// Blend textures adding colors (alternative) + BLEND_ADD_COLORS = 3, + /// Blend textures subtracting colors (alternative) + BLEND_SUBTRACT_COLORS = 4, + /// Blend premultiplied textures considering alpha + BLEND_ALPHA_PREMULTIPLY = 5, + /// Blend textures using custom src/dst factors (use rlSetBlendFactors()) + BLEND_CUSTOM = 6, + /// Blend textures using custom rgb/alpha separate src/dst factors (use rlSetBlendFactorsSeparate()) + BLEND_CUSTOM_SEPARATE = 7, +} diff --git a/raylib-beef/src/test/Enums/CameraMode.bf b/raylib-beef/src/test/Enums/CameraMode.bf new file mode 100644 index 0000000..0050424 --- /dev/null +++ b/raylib-beef/src/test/Enums/CameraMode.bf @@ -0,0 +1,19 @@ +using System; +using System.Interop; + +namespace Raylib; + +/// Camera system modes +public enum CameraMode : c_int +{ + /// Custom camera + CAMERA_CUSTOM = 0, + /// Free camera + CAMERA_FREE = 1, + /// Orbital camera + CAMERA_ORBITAL = 2, + /// First person camera + CAMERA_FIRST_PERSON = 3, + /// Third person camera + CAMERA_THIRD_PERSON = 4, +} diff --git a/raylib-beef/src/test/Enums/CameraProjection.bf b/raylib-beef/src/test/Enums/CameraProjection.bf new file mode 100644 index 0000000..c6b18e8 --- /dev/null +++ b/raylib-beef/src/test/Enums/CameraProjection.bf @@ -0,0 +1,13 @@ +using System; +using System.Interop; + +namespace Raylib; + +/// Camera projection +public enum CameraProjection : c_int +{ + /// Perspective projection + CAMERA_PERSPECTIVE = 0, + /// Orthographic projection + CAMERA_ORTHOGRAPHIC = 1, +} diff --git a/raylib-beef/src/test/Enums/ConfigFlags.bf b/raylib-beef/src/test/Enums/ConfigFlags.bf new file mode 100644 index 0000000..c4aa53a --- /dev/null +++ b/raylib-beef/src/test/Enums/ConfigFlags.bf @@ -0,0 +1,39 @@ +using System; +using System.Interop; + +namespace Raylib; + +/// System/Window config flags +public enum ConfigFlags : c_int +{ + /// Set to try enabling V-Sync on GPU + FLAG_VSYNC_HINT = 64, + /// Set to run program in fullscreen + FLAG_FULLSCREEN_MODE = 2, + /// Set to allow resizable window + FLAG_WINDOW_RESIZABLE = 4, + /// Set to disable window decoration (frame and buttons) + FLAG_WINDOW_UNDECORATED = 8, + /// Set to hide window + FLAG_WINDOW_HIDDEN = 128, + /// Set to minimize window (iconify) + FLAG_WINDOW_MINIMIZED = 512, + /// Set to maximize window (expanded to monitor) + FLAG_WINDOW_MAXIMIZED = 1024, + /// Set to window non focused + FLAG_WINDOW_UNFOCUSED = 2048, + /// Set to window always on top + FLAG_WINDOW_TOPMOST = 4096, + /// Set to allow windows running while minimized + FLAG_WINDOW_ALWAYS_RUN = 256, + /// Set to allow transparent framebuffer + FLAG_WINDOW_TRANSPARENT = 16, + /// Set to support HighDPI + FLAG_WINDOW_HIGHDPI = 8192, + /// Set to support mouse passthrough, only supported when FLAG_WINDOW_UNDECORATED + FLAG_WINDOW_MOUSE_PASSTHROUGH = 16384, + /// Set to try enabling MSAA 4X + FLAG_MSAA_4X_HINT = 32, + /// Set to try enabling interlaced video format (for V3D) + FLAG_INTERLACED_HINT = 65536, +} diff --git a/raylib-beef/src/test/Enums/CubemapLayout.bf b/raylib-beef/src/test/Enums/CubemapLayout.bf new file mode 100644 index 0000000..3ee7b19 --- /dev/null +++ b/raylib-beef/src/test/Enums/CubemapLayout.bf @@ -0,0 +1,21 @@ +using System; +using System.Interop; + +namespace Raylib; + +/// Cubemap layouts +public enum CubemapLayout : c_int +{ + /// Automatically detect layout type + CUBEMAP_LAYOUT_AUTO_DETECT = 0, + /// Layout is defined by a vertical line with faces + CUBEMAP_LAYOUT_LINE_VERTICAL = 1, + /// Layout is defined by a horizontal line with faces + CUBEMAP_LAYOUT_LINE_HORIZONTAL = 2, + /// Layout is defined by a 3x4 cross with cubemap faces + CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR = 3, + /// Layout is defined by a 4x3 cross with cubemap faces + CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE = 4, + /// Layout is defined by a panorama image (equirrectangular map) + CUBEMAP_LAYOUT_PANORAMA = 5, +} diff --git a/raylib-beef/src/test/Enums/FontType.bf b/raylib-beef/src/test/Enums/FontType.bf new file mode 100644 index 0000000..81fb71b --- /dev/null +++ b/raylib-beef/src/test/Enums/FontType.bf @@ -0,0 +1,15 @@ +using System; +using System.Interop; + +namespace Raylib; + +/// Font type, defines generation method +public enum FontType : c_int +{ + /// Default font generation, anti-aliased + FONT_DEFAULT = 0, + /// Bitmap font generation, no anti-aliasing + FONT_BITMAP = 1, + /// SDF font generation, requires external shader + FONT_SDF = 2, +} diff --git a/raylib-beef/src/test/Enums/GamepadAxis.bf b/raylib-beef/src/test/Enums/GamepadAxis.bf new file mode 100644 index 0000000..e729c14 --- /dev/null +++ b/raylib-beef/src/test/Enums/GamepadAxis.bf @@ -0,0 +1,21 @@ +using System; +using System.Interop; + +namespace Raylib; + +/// Gamepad axis +public enum GamepadAxis : c_int +{ + /// Gamepad left stick X axis + GAMEPAD_AXIS_LEFT_X = 0, + /// Gamepad left stick Y axis + GAMEPAD_AXIS_LEFT_Y = 1, + /// Gamepad right stick X axis + GAMEPAD_AXIS_RIGHT_X = 2, + /// Gamepad right stick Y axis + GAMEPAD_AXIS_RIGHT_Y = 3, + /// Gamepad back trigger left, pressure level: [1..-1] + GAMEPAD_AXIS_LEFT_TRIGGER = 4, + /// Gamepad back trigger right, pressure level: [1..-1] + GAMEPAD_AXIS_RIGHT_TRIGGER = 5, +} diff --git a/raylib-beef/src/test/Enums/GamepadButton.bf b/raylib-beef/src/test/Enums/GamepadButton.bf new file mode 100644 index 0000000..ad1d44d --- /dev/null +++ b/raylib-beef/src/test/Enums/GamepadButton.bf @@ -0,0 +1,45 @@ +using System; +using System.Interop; + +namespace Raylib; + +/// Gamepad buttons +public enum GamepadButton : c_int +{ + /// Unknown button, just for error checking + GAMEPAD_BUTTON_UNKNOWN = 0, + /// Gamepad left DPAD up button + GAMEPAD_BUTTON_LEFT_FACE_UP = 1, + /// Gamepad left DPAD right button + GAMEPAD_BUTTON_LEFT_FACE_RIGHT = 2, + /// Gamepad left DPAD down button + GAMEPAD_BUTTON_LEFT_FACE_DOWN = 3, + /// Gamepad left DPAD left button + GAMEPAD_BUTTON_LEFT_FACE_LEFT = 4, + /// Gamepad right button up (i.e. PS3: Triangle, Xbox: Y) + GAMEPAD_BUTTON_RIGHT_FACE_UP = 5, + /// Gamepad right button right (i.e. PS3: Square, Xbox: X) + GAMEPAD_BUTTON_RIGHT_FACE_RIGHT = 6, + /// Gamepad right button down (i.e. PS3: Cross, Xbox: A) + GAMEPAD_BUTTON_RIGHT_FACE_DOWN = 7, + /// Gamepad right button left (i.e. PS3: Circle, Xbox: B) + GAMEPAD_BUTTON_RIGHT_FACE_LEFT = 8, + /// Gamepad top/back trigger left (first), it could be a trailing button + GAMEPAD_BUTTON_LEFT_TRIGGER_1 = 9, + /// Gamepad top/back trigger left (second), it could be a trailing button + GAMEPAD_BUTTON_LEFT_TRIGGER_2 = 10, + /// Gamepad top/back trigger right (one), it could be a trailing button + GAMEPAD_BUTTON_RIGHT_TRIGGER_1 = 11, + /// Gamepad top/back trigger right (second), it could be a trailing button + GAMEPAD_BUTTON_RIGHT_TRIGGER_2 = 12, + /// Gamepad center buttons, left one (i.e. PS3: Select) + GAMEPAD_BUTTON_MIDDLE_LEFT = 13, + /// Gamepad center buttons, middle one (i.e. PS3: PS, Xbox: XBOX) + GAMEPAD_BUTTON_MIDDLE = 14, + /// Gamepad center buttons, right one (i.e. PS3: Start) + GAMEPAD_BUTTON_MIDDLE_RIGHT = 15, + /// Gamepad joystick pressed button left + GAMEPAD_BUTTON_LEFT_THUMB = 16, + /// Gamepad joystick pressed button right + GAMEPAD_BUTTON_RIGHT_THUMB = 17, +} diff --git a/raylib-beef/src/test/Enums/Gesture.bf b/raylib-beef/src/test/Enums/Gesture.bf new file mode 100644 index 0000000..8a29e46 --- /dev/null +++ b/raylib-beef/src/test/Enums/Gesture.bf @@ -0,0 +1,31 @@ +using System; +using System.Interop; + +namespace Raylib; + +/// Gesture +public enum Gesture : c_int +{ + /// No gesture + GESTURE_NONE = 0, + /// Tap gesture + GESTURE_TAP = 1, + /// Double tap gesture + GESTURE_DOUBLETAP = 2, + /// Hold gesture + GESTURE_HOLD = 4, + /// Drag gesture + GESTURE_DRAG = 8, + /// Swipe right gesture + GESTURE_SWIPE_RIGHT = 16, + /// Swipe left gesture + GESTURE_SWIPE_LEFT = 32, + /// Swipe up gesture + GESTURE_SWIPE_UP = 64, + /// Swipe down gesture + GESTURE_SWIPE_DOWN = 128, + /// Pinch in gesture + GESTURE_PINCH_IN = 256, + /// Pinch out gesture + GESTURE_PINCH_OUT = 512, +} diff --git a/raylib-beef/src/test/Enums/KeyboardKey.bf b/raylib-beef/src/test/Enums/KeyboardKey.bf new file mode 100644 index 0000000..e434fdc --- /dev/null +++ b/raylib-beef/src/test/Enums/KeyboardKey.bf @@ -0,0 +1,229 @@ +using System; +using System.Interop; + +namespace Raylib; + +/// Keyboard keys (US keyboard layout) +public enum KeyboardKey : c_int +{ + /// Key: NULL, used for no key pressed + KEY_NULL = 0, + /// Key: ' + KEY_APOSTROPHE = 39, + /// Key: , + KEY_COMMA = 44, + /// Key: - + KEY_MINUS = 45, + /// Key: . + KEY_PERIOD = 46, + /// Key: / + KEY_SLASH = 47, + /// Key: 0 + KEY_ZERO = 48, + /// Key: 1 + KEY_ONE = 49, + /// Key: 2 + KEY_TWO = 50, + /// Key: 3 + KEY_THREE = 51, + /// Key: 4 + KEY_FOUR = 52, + /// Key: 5 + KEY_FIVE = 53, + /// Key: 6 + KEY_SIX = 54, + /// Key: 7 + KEY_SEVEN = 55, + /// Key: 8 + KEY_EIGHT = 56, + /// Key: 9 + KEY_NINE = 57, + /// Key: ; + KEY_SEMICOLON = 59, + /// Key: = + KEY_EQUAL = 61, + /// Key: A | a + KEY_A = 65, + /// Key: B | b + KEY_B = 66, + /// Key: C | c + KEY_C = 67, + /// Key: D | d + KEY_D = 68, + /// Key: E | e + KEY_E = 69, + /// Key: F | f + KEY_F = 70, + /// Key: G | g + KEY_G = 71, + /// Key: H | h + KEY_H = 72, + /// Key: I | i + KEY_I = 73, + /// Key: J | j + KEY_J = 74, + /// Key: K | k + KEY_K = 75, + /// Key: L | l + KEY_L = 76, + /// Key: M | m + KEY_M = 77, + /// Key: N | n + KEY_N = 78, + /// Key: O | o + KEY_O = 79, + /// Key: P | p + KEY_P = 80, + /// Key: Q | q + KEY_Q = 81, + /// Key: R | r + KEY_R = 82, + /// Key: S | s + KEY_S = 83, + /// Key: T | t + KEY_T = 84, + /// Key: U | u + KEY_U = 85, + /// Key: V | v + KEY_V = 86, + /// Key: W | w + KEY_W = 87, + /// Key: X | x + KEY_X = 88, + /// Key: Y | y + KEY_Y = 89, + /// Key: Z | z + KEY_Z = 90, + /// Key: [ + KEY_LEFT_BRACKET = 91, + /// Key: '\' + KEY_BACKSLASH = 92, + /// Key: ] + KEY_RIGHT_BRACKET = 93, + /// Key: ` + KEY_GRAVE = 96, + /// Key: Space + KEY_SPACE = 32, + /// Key: Esc + KEY_ESCAPE = 256, + /// Key: Enter + KEY_ENTER = 257, + /// Key: Tab + KEY_TAB = 258, + /// Key: Backspace + KEY_BACKSPACE = 259, + /// Key: Ins + KEY_INSERT = 260, + /// Key: Del + KEY_DELETE = 261, + /// Key: Cursor right + KEY_RIGHT = 262, + /// Key: Cursor left + KEY_LEFT = 263, + /// Key: Cursor down + KEY_DOWN = 264, + /// Key: Cursor up + KEY_UP = 265, + /// Key: Page up + KEY_PAGE_UP = 266, + /// Key: Page down + KEY_PAGE_DOWN = 267, + /// Key: Home + KEY_HOME = 268, + /// Key: End + KEY_END = 269, + /// Key: Caps lock + KEY_CAPS_LOCK = 280, + /// Key: Scroll down + KEY_SCROLL_LOCK = 281, + /// Key: Num lock + KEY_NUM_LOCK = 282, + /// Key: Print screen + KEY_PRINT_SCREEN = 283, + /// Key: Pause + KEY_PAUSE = 284, + /// Key: F1 + KEY_F1 = 290, + /// Key: F2 + KEY_F2 = 291, + /// Key: F3 + KEY_F3 = 292, + /// Key: F4 + KEY_F4 = 293, + /// Key: F5 + KEY_F5 = 294, + /// Key: F6 + KEY_F6 = 295, + /// Key: F7 + KEY_F7 = 296, + /// Key: F8 + KEY_F8 = 297, + /// Key: F9 + KEY_F9 = 298, + /// Key: F10 + KEY_F10 = 299, + /// Key: F11 + KEY_F11 = 300, + /// Key: F12 + KEY_F12 = 301, + /// Key: Shift left + KEY_LEFT_SHIFT = 340, + /// Key: Control left + KEY_LEFT_CONTROL = 341, + /// Key: Alt left + KEY_LEFT_ALT = 342, + /// Key: Super left + KEY_LEFT_SUPER = 343, + /// Key: Shift right + KEY_RIGHT_SHIFT = 344, + /// Key: Control right + KEY_RIGHT_CONTROL = 345, + /// Key: Alt right + KEY_RIGHT_ALT = 346, + /// Key: Super right + KEY_RIGHT_SUPER = 347, + /// Key: KB menu + KEY_KB_MENU = 348, + /// Key: Keypad 0 + KEY_KP_0 = 320, + /// Key: Keypad 1 + KEY_KP_1 = 321, + /// Key: Keypad 2 + KEY_KP_2 = 322, + /// Key: Keypad 3 + KEY_KP_3 = 323, + /// Key: Keypad 4 + KEY_KP_4 = 324, + /// Key: Keypad 5 + KEY_KP_5 = 325, + /// Key: Keypad 6 + KEY_KP_6 = 326, + /// Key: Keypad 7 + KEY_KP_7 = 327, + /// Key: Keypad 8 + KEY_KP_8 = 328, + /// Key: Keypad 9 + KEY_KP_9 = 329, + /// Key: Keypad . + KEY_KP_DECIMAL = 330, + /// Key: Keypad / + KEY_KP_DIVIDE = 331, + /// Key: Keypad * + KEY_KP_MULTIPLY = 332, + /// Key: Keypad - + KEY_KP_SUBTRACT = 333, + /// Key: Keypad + + KEY_KP_ADD = 334, + /// Key: Keypad Enter + KEY_KP_ENTER = 335, + /// Key: Keypad = + KEY_KP_EQUAL = 336, + /// Key: Android back button + KEY_BACK = 4, + /// Key: Android menu button + KEY_MENU = 82, + /// Key: Android volume up button + KEY_VOLUME_UP = 24, + /// Key: Android volume down button + KEY_VOLUME_DOWN = 25, +} diff --git a/raylib-beef/src/test/Enums/MaterialMapIndex.bf b/raylib-beef/src/test/Enums/MaterialMapIndex.bf new file mode 100644 index 0000000..3c2dd9f --- /dev/null +++ b/raylib-beef/src/test/Enums/MaterialMapIndex.bf @@ -0,0 +1,31 @@ +using System; +using System.Interop; + +namespace Raylib; + +/// Material map index +public enum MaterialMapIndex : c_int +{ + /// Albedo material (same as: MATERIAL_MAP_DIFFUSE) + MATERIAL_MAP_ALBEDO = 0, + /// Metalness material (same as: MATERIAL_MAP_SPECULAR) + MATERIAL_MAP_METALNESS = 1, + /// Normal material + MATERIAL_MAP_NORMAL = 2, + /// Roughness material + MATERIAL_MAP_ROUGHNESS = 3, + /// Ambient occlusion material + MATERIAL_MAP_OCCLUSION = 4, + /// Emission material + MATERIAL_MAP_EMISSION = 5, + /// Heightmap material + MATERIAL_MAP_HEIGHT = 6, + /// Cubemap material (NOTE: Uses GL_TEXTURE_CUBE_MAP) + MATERIAL_MAP_CUBEMAP = 7, + /// Irradiance material (NOTE: Uses GL_TEXTURE_CUBE_MAP) + MATERIAL_MAP_IRRADIANCE = 8, + /// Prefilter material (NOTE: Uses GL_TEXTURE_CUBE_MAP) + MATERIAL_MAP_PREFILTER = 9, + /// Brdf material + MATERIAL_MAP_BRDF = 10, +} diff --git a/raylib-beef/src/test/Enums/MouseButton.bf b/raylib-beef/src/test/Enums/MouseButton.bf new file mode 100644 index 0000000..95b3dc9 --- /dev/null +++ b/raylib-beef/src/test/Enums/MouseButton.bf @@ -0,0 +1,23 @@ +using System; +using System.Interop; + +namespace Raylib; + +/// Mouse buttons +public enum MouseButton : c_int +{ + /// Mouse button left + MOUSE_BUTTON_LEFT = 0, + /// Mouse button right + MOUSE_BUTTON_RIGHT = 1, + /// Mouse button middle (pressed wheel) + MOUSE_BUTTON_MIDDLE = 2, + /// Mouse button side (advanced mouse device) + MOUSE_BUTTON_SIDE = 3, + /// Mouse button extra (advanced mouse device) + MOUSE_BUTTON_EXTRA = 4, + /// Mouse button forward (advanced mouse device) + MOUSE_BUTTON_FORWARD = 5, + /// Mouse button back (advanced mouse device) + MOUSE_BUTTON_BACK = 6, +} diff --git a/raylib-beef/src/test/Enums/MouseCursor.bf b/raylib-beef/src/test/Enums/MouseCursor.bf new file mode 100644 index 0000000..90503a0 --- /dev/null +++ b/raylib-beef/src/test/Enums/MouseCursor.bf @@ -0,0 +1,31 @@ +using System; +using System.Interop; + +namespace Raylib; + +/// Mouse cursor +public enum MouseCursor : c_int +{ + /// Default pointer shape + MOUSE_CURSOR_DEFAULT = 0, + /// Arrow shape + MOUSE_CURSOR_ARROW = 1, + /// Text writing cursor shape + MOUSE_CURSOR_IBEAM = 2, + /// Cross shape + MOUSE_CURSOR_CROSSHAIR = 3, + /// Pointing hand cursor + MOUSE_CURSOR_POINTING_HAND = 4, + /// Horizontal resize/move arrow shape + MOUSE_CURSOR_RESIZE_EW = 5, + /// Vertical resize/move arrow shape + MOUSE_CURSOR_RESIZE_NS = 6, + /// Top-left to bottom-right diagonal resize/move arrow shape + MOUSE_CURSOR_RESIZE_NWSE = 7, + /// The top-right to bottom-left diagonal resize/move arrow shape + MOUSE_CURSOR_RESIZE_NESW = 8, + /// The omnidirectional resize/move cursor shape + MOUSE_CURSOR_RESIZE_ALL = 9, + /// The operation-not-allowed shape + MOUSE_CURSOR_NOT_ALLOWED = 10, +} diff --git a/raylib-beef/src/test/Enums/NPatchLayout.bf b/raylib-beef/src/test/Enums/NPatchLayout.bf new file mode 100644 index 0000000..f684356 --- /dev/null +++ b/raylib-beef/src/test/Enums/NPatchLayout.bf @@ -0,0 +1,15 @@ +using System; +using System.Interop; + +namespace Raylib; + +/// N-patch layout +public enum NPatchLayout : c_int +{ + /// Npatch layout: 3x3 tiles + NPATCH_NINE_PATCH = 0, + /// Npatch layout: 1x3 tiles + NPATCH_THREE_PATCH_VERTICAL = 1, + /// Npatch layout: 3x1 tiles + NPATCH_THREE_PATCH_HORIZONTAL = 2, +} diff --git a/raylib-beef/src/test/Enums/PixelFormat.bf b/raylib-beef/src/test/Enums/PixelFormat.bf new file mode 100644 index 0000000..f3b4e9a --- /dev/null +++ b/raylib-beef/src/test/Enums/PixelFormat.bf @@ -0,0 +1,51 @@ +using System; +using System.Interop; + +namespace Raylib; + +/// Pixel formats +public enum PixelFormat : c_int +{ + /// 8 bit per pixel (no alpha) + PIXELFORMAT_UNCOMPRESSED_GRAYSCALE = 1, + /// 8*2 bpp (2 channels) + PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA = 2, + /// 16 bpp + PIXELFORMAT_UNCOMPRESSED_R5G6B5 = 3, + /// 24 bpp + PIXELFORMAT_UNCOMPRESSED_R8G8B8 = 4, + /// 16 bpp (1 bit alpha) + PIXELFORMAT_UNCOMPRESSED_R5G5B5A1 = 5, + /// 16 bpp (4 bit alpha) + PIXELFORMAT_UNCOMPRESSED_R4G4B4A4 = 6, + /// 32 bpp + PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 = 7, + /// 32 bpp (1 channel - float) + PIXELFORMAT_UNCOMPRESSED_R32 = 8, + /// 32*3 bpp (3 channels - float) + PIXELFORMAT_UNCOMPRESSED_R32G32B32 = 9, + /// 32*4 bpp (4 channels - float) + PIXELFORMAT_UNCOMPRESSED_R32G32B32A32 = 10, + /// 4 bpp (no alpha) + PIXELFORMAT_COMPRESSED_DXT1_RGB = 11, + /// 4 bpp (1 bit alpha) + PIXELFORMAT_COMPRESSED_DXT1_RGBA = 12, + /// 8 bpp + PIXELFORMAT_COMPRESSED_DXT3_RGBA = 13, + /// 8 bpp + PIXELFORMAT_COMPRESSED_DXT5_RGBA = 14, + /// 4 bpp + PIXELFORMAT_COMPRESSED_ETC1_RGB = 15, + /// 4 bpp + PIXELFORMAT_COMPRESSED_ETC2_RGB = 16, + /// 8 bpp + PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA = 17, + /// 4 bpp + PIXELFORMAT_COMPRESSED_PVRT_RGB = 18, + /// 4 bpp + PIXELFORMAT_COMPRESSED_PVRT_RGBA = 19, + /// 8 bpp + PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA = 20, + /// 2 bpp + PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA = 21, +} diff --git a/raylib-beef/src/test/Enums/ShaderAttributeDataType.bf b/raylib-beef/src/test/Enums/ShaderAttributeDataType.bf new file mode 100644 index 0000000..a217a5e --- /dev/null +++ b/raylib-beef/src/test/Enums/ShaderAttributeDataType.bf @@ -0,0 +1,17 @@ +using System; +using System.Interop; + +namespace Raylib; + +/// Shader attribute data types +public enum ShaderAttributeDataType : c_int +{ + /// Shader attribute type: float + SHADER_ATTRIB_FLOAT = 0, + /// Shader attribute type: vec2 (2 float) + SHADER_ATTRIB_VEC2 = 1, + /// Shader attribute type: vec3 (3 float) + SHADER_ATTRIB_VEC3 = 2, + /// Shader attribute type: vec4 (4 float) + SHADER_ATTRIB_VEC4 = 3, +} diff --git a/raylib-beef/src/test/Enums/ShaderLocationIndex.bf b/raylib-beef/src/test/Enums/ShaderLocationIndex.bf new file mode 100644 index 0000000..2a639cf --- /dev/null +++ b/raylib-beef/src/test/Enums/ShaderLocationIndex.bf @@ -0,0 +1,61 @@ +using System; +using System.Interop; + +namespace Raylib; + +/// Shader location index +public enum ShaderLocationIndex : c_int +{ + /// Shader location: vertex attribute: position + SHADER_LOC_VERTEX_POSITION = 0, + /// Shader location: vertex attribute: texcoord01 + SHADER_LOC_VERTEX_TEXCOORD01 = 1, + /// Shader location: vertex attribute: texcoord02 + SHADER_LOC_VERTEX_TEXCOORD02 = 2, + /// Shader location: vertex attribute: normal + SHADER_LOC_VERTEX_NORMAL = 3, + /// Shader location: vertex attribute: tangent + SHADER_LOC_VERTEX_TANGENT = 4, + /// Shader location: vertex attribute: color + SHADER_LOC_VERTEX_COLOR = 5, + /// Shader location: matrix uniform: model-view-projection + SHADER_LOC_MATRIX_MVP = 6, + /// Shader location: matrix uniform: view (camera transform) + SHADER_LOC_MATRIX_VIEW = 7, + /// Shader location: matrix uniform: projection + SHADER_LOC_MATRIX_PROJECTION = 8, + /// Shader location: matrix uniform: model (transform) + SHADER_LOC_MATRIX_MODEL = 9, + /// Shader location: matrix uniform: normal + SHADER_LOC_MATRIX_NORMAL = 10, + /// Shader location: vector uniform: view + SHADER_LOC_VECTOR_VIEW = 11, + /// Shader location: vector uniform: diffuse color + SHADER_LOC_COLOR_DIFFUSE = 12, + /// Shader location: vector uniform: specular color + SHADER_LOC_COLOR_SPECULAR = 13, + /// Shader location: vector uniform: ambient color + SHADER_LOC_COLOR_AMBIENT = 14, + /// Shader location: sampler2d texture: albedo (same as: SHADER_LOC_MAP_DIFFUSE) + SHADER_LOC_MAP_ALBEDO = 15, + /// Shader location: sampler2d texture: metalness (same as: SHADER_LOC_MAP_SPECULAR) + SHADER_LOC_MAP_METALNESS = 16, + /// Shader location: sampler2d texture: normal + SHADER_LOC_MAP_NORMAL = 17, + /// Shader location: sampler2d texture: roughness + SHADER_LOC_MAP_ROUGHNESS = 18, + /// Shader location: sampler2d texture: occlusion + SHADER_LOC_MAP_OCCLUSION = 19, + /// Shader location: sampler2d texture: emission + SHADER_LOC_MAP_EMISSION = 20, + /// Shader location: sampler2d texture: height + SHADER_LOC_MAP_HEIGHT = 21, + /// Shader location: samplerCube texture: cubemap + SHADER_LOC_MAP_CUBEMAP = 22, + /// Shader location: samplerCube texture: irradiance + SHADER_LOC_MAP_IRRADIANCE = 23, + /// Shader location: samplerCube texture: prefilter + SHADER_LOC_MAP_PREFILTER = 24, + /// Shader location: sampler2d texture: brdf + SHADER_LOC_MAP_BRDF = 25, +} diff --git a/raylib-beef/src/test/Enums/ShaderUniformDataType.bf b/raylib-beef/src/test/Enums/ShaderUniformDataType.bf new file mode 100644 index 0000000..4f82727 --- /dev/null +++ b/raylib-beef/src/test/Enums/ShaderUniformDataType.bf @@ -0,0 +1,27 @@ +using System; +using System.Interop; + +namespace Raylib; + +/// Shader uniform data type +public enum ShaderUniformDataType : c_int +{ + /// Shader uniform type: float + SHADER_UNIFORM_FLOAT = 0, + /// Shader uniform type: vec2 (2 float) + SHADER_UNIFORM_VEC2 = 1, + /// Shader uniform type: vec3 (3 float) + SHADER_UNIFORM_VEC3 = 2, + /// Shader uniform type: vec4 (4 float) + SHADER_UNIFORM_VEC4 = 3, + /// Shader uniform type: int + SHADER_UNIFORM_INT = 4, + /// Shader uniform type: ivec2 (2 int) + SHADER_UNIFORM_IVEC2 = 5, + /// Shader uniform type: ivec3 (3 int) + SHADER_UNIFORM_IVEC3 = 6, + /// Shader uniform type: ivec4 (4 int) + SHADER_UNIFORM_IVEC4 = 7, + /// Shader uniform type: sampler2d + SHADER_UNIFORM_SAMPLER2D = 8, +} diff --git a/raylib-beef/src/test/Enums/TextureFilter.bf b/raylib-beef/src/test/Enums/TextureFilter.bf new file mode 100644 index 0000000..c4d37f8 --- /dev/null +++ b/raylib-beef/src/test/Enums/TextureFilter.bf @@ -0,0 +1,21 @@ +using System; +using System.Interop; + +namespace Raylib; + +/// Texture parameters: filter mode +public enum TextureFilter : c_int +{ + /// No filter, just pixel approximation + TEXTURE_FILTER_POINT = 0, + /// Linear filtering + TEXTURE_FILTER_BILINEAR = 1, + /// Trilinear filtering (linear with mipmaps) + TEXTURE_FILTER_TRILINEAR = 2, + /// Anisotropic filtering 4x + TEXTURE_FILTER_ANISOTROPIC_4X = 3, + /// Anisotropic filtering 8x + TEXTURE_FILTER_ANISOTROPIC_8X = 4, + /// Anisotropic filtering 16x + TEXTURE_FILTER_ANISOTROPIC_16X = 5, +} diff --git a/raylib-beef/src/test/Enums/TextureWrap.bf b/raylib-beef/src/test/Enums/TextureWrap.bf new file mode 100644 index 0000000..a3304f8 --- /dev/null +++ b/raylib-beef/src/test/Enums/TextureWrap.bf @@ -0,0 +1,17 @@ +using System; +using System.Interop; + +namespace Raylib; + +/// Texture parameters: wrap mode +public enum TextureWrap : c_int +{ + /// Repeats texture in tiled mode + TEXTURE_WRAP_REPEAT = 0, + /// Clamps texture to edge pixel in tiled mode + TEXTURE_WRAP_CLAMP = 1, + /// Mirrors and repeats the texture in tiled mode + TEXTURE_WRAP_MIRROR_REPEAT = 2, + /// Mirrors and clamps to border the texture in tiled mode + TEXTURE_WRAP_MIRROR_CLAMP = 3, +} diff --git a/raylib-beef/src/test/Enums/TraceLogLevel.bf b/raylib-beef/src/test/Enums/TraceLogLevel.bf new file mode 100644 index 0000000..e1202cf --- /dev/null +++ b/raylib-beef/src/test/Enums/TraceLogLevel.bf @@ -0,0 +1,25 @@ +using System; +using System.Interop; + +namespace Raylib; + +/// Trace log level +public enum TraceLogLevel : c_int +{ + /// Display all logs + LOG_ALL = 0, + /// Trace logging, intended for internal use only + LOG_TRACE = 1, + /// Debug logging, used for internal debugging, it should be disabled on release builds + LOG_DEBUG = 2, + /// Info logging, used for program execution info + LOG_INFO = 3, + /// Warning logging, used on recoverable failures + LOG_WARNING = 4, + /// Error logging, used on unrecoverable failures + LOG_ERROR = 5, + /// Fatal logging, used to abort program: exit(EXIT_FAILURE) + LOG_FATAL = 6, + /// Disable logging + LOG_NONE = 7, +} diff --git a/raylib-beef/src/test/Raylib.bf b/raylib-beef/src/test/Raylib.bf index 35e688f..0651e91 100644 --- a/raylib-beef/src/test/Raylib.bf +++ b/raylib-beef/src/test/Raylib.bf @@ -8,6 +8,98 @@ static /// Used internally for bindings. public const String RAYLIB_LIB = "raylib.dll"; + public const int RAYLIB_VERSION_MAJOR = 4; + + public const int RAYLIB_VERSION_MINOR = 5; + + public const int RAYLIB_VERSION_PATCH = 0; + + public const char8* RAYLIB_VERSION = "4.5"; + + public const float PI = 3.141592653589793f; + + public const float DEG2RAD = (PI/180.0f); + + public const float RAD2DEG = (180.0f/PI); + + /// Light Gray + public const Color LIGHTGRAY = Color(200, 200, 200, 255); + + /// Gray + public const Color GRAY = Color(130, 130, 130, 255); + + /// Dark Gray + public const Color DARKGRAY = Color(80, 80, 80, 255); + + /// Yellow + public const Color YELLOW = Color(253, 249, 0, 255); + + /// Gold + public const Color GOLD = Color(255, 203, 0, 255); + + /// Orange + public const Color ORANGE = Color(255, 161, 0, 255); + + /// Pink + public const Color PINK = Color(255, 109, 194, 255); + + /// Red + public const Color RED = Color(230, 41, 55, 255); + + /// Maroon + public const Color MAROON = Color(190, 33, 55, 255); + + /// Green + public const Color GREEN = Color(0, 228, 48, 255); + + /// Lime + public const Color LIME = Color(0, 158, 47, 255); + + /// Dark Green + public const Color DARKGREEN = Color(0, 117, 44, 255); + + /// Sky Blue + public const Color SKYBLUE = Color(102, 191, 255, 255); + + /// Blue + public const Color BLUE = Color(0, 121, 241, 255); + + /// Dark Blue + public const Color DARKBLUE = Color(0, 82, 172, 255); + + /// Purple + public const Color PURPLE = Color(200, 122, 255, 255); + + /// Violet + public const Color VIOLET = Color(135, 60, 190, 255); + + /// Dark Purple + public const Color DARKPURPLE = Color(112, 31, 126, 255); + + /// Beige + public const Color BEIGE = Color(211, 176, 131, 255); + + /// Brown + public const Color BROWN = Color(127, 106, 79, 255); + + /// Dark Brown + public const Color DARKBROWN = Color(76, 63, 47, 255); + + /// White + public const Color WHITE = Color(255, 255, 255, 255); + + /// Black + public const Color BLACK = Color(0, 0, 0, 255); + + /// Blank (Transparent) + public const Color BLANK = Color(0, 0, 0, 0); + + /// Magenta + public const Color MAGENTA = Color(255, 0, 255, 255); + + /// My own White (raylib logo) + public const Color RAYWHITE = Color(245, 245, 245, 255); + /// Initialize window and OpenGL context [Import(RAYLIB_LIB), CallingConvention(.Cdecl), LinkName("InitWindow")] public static extern void InitWindow(int width, int height, char8 * title);