Watch
3
0
Fork
You've already forked raylib-cs
0

Split Enums, Structs & Classes into own files

This commit is contained in:
Ben Parsons 2021-10-24 20:59:05 +11:00
commit 7f531ff27a
50 changed files with 1956 additions and 1783 deletions

31
Raylib-cs/AudioStream.cs Normal file
View file

@ -0,0 +1,31 @@
using System;
using System.Runtime.InteropServices;
namespace Raylib_cs
{
/// <summary>Audio stream type
/// NOTE: Useful to create custom audio streams not bound to a specific file</summary>
[StructLayout(LayoutKind.Sequential)]
public struct AudioStream
{
/// <summary>
/// Pointer to internal data(rAudioBuffer *) used by the audio system
/// </summary>
public IntPtr audioBuffer;
/// <summary>
/// Frequency (samples per second)
/// </summary>
public uint sampleRate;
/// <summary>
/// Bit depth (bits per sample): 8, 16, 32 (24 not supported)
/// </summary>
public uint sampleSize;
/// <summary>
/// Number of channels (1-mono, 2-stereo)
/// </summary>
public uint channels;
}
}

36
Raylib-cs/BlendMode.cs Normal file
View file

@ -0,0 +1,36 @@
namespace Raylib_cs
{
/// <summary>Color blending modes (pre-defined)</summary>
public enum BlendMode
{
/// <summary>
/// Blend textures considering alpha (default)
/// </summary>
BLEND_ALPHA = 0,
/// <summary>
/// Blend textures adding colors
/// </summary>
BLEND_ADDITIVE,
/// <summary>
/// Blend textures multiplying colors
/// </summary>
BLEND_MULTIPLIED,
/// <summary>
/// Blend textures adding colors (alternative)
/// </summary>
BLEND_ADD_COLORS,
/// <summary>
/// Blend textures subtracting colors (alternative)
/// </summary>
BLEND_SUBTRACT_COLORS,
/// <summary>
/// Blend textures using custom src/dst factors (use rlSetBlendMode())
/// </summary>
BLEND_CUSTOM
}
}

22
Raylib-cs/BoneInfo.cs Normal file
View file

@ -0,0 +1,22 @@
using System;
using System.Runtime.InteropServices;
namespace Raylib_cs
{
/// <summary>
/// Bone information
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct BoneInfo
{
/// <summary>
/// Bone name (char[32])
/// </summary>
public IntPtr name;
/// <summary>
/// Bone parent
/// </summary>
public int parent;
}
}

26
Raylib-cs/BoundingBox.cs Normal file
View file

@ -0,0 +1,26 @@
using System.Numerics;
using System.Runtime.InteropServices;
namespace Raylib_cs
{
/// <summary>Bounding box type</summary>
[StructLayout(LayoutKind.Sequential)]
public struct BoundingBox
{
/// <summary>
/// Minimum vertex box-corner
/// </summary>
public Vector3 min;
/// <summary>
/// Maximum vertex box-corner
/// </summary>
public Vector3 max;
public BoundingBox(Vector3 min, Vector3 max)
{
this.min = min;
this.max = max;
}
}
}

38
Raylib-cs/Camera2D.cs Normal file
View file

@ -0,0 +1,38 @@
using System.Numerics;
using System.Runtime.InteropServices;
namespace Raylib_cs
{
/// <summary>Camera2D, defines position/orientation in 2d space</summary>
[StructLayout(LayoutKind.Sequential)]
public struct Camera2D
{
/// <summary>
/// Camera offset (displacement from target)
/// </summary>
public Vector2 offset;
/// <summary>
/// Camera target (rotation and zoom origin)
/// </summary>
public Vector2 target;
/// <summary>
/// Camera rotation in degrees
/// </summary>
public float rotation;
/// <summary>
/// Camera zoom (scaling), should be 1.0f by default
/// </summary>
public float zoom;
public Camera2D(Vector2 offset, Vector2 target, float rotation, float zoom)
{
this.offset = offset;
this.target = target;
this.rotation = rotation;
this.zoom = zoom;
}
}
}

