2
0
mirror of https://github.com/raylib-cs/raylib-cs synced 2025-09-09 03:01:41 -04:00

Reorganize types

- Move into types folder
- Group types based on usage
This commit is contained in:
2021-10-24 16:11:28 +01:00
parent 9b1c2269f0
commit 26b0a0dac4
55 changed files with 1296 additions and 1396 deletions

107
Raylib-cs/types/Audio.cs Normal file
View File

@@ -0,0 +1,107 @@
using System;
using System.Runtime.InteropServices;
namespace Raylib_cs
{
/// <summary>Wave type, defines audio wave data</summary>
[StructLayout(LayoutKind.Sequential)]
public struct Wave
{
/// <summary>
/// Number of samples
/// </summary>
public uint sampleCount;
/// <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;
/// <summary>
/// Buffer data pointer (void *)
/// </summary>
public IntPtr data;
}
/// <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;
}
/// <summary>Sound source type</summary>
[StructLayout(LayoutKind.Sequential)]
public struct Sound
{
/// <summary>
/// Audio stream
/// </summary>
public AudioStream stream;
/// <summary>
/// Total number of frames (considering channels)
/// </summary>
public uint frameCount;
}
/// <summary>Music stream type (audio file streaming from memory)
/// NOTE: Anything longer than ~10 seconds should be streamed</summary>
[StructLayout(LayoutKind.Sequential)]
public struct Music
{
/// <summary>
/// Audio stream
/// </summary>
public AudioStream stream;
/// <summary>
/// Total number of samples
/// </summary>
public uint frameCount;
/// <summary>
/// Music looping enable
/// </summary>
public byte looping;
/// <summary>
/// Type of music context (audio filetype)
/// </summary>
public int ctxType;
/// <summary>
/// Audio context data, depends on type (void *)
/// </summary>
public IntPtr ctxData;
}
}

96
Raylib-cs/types/Camera.cs Normal file
View File

@@ -0,0 +1,96 @@
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;
}
}
/// <summary>Camera system modes</summary>
public enum CameraMode
{
CAMERA_CUSTOM = 0,
CAMERA_FREE,
CAMERA_ORBITAL,
CAMERA_FIRST_PERSON,
CAMERA_THIRD_PERSON
}
/// <summary>Camera projection</summary>
public enum CameraProjection
{
CAMERA_PERSPECTIVE = 0,
CAMERA_ORTHOGRAPHIC
}
/// <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;
}
}
}

68
Raylib-cs/types/Color.cs Normal file
View File

@@ -0,0 +1,68 @@
using System;
using System.Numerics;
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());
}
}
}

160
Raylib-cs/types/Core.cs Normal file
View File

@@ -0,0 +1,160 @@
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,
}
/// <summary>Trace log level
/// NOTE: Organized by priority level</summary>
public enum TraceLogLevel
{
/// <summary>
/// Display all logs
/// </summary>
LOG_ALL = 0,
/// <summary>
/// Trace logging, intended for internal use only
/// </summary>
LOG_TRACE,
/// <summary>
/// Debug logging, used for internal debugging, it should be disabled on release builds
/// </summary>
LOG_DEBUG,
/// <summary>
/// Info logging, used for program execution info
/// </summary>
LOG_INFO,
/// <summary>
/// Warning logging, used on recoverable failures
/// </summary>
LOG_WARNING,
/// <summary>
/// Error logging, used on unrecoverable failures
/// </summary>
LOG_ERROR,
/// <summary>
/// Fatal logging, used to abort program: exit(EXIT_FAILURE)
/// </summary>
LOG_FATAL,
/// <summary>
/// Disable logging
/// </summary>
LOG_NONE
}
/// <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
}
}

93
Raylib-cs/types/Font.cs Normal file
View File

@@ -0,0 +1,93 @@
using System;
using System.Runtime.InteropServices;
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
}
/// <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;
}
/// <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;
}
}

149
Raylib-cs/types/Image.cs Normal file
View File

