-
-
Notifications
You must be signed in to change notification settings - Fork 5
Home
MrScautHD edited this page Apr 27, 2024
·
32 revisions
This wiki is dedicated to all things in Raylib-CSharp. Explore our documentation and guides to get started!
void TakeScreenshot(string fileName); // Takes a screenshot of current screen (filename extension defines format)
void SetConfigFlags(ConfigFlag flags); // Setup init configuration flags (view FLAGS)
void OpenURL(string url); // Open URL with default system browser (if available)
void SetRandomSeed(int seed); // Set the seed for the random number generator
int GetRandomValue(int min, int max); // Get a random value between min and max (both included)
int* LoadRandomSequence(int count, int min, int max); // Load random values sequence, no values repeated
void UnloadRandomSequence(int* sequence); // Unload random values sequence
void* MemAlloc(int size); // Internal memory allocator
void* MemRealloc(void *ptr, int size); // Internal memory reallocator
void MemFree(void* ptr); // Internal memory free
void Init(int width, int height, string title); // Initialize window and OpenGL context
void Close(); // Close window and unload OpenGL context
bool ShouldClose(); // Check if application should close (KEY_ESCAPE pressed or windows close icon clicked)
bool IsReady(); // Check if window has been initialized successfully
bool IsFullscreen(); // Check if window is currently fullscreen
bool IsHidden(); // Check if window is currently hidden (only PLATFORM_DESKTOP)
bool IsMinimized(); // Check if window is currently minimized (only PLATFORM_DESKTOP)
bool IsMaximized(); // Check if window is currently maximized (only PLATFORM_DESKTOP)
bool IsFocused(); // Check if window is currently focused (only PLATFORM_DESKTOP)
bool IsResized(); // Check if window has been resized last frame
bool IsState(ConfigFlag flag); // Check if one specific window flag is enabled
void SetState(ConfigFlag flags); // Set window configuration state using flags (only PLATFORM_DESKTOP)
void ClearState(ConfigFlag flags); // Clear window configuration state flags
void ToggleFullscreen(); // Toggle window state: fullscreen/windowed (only PLATFORM_DESKTOP)
void ToggleBorderless(); // Toggle window state: borderless windowed (only PLATFORM_DESKTOP)
void Maximize(); // Set window state: maximized, if resizable (only PLATFORM_DESKTOP)
void Minimize(); // Set window state: minimized, if resizable (only PLATFORM_DESKTOP)
void Restore(); // Set window state: not minimized/maximized (only PLATFORM_DESKTOP)
void SetIcon(Image image); // Set icon for window (single image, RGBA 32bit, only PLATFORM_DESKTOP)
void SetIcons(Image* images, int count); // Set icon for window (multiple images, RGBA 32bit, only PLATFORM_DESKTOP)
void SetTitle(string title); // Set title for window (only PLATFORM_DESKTOP and PLATFORM_WEB)
void SetPosition(int x, int y); // Set window position on screen (only PLATFORM_DESKTOP)
void SetMonitor(int monitor); // Set monitor for the current window
void SetMinSize(int width, int height); // Set window minimum dimensions (for FLAG_WINDOW_RESIZABLE)
void SetMaxSize(int width, int height); // Set window maximum dimensions (for FLAG_WINDOW_RESIZABLE)
void SetSize(int width, int height); // Set window dimensions
void SetOpacity(float opacity); // Set window opacity [0.0f..1.0f] (only PLATFORM_DESKTOP)
void SetFocused(); // Set window focused (only PLATFORM_DESKTOP)
void* GetHandle(); // Get native window handle
int GetScreenWidth(); // Get current screen width
int GetScreenHeight(); // Get current screen height
int GetRenderWidth(); // Get current render width (it considers HiDPI)
int GetRenderHeight(); // Get current render height (it considers HiDPI)
int GetMonitorCount(); // Get number of connected monitors
int GetCurrentMonitor(); // Get current connected monitor
Vector2 GetMonitorPosition(int monitor); // Get specified monitor position
int GetMonitorWidth(int monitor); // Get specified monitor width (current video mode used by monitor)
int GetMonitorHeight(int monitor); // Get specified monitor height (current video mode used by monitor)
int GetMonitorPhysicalWidth(int monitor); // Get specified monitor physical width in millimetres
int GetMonitorPhysicalHeight(int monitor); // Get specified monitor physical height in millimetres
int GetMonitorRefreshRate(int monitor); // Get specified monitor refresh rate
Vector2 GetWindowPosition(); // Get window position XY on monitor
Vector2 GetWindowScaleDPI(); // Get window scale DPI factor
string GetMonitorName(int monitor); // Get the human-readable, UTF-8 encoded name of the specified monitor
void SetClipboardText(string text); // Set clipboard text content
string GetClipboardText(); // Get clipboard text content
void EnableEventWaiting(); // Enable waiting for events on EndDrawing(), no automatic event polling
void DisableEventWaiting(); // Disable waiting for events on EndDrawing(), automatic events polling
void ClearBackground(Color color); // Set background color (framebuffer clear color)
void BeginDrawing(); // Setup canvas (framebuffer) to start drawing
void EndDrawing(); // End canvas drawing and swap buffers (double buffering)
void BeginMode2D(Camera2D camera); // Begin 2D mode with custom camera (2D)
void EndMode2D(); // Ends 2D mode with custom camera
void BeginMode3D(Camera3D camera); // Begin 3D mode with custom camera (3D)
void EndMode3D(); // Ends 3D mode and returns to default 2D orthographic mode
void BeginTextureMode(RenderTexture2D target); // Begin drawing to render texture
void EndTextureMode(); // Ends drawing to render texture
void BeginShaderMode(Shader shader); // Begin custom shader drawing
void EndShaderMode(); // End custom shader drawing (use default shader)
void BeginBlendMode(BlendMode mode); // Begin blending mode (alpha, additive, multiplied, subtract, custom)
void EndBlendMode(); // End blending mode (reset to default: alpha blending)
void BeginScissorMode(int x, int y, int width, int height); // Begin scissor mode (define screen area for following drawing)
void EndScissorMode(); // End scissor mode
void BeginVrStereoMode(VrStereoConfig config); // Begin stereo rendering (requires VR simulator)
void EndVrStereoMode(); // End stereo rendering (requires VR simulator)
void SwapScreenBuffer(); // Swap back buffer with front buffer (screen drawing)
VrStereoConfig LoadVrStereoConfig(VrDeviceInfo device); // Load VR stereo config for VR simulator device parameters
void UnloadVrStereoConfig(VrStereoConfig config); // Unload VR stereo config
Shader Load(string vsFileName, string fsFileName); // Load shader from files and bind default locations
Shader LoadFromMemory(string vsCode, string fsCode); // Load shader from code strings and bind default locations
bool IsReady(Shader shader); // Check if a shader is ready
int GetLocation(Shader shader, string uniformName); // Get shader uniform location
int GetLocationAttrib(Shader shader, string attribName); // Get shader attribute location
void SetValue<T>(Shader shader, int locIndex, T value, ShaderUniformDataType uniformType); // Set shader uniform value
void SetValueV<T>(Shader shader, int locIndex, T[] value, ShaderUniformDataType uniformType, int count); // Set shader uniform value vector
void SetValueMatrix(Shader shader, int locIndex, Matrix4x4 mat); // Set shader uniform value (matrix 4x4)
void SetValueTexture(Shader shader, int locIndex, Texture2D texture); // Set shader uniform value for texture (sampler2d)
void Unload(Shader shader); // Unload shader from GPU memory (VRAM)
void Update(ref Camera3D camera, CameraMode mode); // Update camera position for selected mode
void UpdatePro(ref Camera3D camera, Vector3 movement, Vector3 rotation, float zoom); // Update camera movement/rotation
Ray GetMouseRay(Vector2 mousePosition, Camera3D camera); // Get a ray trace from mouse position
Matrix4x4 GetMatrix(Camera3D camera); // Get camera transform matrix (view matrix)
Matrix4x4 GetMatrix2D(Camera2D camera); // Get camera 2d transform matrix
Vector2 GetWorldToScreen(Vector3 position, Camera3D camera); // Get the screen space position for a 3d world space position
Vector2 GetScreenToWorld2D(Vector2 position, Camera2D camera); // Get the world space position for a 2d camera screen space position
Vector2 GetWorldToScreenEx(Vector3 position, Camera3D camera, int width, int height); // Get size position for a 3d world space position
Vector2 GetWorldToScreen2D(Vector2 position, Camera2D camera); // Get the screen space position for a 2d camera world space position
void ShowCursor(); // Shows cursor
void HideCursor(); // Hides cursor
bool IsCursorHidden(); // Check if cursor is not visible
void EnableCursor(); // Enables cursor (unlock cursor)
void DisableCursor(); // Disables cursor (lock cursor)
bool IsCursorOnScreen(); // Check if cursor is on the screen
bool IsKeyPressed(KeyboardKey key); // Check if a key has been pressed once
bool IsKeyPressedRepeat(KeyboardKey key); // Check if a key has been pressed again (Only PLATFORM_DESKTOP)
bool IsKeyDown(KeyboardKey key); // Check if a key is being pressed
bool IsKeyReleased(KeyboardKey key); // Check if a key has been released once
bool IsKeyUp(KeyboardKey key); // Check if a key is NOT being pressed
KeyboardKey GetKeyPressed(); // Get key pressed (keycode), call it multiple times for keys queued, returns 0 when the queue is empty
int GetCharPressed(); // Get char pressed (unicode), call it multiple times for chars queued, returns 0 when the queue is empty
void SetExitKey(KeyboardKey key); // Set a custom key to exit program (default is ESC)
bool IsGamepadAvailable(int gamepad); // Check if a gamepad is available
string GetGamepadName(int gamepad); // Get gamepad internal name id
bool IsGamepadButtonPressed(int gamepad, GamepadButton button); // Check if a gamepad button has been pressed once
bool IsGamepadButtonDown(int gamepad, GamepadButton button); // Check if a gamepad button is being pressed
bool IsGamepadButtonReleased(int gamepad, GamepadButton button); // Check if a gamepad button has been released once
bool IsGamepadButtonUp(int gamepad, GamepadButton button); // Check if a gamepad button is NOT being pressed
int GetGamepadButtonPressed(); // Get the last gamepad button pressed
int GetGamepadAxisCount(int gamepad); // Get gamepad axis count for a gamepad
float GetGamepadAxisMovement(int gamepad, int axis); // Get axis movement value for a gamepad axis
int SetGamepadMappings(string mappings); // Set internal gamepad mappings (SDL_GameControllerDB)
bool IsMouseButtonPressed(MouseButton button); // Check if a mouse button has been pressed once
bool IsMouseButtonDown(MouseButton button); // Check if a mouse button is being pressed
bool IsMouseButtonReleased(MouseButton button); // Check if a mouse button has been released once
bool IsMouseButtonUp(MouseButton button); // Check if a mouse button is NOT being pressed
int GetMouseX(); // Get mouse position X
int GetMouseY(); // Get mouse position Y
Vector2 GetMousePosition(); // Get mouse position XY
Vector2 GetMouseDelta(); // Get mouse delta between frames
void SetMousePosition(int x, int y); // Set mouse position XY
void SetMouseOffset(int offsetX, int offsetY); // Set mouse offset
void SetMouseScale(float scaleX, float scaleY); // Set mouse scaling
float GetMouseWheelMove(); // Get mouse wheel movement for X or Y, whichever is larger
Vector2 GetMouseWheelMoveV(); // Get mouse wheel movement for both X and Y
void SetMouseCursor(MouseCursor cursor); // Set mouse cursor
int GetTouchX(); // Get touch position X for touch point 0 (relative to screen size)
int GetTouchY(); // Get touch position Y for touch point 0 (relative to screen size)
Vector2 GetTouchPosition(int index); // Get touch position XY for a touch point index (relative to screen size)
int GetTouchPointId(int index); // Get touch point identifier for given index
int GetTouchPointCount(); // Get number of touch points
void PollInputEvents(); // Register all input events
void SetTargetFPS(int fps); // Set target FPS (maximum)
float GetFrameTime(); // Get time in seconds for last frame drawn (delta time)
double GetTime(); // Get elapsed time in seconds since InitWindow()
int GetFPS(); // Get current FPS
void WaitTime(double seconds); // Wait for some time (halt program execution)
void TraceLog(TraceLogLevel logLevel, string text); // Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR...)
void SetTraceLogLevel(TraceLogLevel logLevel); // Set the current threshold (minimum) log level
void SetTraceLogCallback(delegate* unmanaged[Cdecl]<int, sbyte*, sbyte*, void> callback); // Set custom trace log
byte* LoadFileData(string fileName, uint* dataSize); // Load file data as byte array (read)
void UnloadFileData(byte* data); // Unload file data allocated by LoadFileData()
bool SaveFileData(string fileName, void* data, uint dataSize); // Save data to file from byte array (write), returns true on success
bool ExportDataAsCode(byte* data, int dataSize, string fileName); // Export data to code (.h), returns true on success
string LoadFileText(string fileName); // Load text data from file (read), returns a '\0' terminated string
void UnloadFileText(string text); // Unload file text data allocated by LoadFileText()
bool SaveFileText(string fileName, string text); // Save text data to file (write), string must be '\0' terminated, returns true on success
bool FileExists(string fileName); // Check if file exists
bool DirectoryExists(string dirPath); // Check if a directory path exists
bool IsFileExtension(string fileName, string ext); // Check file extension (including point: .png, .wav)
int GetFileLength(string fileName); // Get file length in bytes (NOTE: GetFileSize() conflicts with windows.h)
string GetFileExtension(string fileName); // Get pointer to extension for a filename string (includes dot: '.png')
string GetFileName(string filePath); // Get pointer to filename for a path string
string GetFileNameWithoutExt(string filePath); // Get filename string without extension (uses static string)
string GetDirectoryPath(string filePath); // Get full path for a given fileName with path (uses static string)
string GetPrevDirectoryPath(string dirPath); // Get previous directory path for a given path (uses static string)
string GetWorkingDirectory(); // Get current working directory (uses static string)
string GetApplicationDirectory(); // Get the directory of the running application (uses static string)
bool ChangeDirectory(string dir); // Change working directory, return true on success
bool IsPathFile(string path); // Check if a given path is a file or a directory
FilePathList LoadDirectoryFiles(string dirPath); // Load directory filepaths
FilePathList LoadDirectoryFilesEx(string basePath, string filter, bool scanSubdirs); // Load directory filepaths with extension filtering and recursive directory scan
void UnloadDirectoryFiles(FilePathList files); // Unload filepaths
bool IsFileDropped(); // Check if a file has been dropped into window
FilePathList LoadDroppedFiles(); // Load dropped filepaths
void UnloadDroppedFiles(FilePathList files); // Unload dropped filepaths
long GetFileModTime(string fileName); // Get file modification time (last write time)
byte* CompressData(byte* data, int dataSize, int* compDataSize); // Compress data (DEFLATE algorithm), memory must be MemFree()
byte* DecompressData(byte* compData, int compDataSize, int* dataSize); // Decompress data (DEFLATE algorithm), memory must be MemFree()
string EncodeDataBase64(byte* data, int dataSize, int* outputSize); // Encode data to Base64 string, memory must be MemFree()
byte* DecodeDataBase64(byte* data, int* outputSize); // Decode Base64 string data, memory must be MemFree()
AutomationEventList LoadAutomationEventList(string fileName); // Load automation events list from file, NULL for empty list, capacity = MAX_AUTOMATION_EVENTS
void UnloadAutomationEventList(ref AutomationEventList list); // Unload automation events list from file
bool ExportAutomationEventList(AutomationEventList list, string fileName); // Export automation events list as text file
void SetAutomationEventList(ref AutomationEventList list); // Set automation event list to record to
void SetAutomationEventBaseFrame(int frame); // Set automation event internal base frame to start recording
void StartAutomationEventRecording(); // Start recording automation events (AutomationEventList must be set)
void StopAutomationEventRecording(); // Stop recording automation events
void PlayAutomationEvent(AutomationEvent event); // Play a recorded automation event