46
Raylib-cs/Camera3D.cs Normal file
View file

@ -0,0 +1,46 @@
using System.Numerics;
using System.Runtime.InteropServices;
namespace Raylib_cs
{
/// <summary>
/// Camera3D, defines position/orientation in 3d space
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct Camera3D
{
/// <summary>
/// Camera position
/// </summary>
public Vector3 position;
/// <summary>
/// Camera target it looks-at
/// </summary>
public Vector3 target;
/// <summary>
/// Camera up vector (rotation over its axis)
/// </summary>
public Vector3 up;
/// <summary>
/// Camera field-of-view apperture in Y (degrees) in perspective, used as near plane width in orthographic
/// </summary>
public float fovy;
/// <summary>
/// Camera type, defines projection type: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC
/// </summary>
public CameraProjection projection;
public Camera3D(Vector3 position, Vector3 target, Vector3 up, float fovy, CameraProjection projection)
{
this.position = position;
this.target = target;
this.up = up;
this.fovy = fovy;
this.projection = projection;
}
}
}

12
Raylib-cs/CameraMode.cs Normal file
View file

@ -0,0 +1,12 @@
namespace Raylib_cs
{
/// <summary>Camera system modes</summary>
public enum CameraMode
{
CAMERA_CUSTOM = 0,
CAMERA_FREE,
CAMERA_ORBITAL,
CAMERA_FIRST_PERSON,
CAMERA_THIRD_PERSON
}
}

View file

@ -0,0 +1,9 @@
namespace Raylib_cs
{
/// <summary>Camera projection</summary>
public enum CameraProjection
{
CAMERA_PERSPECTIVE = 0,
CAMERA_ORTHOGRAPHIC
}
}

67
Raylib-cs/Color.cs Normal file
View file

@ -0,0 +1,67 @@
using System;
using System.Runtime.InteropServices;
namespace Raylib_cs
{
/// <summary>
/// Color type, RGBA (32bit)
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct Color
{
public byte r;
public byte g;
public byte b;
public byte a;
// Example - Color.RED instead of RED
// Custom raylib color palette for amazing visuals
public static Color LIGHTGRAY = new Color(200, 200, 200, 255);
public static Color GRAY = new Color(130, 130, 130, 255);
public static Color DARKGRAY = new Color(80, 80, 80, 255);
public static Color YELLOW = new Color(253, 249, 0, 255);
public static Color GOLD = new Color(255, 203, 0, 255);
public static Color ORANGE = new Color(255, 161, 0, 255);
public static Color PINK = new Color(255, 109, 194, 255);
public static Color RED = new Color(230, 41, 55, 255);
public static Color MAROON = new Color(190, 33, 55, 255);
public static Color GREEN = new Color(0, 228, 48, 255);
public static Color LIME = new Color(0, 158, 47, 255);
public static Color DARKGREEN = new Color(0, 117, 44, 255);
public static Color SKYBLUE = new Color(102, 191, 255, 255);
public static Color BLUE = new Color(0, 121, 241, 255);
public static Color DARKBLUE = new Color(0, 82, 172, 255);
public static Color PURPLE = new Color(200, 122, 255, 255);
public static Color VIOLET = new Color(135, 60, 190, 255);
public static Color DARKPURPLE = new Color(112, 31, 126, 255);
public static Color BEIGE = new Color(211, 176, 131, 255);
public static Color BROWN = new Color(127, 106, 79, 255);
public static Color DARKBROWN = new Color(76, 63, 47, 255);
public static Color WHITE = new Color(255, 255, 255, 255);
public static Color BLACK = new Color(0, 0, 0, 255);
public static Color BLANK = new Color(0, 0, 0, 0);
public static Color MAGENTA = new Color(255, 0, 255, 255);
public static Color RAYWHITE = new Color(245, 245, 245, 255);
public Color(byte r, byte g, byte b, byte a)
{
this.r = r;
this.g = g;
this.b = b;
this.a = a;
}
public Color(int r, int g, int b, int a)
{
this.r = Convert.ToByte(r);
this.g = Convert.ToByte(g);
this.b = Convert.ToByte(b);
this.a = Convert.ToByte(a);
}
public override string ToString()
{
return string.Concat(r.ToString(), " ", g.ToString(), " ", b.ToString(), " ", a.ToString());
}
}
}