@@ -0,0 +1,149 @@
using System;
using System.Runtime.InteropServices;
namespace Raylib_cs
{
/// <summary>Pixel formats
/// NOTE: Support depends on OpenGL version and platform</summary>
public enum PixelFormat
{
/// <summary>
/// 8 bit per pixel (no alpha)
/// </summary>
PIXELFORMAT_UNCOMPRESSED_GRAYSCALE = 1,
/// <summary>
/// 8*2 bpp (2 channels)
/// </summary>
PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA,
/// <summary>
/// 16 bpp
/// </summary>
PIXELFORMAT_UNCOMPRESSED_R5G6B5,
/// <summary>
/// 24 bpp
/// </summary>
PIXELFORMAT_UNCOMPRESSED_R8G8B8,
/// <summary>
/// 16 bpp (1 bit alpha)
/// </summary>
PIXELFORMAT_UNCOMPRESSED_R5G5B5A1,
/// <summary>
/// 16 bpp (4 bit alpha)
/// </summary>
PIXELFORMAT_UNCOMPRESSED_R4G4B4A4,
/// <summary>
/// 32 bpp
/// </summary>
PIXELFORMAT_UNCOMPRESSED_R8G8B8A8,
/// <summary>
/// 32 bpp (1 channel - float)
/// </summary>
PIXELFORMAT_UNCOMPRESSED_R32,
/// <summary>
/// 32*3 bpp (3 channels - float)
/// </summary>
PIXELFORMAT_UNCOMPRESSED_R32G32B32,
/// <summary>
/// 32*4 bpp (4 channels - float)
/// </summary>
PIXELFORMAT_UNCOMPRESSED_R32G32B32A32,
/// <summary>
/// 4 bpp (no alpha)
/// </summary>
PIXELFORMAT_COMPRESSED_DXT1_RGB,
/// <summary>
/// 4 bpp (1 bit alpha)
/// </summary>
PIXELFORMAT_COMPRESSED_DXT1_RGBA,
/// <summary>
/// 8 bpp
/// </summary>
PIXELFORMAT_COMPRESSED_DXT3_RGBA,
/// <summary>
/// 8 bpp
/// </summary>
PIXELFORMAT_COMPRESSED_DXT5_RGBA,
/// <summary>
/// 4 bpp
/// </summary>
PIXELFORMAT_COMPRESSED_ETC1_RGB,
/// <summary>
/// 4 bpp
/// </summary>
PIXELFORMAT_COMPRESSED_ETC2_RGB,
/// <summary>
/// 8 bpp
/// </summary>
PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA,
/// <summary>
/// 4 bpp
/// </summary>
PIXELFORMAT_COMPRESSED_PVRT_RGB,
/// <summary>
/// 4 bpp
/// </summary>
PIXELFORMAT_COMPRESSED_PVRT_RGBA,
/// <summary>
/// 8 bpp
/// </summary>
PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA,
/// <summary>
/// 2 bpp
/// </summary>
PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA
}
/// <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;
}
}

480
Raylib-cs/types/Input.cs Normal file
View File