81
Raylib-cs/ConfigFlags.cs Normal file
View file

@ -0,0 +1,81 @@
using System;
namespace Raylib_cs
{
/// <summary>System config flags
/// NOTE: Every bit registers one state (use it with bit masks)
/// By default all flags are set to 0</summary>
[Flags]
public enum ConfigFlags
{
/// <summary>
/// Set to try enabling V-Sync on GPU
/// </summary>
FLAG_VSYNC_HINT = 0x00000040,
/// <summary>
/// Set to run program in fullscreen
/// </summary>
FLAG_FULLSCREEN_MODE = 0x00000002,
/// <summary>
/// Set to allow resizable window
/// </summary>
FLAG_WINDOW_RESIZABLE = 0x00000004,
/// <summary>
/// Set to disable window decoration (frame and buttons)
/// </summary>
FLAG_WINDOW_UNDECORATED = 0x00000008,
/// <summary>
/// Set to hide window
/// </summary>
FLAG_WINDOW_HIDDEN = 0x00000080,
/// <summary>
/// Set to minimize window (iconify)
/// </summary>
FLAG_WINDOW_MINIMIZED = 0x00000200,
/// <summary>
/// Set to maximize window (expanded to monitor)
/// </summary>
FLAG_WINDOW_MAXIMIZED = 0x00000400,
/// <summary>
/// Set to window non focused
/// </summary>
FLAG_WINDOW_UNFOCUSED = 0x00000800,
/// <summary>
/// Set to window always on top
/// </summary>
FLAG_WINDOW_TOPMOST = 0x00001000,
/// <summary>
/// Set to allow windows running while minimized
/// </summary>
FLAG_WINDOW_ALWAYS_RUN = 0x00000100,
/// <summary>
/// Set to allow transparent framebuffer
/// </summary>
FLAG_WINDOW_TRANSPARENT = 0x00000010,
/// <summary>
/// Set to support HighDPI
/// </summary>
FLAG_WINDOW_HIGHDPI = 0x00002000,
/// <summary>
/// Set to try enabling MSAA 4X
/// </summary>
FLAG_MSAA_4X_HINT = 0x00000020,
/// <summary>
/// Set to try enabling interlaced video format (for V3D)
/// </summary>
FLAG_INTERLACED_HINT = 0x00010000,
}
}

View file

@ -0,0 +1,36 @@
namespace Raylib_cs
{
/// <summary>Cubemap layouts</summary>
public enum CubemapLayout
{
/// <summary>
/// Automatically detect layout type
/// </summary>
CUBEMAP_LAYOUT_AUTO_DETECT = 0,
/// <summary>
/// Layout is defined by a vertical line with faces
/// </summary>
CUBEMAP_LAYOUT_LINE_VERTICAL,
/// <summary>
/// Layout is defined by an horizontal line with faces
/// </summary>
CUBEMAP_LAYOUT_LINE_HORIZONTAL,
/// <summary>
/// Layout is defined by a 3x4 cross with cubemap faces
/// </summary>
CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR,
/// <summary>
/// Layout is defined by a 4x3 cross with cubemap faces
/// </summary>
CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE,
/// <summary>
/// Layout is defined by a panorama image (equirectangular map)
/// </summary>
CUBEMAP_LAYOUT_PANORAMA
}
}

42
Raylib-cs/Font.cs Normal file
View file

@ -0,0 +1,42 @@
using System;
using System.Runtime.InteropServices;
namespace Raylib_cs
{
/// <summary>
/// Font, font texture and GlyphInfo array data
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct Font
{
/// <summary>
/// Base size (default chars height)
/// </summary>
public int baseSize;
/// <summary>
/// Number of characters
/// </summary>
public int glyphCount;
/// <summary>
/// Padding around the glyph characters
/// </summary>
public int glyphPadding;
/// <summary>
/// Texture atlas containing the glyphs
/// </summary>
public Texture2D texture;
/// <summary>
/// Rectangles in texture for the glyphs
/// </summary>
public IntPtr recs;
/// <summary>
/// Glyphs info data
/// </summary>
public IntPtr glyphs;
}
}

21
Raylib-cs/FontType.cs Normal file
View file

@ -0,0 +1,21 @@
namespace Raylib_cs
{
/// <summary>Font type, defines generation method</summary>
public enum FontType
{
/// <summary>
/// Default font generation, anti-aliased
/// </summary>
FONT_DEFAULT = 0,
/// <summary>
/// Bitmap font generation, no anti-aliasing
/// </summary>
FONT_BITMAP,
/// <summary>
/// SDF font generation, requires external shader
/// </summary>
FONT_SDF
}
}

36
Raylib-cs/GamepadAxis.cs Normal file
View file

@ -0,0 +1,36 @@
namespace Raylib_cs
{
/// <summary>Gamepad axis</summary>
public enum GamepadAxis
{
/// <summary>
/// Gamepad left stick X axis
/// </summary>
GAMEPAD_AXIS_LEFT_X = 0,
/// <summary>
/// Gamepad left stick Y axis
/// </summary>
GAMEPAD_AXIS_LEFT_Y = 1,
/// <summary>
/// Gamepad right stick X axis
/// </summary>
GAMEPAD_AXIS_RIGHT_X = 2,
/// <summary>
/// Gamepad right stick Y axis
/// </summary>
GAMEPAD_AXIS_RIGHT_Y = 3,
/// <summary>
/// Gamepad back trigger left, pressure level: [1..-1]
/// </summary>
GAMEPAD_AXIS_LEFT_TRIGGER = 4,
/// <summary>
/// Gamepad back trigger right, pressure level: [1..-1]
/// </summary>
GAMEPAD_AXIS_RIGHT_TRIGGER = 5
}
}

View file

@ -0,0 +1,84 @@
namespace Raylib_cs
{
/// <summary>Gamepad buttons</summary>
public enum GamepadButton
{
/// <summary>
/// This is here just for error checking
/// </summary>
GAMEPAD_BUTTON_UNKNOWN = 0,
/// <summary>
/// Gamepad left DPAD up button
/// </summary>
GAMEPAD_BUTTON_LEFT_FACE_UP,
/// <summary>
/// Gamepad left DPAD right button
/// </summary>
GAMEPAD_BUTTON_LEFT_FACE_RIGHT,
/// <summary>
/// Gamepad left DPAD down button
/// </summary>
GAMEPAD_BUTTON_LEFT_FACE_DOWN,
/// <summary>
/// Gamepad left DPAD left button
/// </summary>
GAMEPAD_BUTTON_LEFT_FACE_LEFT,
/// <summary>
/// Gamepad right button up (i.e. PS3: Triangle, Xbox: Y)
/// </summary>
GAMEPAD_BUTTON_RIGHT_FACE_UP,
/// <summary>
/// Gamepad right button right (i.e. PS3: Square, Xbox: X)
/// </summary>
GAMEPAD_BUTTON_RIGHT_FACE_RIGHT,
/// <summary>
/// Gamepad right button down (i.e. PS3: Cross, Xbox: A)
/// </summary>
GAMEPAD_BUTTON_RIGHT_FACE_DOWN,
/// <summary>
/// Gamepad right button left (i.e. PS3: Circle, Xbox: B)
/// </summary>
GAMEPAD_BUTTON_RIGHT_FACE_LEFT,
// Triggers
GAMEPAD_BUTTON_LEFT_TRIGGER_1,
GAMEPAD_BUTTON_LEFT_TRIGGER_2,
GAMEPAD_BUTTON_RIGHT_TRIGGER_1,
GAMEPAD_BUTTON_RIGHT_TRIGGER_2,
// These are buttons in the center of the gamepad
/// <summary>
/// PS3 Select
/// </summary>
GAMEPAD_BUTTON_MIDDLE_LEFT,
/// <summary>
/// PS Button/XBOX Button
/// </summary>
GAMEPAD_BUTTON_MIDDLE,
/// <summary>
/// PS3 Start
/// </summary>
GAMEPAD_BUTTON_MIDDLE_RIGHT,
/// <summary>
/// Left joystick press button
/// </summary>
GAMEPAD_BUTTON_LEFT_THUMB,
/// <summary>
/// Right joystick press button
/// </summary>
GAMEPAD_BUTTON_RIGHT_THUMB
}
}