@@ -0,0 +1,480 @@
using System;
using System.Numerics;
using System.Runtime.InteropServices;
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
}
/// <summary>Mouse buttons</summary>
public enum MouseButton
{
/// <summary>
/// Mouse button left
/// </summary>
MOUSE_BUTTON_LEFT = 0,
/// <summary>
/// Mouse button right
/// </summary>
MOUSE_BUTTON_RIGHT = 1,
/// <summary>
/// Mouse button middle (pressed wheel)
/// </summary>
MOUSE_BUTTON_MIDDLE = 2,
/// <summary>
/// Mouse button side (advanced mouse device)
/// </summary>
MOUSE_BUTTON_SIDE = 3,
/// <summary>
/// Mouse button extra (advanced mouse device)
/// </summary>
MOUSE_BUTTON_EXTRA = 4,
/// <summary>
/// Mouse button fordward (advanced mouse device)
/// </summary>
MOUSE_BUTTON_FORWARD = 5,
/// <summary>
/// Mouse button back (advanced mouse device)
/// </summary>
MOUSE_BUTTON_BACK = 6,
MOUSE_LEFT_BUTTON = MOUSE_BUTTON_LEFT,
MOUSE_RIGHT_BUTTON = MOUSE_BUTTON_RIGHT,
MOUSE_MIDDLE_BUTTON = MOUSE_BUTTON_MIDDLE,
}
/// <summary>Mouse cursor</summary>
public enum MouseCursor
{
/// <summary>
/// Default pointer shape
/// </summary>
MOUSE_CURSOR_DEFAULT = 0,
/// <summary>
/// Arrow shape
/// </summary>
MOUSE_CURSOR_ARROW = 1,
/// <summary>
/// Text writing cursor shape
/// </summary>
MOUSE_CURSOR_IBEAM = 2,
/// <summary>
/// Cross shape
/// </summary>
MOUSE_CURSOR_CROSSHAIR = 3,
/// <summary>
/// Pointing hand cursor
/// </summary>
MOUSE_CURSOR_POINTING_HAND = 4,
/// <summary>
/// Horizontal resize/move arrow shape
/// </summary>
MOUSE_CURSOR_RESIZE_EW = 5,
/// <summary>
/// Vertical resize/move arrow shape
/// </summary>
MOUSE_CURSOR_RESIZE_NS = 6,
/// <summary>
/// Top-left to bottom-right diagonal resize/move arrow shape
/// </summary>
MOUSE_CURSOR_RESIZE_NWSE = 7,
/// <summary>
/// The top-right to bottom-left diagonal resize/move arrow shape
/// </summary>
MOUSE_CURSOR_RESIZE_NESW = 8,
/// <summary>
/// The omni-directional resize/move cursor shape
/// </summary>
MOUSE_CURSOR_RESIZE_ALL = 9,
/// <summary>
/// The operation-not-allowed shape
/// </summary>
MOUSE_CURSOR_NOT_ALLOWED = 10
}
/// <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
}
/// <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
}
/// <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
}
/// <summary>Head-Mounted-Display device parameters</summary>
[StructLayout(LayoutKind.Sequential)]
public unsafe struct VrDeviceInfo
{
/// <summary>
/// HMD horizontal resolution in pixels
/// </summary>
public int hResolution;
/// <summary>
/// HMD vertical resolution in pixels
/// </summary>
public int vResolution;
/// <summary>
/// HMD horizontal size in meters
/// </summary>
public float hScreenSize;
/// <summary>
/// HMD vertical size in meters
/// </summary>
public float vScreenSize;
/// <summary>
/// HMD screen center in meters
/// </summary>
public float vScreenCenter;
/// <summary>
/// HMD distance between eye and display in meters
/// </summary>
public float eyeToScreenDistance;
/// <summary>
/// HMD lens separation distance in meters
/// </summary>
public float lensSeparationDistance;
/// <summary>
/// HMD IPD (distance between pupils) in meters
/// </summary>
public float interpupillaryDistance;
/// <summary>
/// HMD lens distortion constant parameters
/// </summary>
public fixed float lensDistortionValues[4];
/// <summary>
/// HMD chromatic aberration correction parameters
/// </summary>
public fixed float chromaAbCorrection[4];
}
/// <summary>VR Stereo rendering configuration for simulator</summary>
[StructLayout(LayoutKind.Sequential)]
public struct VrStereoConfig
{
/// <summary>
/// VR projection matrices (per eye)
/// </summary>
public Matrix4x4 projection1;
/// <summary>
/// VR projection matrices (per eye)
/// </summary>
public Matrix4x4 projection2;
/// <summary>
/// VR view offset matrices (per eye)
/// </summary>
public Matrix4x4 viewOffset1;
/// <summary>
/// VR view offset matrices (per eye)
/// </summary>
public Matrix4x4 viewOffset2;
/// <summary>
/// VR left lens center
/// </summary>
public Vector2 leftLensCenter;
/// <summary>
/// VR right lens center
/// </summary>
public Vector2 rightLensCenter;
/// <summary>
/// VR left screen center
/// </summary>
public Vector2 leftScreenCenter;
/// <summary>
/// VR right screen center
/// </summary>
public Vector2 rightScreenCenter;
/// <summary>
/// VR distortion scale
/// </summary>
public Vector2 scale;
/// <summary>
/// VR distortion scale in
/// </summary>
public Vector2 scaleIn;
}
}

View File