22
Raylib-cs/Gestures.cs Normal file
View file

@ -0,0 +1,22 @@
using System;
namespace Raylib_cs
{
/// <summary>Gestures
/// NOTE: It could be used as flags to enable only some gestures</summary>
[Flags]
public enum Gestures
{
GESTURE_NONE = 0,
GESTURE_TAP = 1,
GESTURE_DOUBLETAP = 2,
GESTURE_HOLD = 4,
GESTURE_DRAG = 8,
GESTURE_SWIPE_RIGHT = 16,
GESTURE_SWIPE_LEFT = 32,
GESTURE_SWIPE_UP = 64,
GESTURE_SWIPE_DOWN = 128,
GESTURE_PINCH_IN = 256,
GESTURE_PINCH_OUT = 512
}
}

36
Raylib-cs/GlyphInfo.cs Normal file
View file

@ -0,0 +1,36 @@
using System.Runtime.InteropServices;
namespace Raylib_cs
{
/// <summary>
/// GlyphInfo, font characters glyphs info
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct GlyphInfo
{
/// <summary>
/// Character value (Unicode)
/// </summary>
public int value;
/// <summary>
/// Character offset X when drawing
/// </summary>
public int offsetX;
/// <summary>
/// Character offset Y when drawing
/// </summary>
public int offsetY;
/// <summary>
/// Character advance position X
/// </summary>
public int advanceX;
/// <summary>
/// Character image data
/// </summary>
public Image image;
}
}

39
Raylib-cs/Image.cs Normal file
View file

@ -0,0 +1,39 @@
using System;
using System.Runtime.InteropServices;
namespace Raylib_cs
{
/// <summary>
/// Image type, bpp always RGBA (32bit)
/// <br/>
/// NOTE: Data stored in CPU memory (RAM)
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct Image
{
/// <summary>
/// Image raw data (void *)
/// </summary>
public IntPtr data;
/// <summary>
/// Image base width
/// </summary>
public int width;
/// <summary>
/// Image base height
/// </summary>
public int height;
/// <summary>
/// Mipmap levels, 1 by default
/// </summary>
public int mipmaps;
/// <summary>
/// Data format (PixelFormat type)
/// </summary>
public PixelFormat format;
}
}

130
Raylib-cs/KeyboardKey.cs Normal file
View file

@ -0,0 +1,130 @@
namespace Raylib_cs
{
/// <summary>Keyboard keys (US keyboard layout)
/// NOTE: Use GetKeyPressed() to allow redefining
/// required keys for alternative layouts</summary>
public enum KeyboardKey
{
/// <summary>
/// NULL, used for no key pressed
/// </summary>
KEY_NULL = 0,
// Alphanumeric keys
KEY_APOSTROPHE = 39,
KEY_COMMA = 44,
KEY_MINUS = 45,
KEY_PERIOD = 46,
KEY_SLASH = 47,
KEY_ZERO = 48,
KEY_ONE = 49,
KEY_TWO = 50,
KEY_THREE = 51,
KEY_FOUR = 52,
KEY_FIVE = 53,
KEY_SIX = 54,
KEY_SEVEN = 55,
KEY_EIGHT = 56,
KEY_NINE = 57,
KEY_SEMICOLON = 59,
KEY_EQUAL = 61,
KEY_A = 65,
KEY_B = 66,
KEY_C = 67,
KEY_D = 68,
KEY_E = 69,
KEY_F = 70,
KEY_G = 71,
KEY_H = 72,
KEY_I = 73,
KEY_J = 74,
KEY_K = 75,
KEY_L = 76,
KEY_M = 77,
KEY_N = 78,
KEY_O = 79,
KEY_P = 80,
KEY_Q = 81,
KEY_R = 82,
KEY_S = 83,
KEY_T = 84,
KEY_U = 85,
KEY_V = 86,
KEY_W = 87,
KEY_X = 88,
KEY_Y = 89,
KEY_Z = 90,
// Function keys
KEY_SPACE = 32,
KEY_ESCAPE = 256,
KEY_ENTER = 257,
KEY_TAB = 258,
KEY_BACKSPACE = 259,
KEY_INSERT = 260,
KEY_DELETE = 261,
KEY_RIGHT = 262,
KEY_LEFT = 263,
KEY_DOWN = 264,
KEY_UP = 265,
KEY_PAGE_UP = 266,
KEY_PAGE_DOWN = 267,
KEY_HOME = 268,
KEY_END = 269,
KEY_CAPS_LOCK = 280,
KEY_SCROLL_LOCK = 281,
KEY_NUM_LOCK = 282,
KEY_PRINT_SCREEN = 283,
KEY_PAUSE = 284,
KEY_F1 = 290,
KEY_F2 = 291,
KEY_F3 = 292,
KEY_F4 = 293,
KEY_F5 = 294,
KEY_F6 = 295,
KEY_F7 = 296,
KEY_F8 = 297,
KEY_F9 = 298,
KEY_F10 = 299,
KEY_F11 = 300,
KEY_F12 = 301,
KEY_LEFT_SHIFT = 340,
KEY_LEFT_CONTROL = 341,
KEY_LEFT_ALT = 342,
KEY_LEFT_SUPER = 343,
KEY_RIGHT_SHIFT = 344,
KEY_RIGHT_CONTROL = 345,
KEY_RIGHT_ALT = 346,
KEY_RIGHT_SUPER = 347,
KEY_KB_MENU = 348,
KEY_LEFT_BRACKET = 91,
KEY_BACKSLASH = 92,
KEY_RIGHT_BRACKET = 93,
KEY_GRAVE = 96,
// Keypad keys
KEY_KP_0 = 320,
KEY_KP_1 = 321,
KEY_KP_2 = 322,
KEY_KP_3 = 323,
KEY_KP_4 = 324,
KEY_KP_5 = 325,
KEY_KP_6 = 326,
KEY_KP_7 = 327,
KEY_KP_8 = 328,
KEY_KP_9 = 329,
KEY_KP_DECIMAL = 330,
KEY_KP_DIVIDE = 331,
KEY_KP_MULTIPLY = 332,
KEY_KP_SUBTRACT = 333,
KEY_KP_ADD = 334,
KEY_KP_ENTER = 335,
KEY_KP_EQUAL = 336,
// Android key buttons
KEY_BACK = 4,
KEY_MENU = 82,
KEY_VOLUME_UP = 24,
KEY_VOLUME_DOWN = 25
}
}

27
Raylib-cs/Material.cs Normal file
View file

@ -0,0 +1,27 @@
using System;
using System.Runtime.InteropServices;
namespace Raylib_cs
{
/// <summary>
/// Material type (generic)
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct Material
{
/// <summary>
/// Material shader
/// </summary>
public Shader shader;
/// <summary>
/// Material maps (MaterialMap *)
/// </summary>
public IntPtr maps;
/// <summary>
/// Material generic parameters (if required, float *)
/// </summary>
public IntPtr param;
}
}

Some files were not shown because too many files have changed in this diff Show more