@@ -0,0 +1,89 @@
using System;
using System.Runtime.InteropServices;
namespace Raylib_cs
{
/// <summary>Material map index</summary>
public enum MaterialMapIndex
{
/// <summary>
/// MAP_DIFFUSE
/// </summary>
MATERIAL_MAP_ALBEDO = 0,
/// <summary>
/// MAP_SPECULAR
/// </summary>
MATERIAL_MAP_METALNESS = 1,
MATERIAL_MAP_NORMAL = 2,
MATERIAL_MAP_ROUGHNESS = 3,
MATERIAL_MAP_OCCLUSION,
MATERIAL_MAP_EMISSION,
MATERIAL_MAP_HEIGHT,
/// <summary>
/// NOTE: Uses GL_TEXTURE_CUBE_MAP
/// </summary>
MATERIAL_MAP_CUBEMAP,
/// <summary>
/// NOTE: Uses GL_TEXTURE_CUBE_MAP
/// </summary>
MATERIAL_MAP_IRRADIANCE,
/// <summary>
/// NOTE: Uses GL_TEXTURE_CUBE_MAP
/// </summary>
MATERIAL_MAP_PREFILTER,
MATERIAL_MAP_BRDF,
MATERIAL_MAP_DIFFUSE = MATERIAL_MAP_ALBEDO,
MATERIAL_MAP_SPECULAR = MATERIAL_MAP_METALNESS,
}
/// <summary>
/// Material texture map
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct MaterialMap
{
/// <summary>
/// Material map texture
/// </summary>
public Texture2D texture;
/// <summary>
/// Material map color
/// </summary>
public Color color;
/// <summary>
/// Material map value
/// </summary>
public float value;
}
/// <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;
}
}

123
Raylib-cs/types/Mesh.cs Normal file
View File

@@ -0,0 +1,123 @@
using System;
using System.Numerics;
using System.Runtime.InteropServices;
namespace Raylib_cs
{
/// <summary>
/// Transform, vectex transformation data
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct Transform
{
/// <summary>
/// Translation
/// </summary>
public Vector3 translation;
/// <summary>
/// Rotation
/// </summary>
public Vector4 rotation;
/// <summary>
/// Scale
/// </summary>
public Vector3 scale;
}
/// <summary>
/// Vertex data definning a mesh
/// NOTE: Data stored in CPU memory (and GPU)
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct Mesh
{
/// <summary>
/// Number of vertices stored in arrays
/// </summary>
public int vertexCount;
/// <summary>
/// Number of triangles stored (indexed or not)
/// </summary>
public int triangleCount;
#region Default vertex data
/// <summary>
/// Vertex position (XYZ - 3 components per vertex) (shader-location = 0, float *)
/// </summary>
public IntPtr vertices;
/// <summary>
/// Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1, float *)
/// </summary>
public IntPtr texcoords;
/// <summary>
/// Vertex second texture coordinates (useful for lightmaps) (shader-location = 5, float *)
/// </summary>
public IntPtr texcoords2;
/// <summary>
/// Vertex normals (XYZ - 3 components per vertex) (shader-location = 2, float *)
/// </summary>
public IntPtr normals;
/// <summary>
/// Vertex tangents (XYZW - 4 components per vertex) (shader-location = 4, float *)
/// </summary>
public IntPtr tangents;
/// <summary>
/// Vertex colors (RGBA - 4 components per vertex) (shader-location = 3, unsigned char *)
/// </summary>
public IntPtr colors;
/// <summary>
/// Vertex indices (in case vertex data comes indexed, unsigned short *)
/// </summary>
public IntPtr indices;
#endregion
#region Animation vertex data
/// <summary>
/// Animated vertex positions (after bones transformations, float *)
/// </summary>
public IntPtr animVertices;
/// <summary>
/// Animated normals (after bones transformations, float *)
/// </summary>
public IntPtr animNormals;
/// <summary>
/// Vertex bone ids, up to 4 bones influence by vertex (skinning, int *)
/// </summary>
public IntPtr boneIds;
/// <summary>
/// Vertex bone weight, up to 4 bones influence by vertex (skinning, float *)
/// </summary>
public IntPtr boneWeights;
#endregion
#region OpenGL identifiers
/// <summary>
/// OpenGL Vertex Array Object id
/// </summary>
public uint vaoId;
/// <summary>
/// OpenGL Vertex Buffer Objects id (default vertex data, uint[])
/// </summary>
public IntPtr vboId;
#endregion
}
}

100
Raylib-cs/types/Model.cs Normal file
View File

@@ -0,0 +1,100 @@
using System;
using System.Numerics;
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;
}
/// <summary>
/// Model type
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct Model
{
/// <summary>
/// Local transform matrix
/// </summary>
public Matrix4x4 transform;
/// <summary>
/// Number of meshes
/// </summary>
public int meshCount;
/// <summary>
/// Number of materials
/// </summary>
public int materialCount;
/// <summary>
/// Meshes array (Mesh *)
/// </summary>
public IntPtr meshes;
/// <summary>
/// Materials array (Material *)
/// </summary>
public IntPtr materials;
/// <summary>
/// Mesh material number (int *)
/// </summary>
public IntPtr meshMaterial;
/// <summary>
/// Number of bones
/// </summary>
public int boneCount;
/// <summary>
/// Bones information (skeleton, BoneInfo *)
/// </summary>
public IntPtr bones;
/// <summary>
/// Bones base transformation (pose, Transform *)
/// </summary>
public IntPtr bindPose;
}
/// <summary>Model animation</summary>
[StructLayout(LayoutKind.Sequential)]
public struct ModelAnimation
{
/// <summary>
/// Number of bones
/// </summary>
public int boneCount;
/// <summary>
/// Number of animation frames
/// </summary>
public int frameCount;
/// <summary>
/// Bones information (skeleton, BoneInfo *)
/// </summary>
public IntPtr bones;
/// <summary>
/// Poses array by frame (Transform **)
/// </summary>
public IntPtr framePoses;
}
}

View File

@@ -0,0 +1,60 @@
using System.Runtime.InteropServices;
namespace Raylib_cs
{
/// <summary>N-patch layout</summary>
public enum NPatchLayout
{
/// <summary>
/// Npatch defined by 3x3 tiles
/// </summary>
NPATCH_NINE_PATCH = 0,
/// <summary>
/// Npatch defined by 1x3 tiles
/// </summary>
NPATCH_THREE_PATCH_VERTICAL,
/// <summary>
/// Npatch defined by 3x1 tiles
/// </summary>
NPATCH_THREE_PATCH_HORIZONTAL
}
/// <summary>
/// N-Patch layout info
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct NPatchInfo
{
/// <summary>
/// Texture source rectangle
/// </summary>
public Rectangle source;
/// <summary>
/// Left border offset
/// </summary>
public int left;
/// <summary>
/// Top border offset
/// </summary>
public int top;
/// <summary>
/// Right border offset
/// </summary>
public int right;
/// <summary>
/// Bottom border offset
/// </summary>
public int bottom;
/// <summary>
/// Layout of the n-patch: 3x3, 1x3 or 3x1
/// </summary>
public NPatchLayout layout;
}
}

View File

@@ -0,0 +1,26 @@
using System.Runtime.InteropServices;
namespace Raylib_cs
{
/// <summary>
/// RenderTexture2D type, for texture rendering
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct RenderTexture2D
{
/// <summary>
/// OpenGL Framebuffer Object (FBO) id
/// </summary>
public uint id;
/// <summary>
/// Color buffer attachment texture
/// </summary>
public Texture2D texture;
/// <summary>
/// Depth buffer attachment texture
/// </summary>
public Texture2D depth;
}
}

79
Raylib-cs/types/Shader.cs Normal file
View File

@@ -0,0 +1,79 @@
using System;
using System.Runtime.InteropServices;
namespace Raylib_cs
{
/// <summary>Shader location index</summary>
public enum ShaderLocationIndex
{
SHADER_LOC_VERTEX_POSITION = 0,
SHADER_LOC_VERTEX_TEXCOORD01,
SHADER_LOC_VERTEX_TEXCOORD02,
SHADER_LOC_VERTEX_NORMAL,
SHADER_LOC_VERTEX_TANGENT,
SHADER_LOC_VERTEX_COLOR,
SHADER_LOC_MATRIX_MVP,
SHADER_LOC_MATRIX_VIEW,
SHADER_LOC_MATRIX_PROJECTION,
SHADER_LOC_MATRIX_MODEL,
SHADER_LOC_MATRIX_NORMAL,
SHADER_LOC_VECTOR_VIEW,
SHADER_LOC_COLOR_DIFFUSE,
SHADER_LOC_COLOR_SPECULAR,
SHADER_LOC_COLOR_AMBIENT,
SHADER_LOC_MAP_ALBEDO,
SHADER_LOC_MAP_METALNESS,
SHADER_LOC_MAP_NORMAL,
SHADER_LOC_MAP_ROUGHNESS,
SHADER_LOC_MAP_OCCLUSION,
SHADER_LOC_MAP_EMISSION,
SHADER_LOC_MAP_HEIGHT,
SHADER_LOC_MAP_CUBEMAP,
SHADER_LOC_MAP_IRRADIANCE,
SHADER_LOC_MAP_PREFILTER,
SHADER_LOC_MAP_BRDF,
SHADER_LOC_MAP_DIFFUSE = SHADER_LOC_MAP_ALBEDO,
SHADER_LOC_MAP_SPECULAR = SHADER_LOC_MAP_METALNESS,
}
// Shader attribute data types
public enum ShaderAttributeDataType
{
SHADER_ATTRIB_FLOAT = 0,
SHADER_ATTRIB_VEC2,
SHADER_ATTRIB_VEC3,
SHADER_ATTRIB_VEC4
}
/// <summary>Shader uniform data type</summary>
public enum ShaderUniformDataType
{
SHADER_UNIFORM_FLOAT = 0,
SHADER_UNIFORM_VEC2,
SHADER_UNIFORM_VEC3,
SHADER_UNIFORM_VEC4,
SHADER_UNIFORM_INT,
SHADER_UNIFORM_IVEC2,
SHADER_UNIFORM_IVEC3,
SHADER_UNIFORM_IVEC4,
SHADER_UNIFORM_SAMPLER2D
}
/// <summary>
/// Shader type (generic)
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct Shader
{
/// <summary>
/// Shader program id
/// </summary>
public uint id;
/// <summary>
/// Shader locations array (MAX_SHADER_LOCATIONS, int *)
/// </summary>
public IntPtr locs;
}
}

92
Raylib-cs/types/Shapes.cs Normal file
View File

@@ -0,0 +1,92 @@
using System.Numerics;
using System.Runtime.InteropServices;
namespace Raylib_cs
{
/// <summary>
/// Rectangle type
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct Rectangle
{
public float x;
public float y;
public float width;
public float height;
public Rectangle(float x, float y, float width, float height)
{
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
}
/// <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;
}
}
/// <summary>Ray, ray for raycasting</summary>
[StructLayout(LayoutKind.Sequential)]
public struct Ray
{
/// <summary>
/// Ray position (origin)
/// </summary>
public Vector3 position;
/// <summary>
/// Ray direction
/// </summary>
public Vector3 direction;
public Ray(Vector3 position, Vector3 direction)
{
this.position = position;
this.direction = direction;
}
}
/// <summary>Raycast hit information</summary>
[StructLayout(LayoutKind.Sequential)]
public struct RayCollision
{
/// <summary>
/// Did the ray hit something?
/// </summary>
public byte hit;
/// <summary>
/// Distance to nearest hit
/// </summary>
public float distance;
/// <summary>
/// Position of nearest hit
/// </summary>
public Vector3 point;
/// <summary>
/// Surface normal of hit
/// </summary>
public Vector3 normal;
}
}

View File

@@ -0,0 +1,132 @@
using System.Runtime.InteropServices;
namespace Raylib_cs
{
/// <summary>Texture parameters: filter mode
/// NOTE 1: Filtering considers mipmaps if available in the texture
/// NOTE 2: Filter is accordingly set for minification and magnification</summary>
public enum TextureFilter
{
/// <summary>
/// No filter, just pixel aproximation
/// </summary>
TEXTURE_FILTER_POINT = 0,
/// <summary>
/// Linear filtering
/// </summary>
TEXTURE_FILTER_BILINEAR,
/// <summary>
/// Trilinear filtering (linear with mipmaps)
/// </summary>
TEXTURE_FILTER_TRILINEAR,
/// <summary>
/// Anisotropic filtering 4x
/// </summary>
TEXTURE_FILTER_ANISOTROPIC_4X,
/// <summary>
/// Anisotropic filtering 8x
/// </summary>
TEXTURE_FILTER_ANISOTROPIC_8X,
/// <summary>
/// Anisotropic filtering 16x
/// </summary>
TEXTURE_FILTER_ANISOTROPIC_16X,
}
/// <summary>Texture parameters: wrap mode</summary>
public enum TextureWrap
{
/// <summary>
/// Repeats texture in tiled mode
/// </summary>
TEXTURE_WRAP_REPEAT = 0,
/// <summary>
/// Clamps texture to edge pixel in tiled mode
/// </summary>
TEXTURE_WRAP_CLAMP,
/// <summary>
/// Mirrors and repeats the texture in tiled mode
/// </summary>
TEXTURE_WRAP_MIRROR_REPEAT,
/// <summary>
/// Mirrors and clamps to border the texture in tiled mode
/// </summary>
TEXTURE_WRAP_MIRROR_CLAMP
}
/// <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
}
/// <summary>
/// Texture2D type
/// <br />
/// NOTE: Data stored in GPU memory
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct Texture2D
{
/// <summary>
/// OpenGL texture id
/// </summary>
public uint id;
/// <summary>
/// Texture base width
/// </summary>
public int width;
/// <summary>
/// Texture 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;
}
}