diff options
Diffstat (limited to 'cheatsheet/raylib_core.c')
| -rw-r--r-- | cheatsheet/raylib_core.c | 142 |
1 files changed, 71 insertions, 71 deletions
diff --git a/cheatsheet/raylib_core.c b/cheatsheet/raylib_core.c index 486d7b4..1a227ca 100644 --- a/cheatsheet/raylib_core.c +++ b/cheatsheet/raylib_core.c @@ -44,7 +44,7 @@ const char *GetClipboardText(void); // Get clipboard text content void EnableEventWaiting(void); // Enable waiting for events on EndDrawing(), no automatic event polling void DisableEventWaiting(void); // Disable waiting for events on EndDrawing(), automatic events polling - + // Custom frame control functions // NOTE: Those functions are intended for advance users that want full control over the frame processing // By default EndDrawing() does this job: draws everything + SwapScreenBuffer() + manage frame timming + PollInputEvents() @@ -52,7 +52,7 @@ void SwapScreenBuffer(void); // Swap back buffer with front buffer (screen drawing) void PollInputEvents(void); // Register all input events void WaitTime(double seconds); // Wait for some time (halt program execution) - + // Cursor-related functions void ShowCursor(void); // Shows cursor void HideCursor(void); // Hides cursor @@ -60,7 +60,7 @@ void EnableCursor(void); // Enables cursor (unlock cursor) void DisableCursor(void); // Disables cursor (lock cursor) bool IsCursorOnScreen(void); // Check if cursor is on the screen - + // Drawing-related functions void ClearBackground(Color color); // Set background color (framebuffer clear color) void BeginDrawing(void); // Setup canvas (framebuffer) to start drawing @@ -79,11 +79,11 @@ void EndScissorMode(void); // End scissor mode void BeginVrStereoMode(VrStereoConfig config); // Begin stereo rendering (requires VR simulator) void EndVrStereoMode(void); // End stereo rendering (requires VR simulator) - + // VR stereo config functions for VR simulator VrStereoConfig LoadVrStereoConfig(VrDeviceInfo device); // Load VR stereo config for VR simulator device parameters void UnloadVrStereoConfig(VrStereoConfig config); // Unload VR stereo config - + // Shader management functions // NOTE: Shader functionality is not available on OpenGL 1.1 Shader LoadShader(const char *vsFileName, const char *fsFileName); // Load shader from files and bind default locations @@ -95,7 +95,7 @@ void SetShaderValueMatrix(Shader shader, int locIndex, Matrix mat); // Set shader uniform value (matrix 4x4) void SetShaderValueTexture(Shader shader, int locIndex, Texture2D texture); // Set shader uniform value for texture (sampler2d) void UnloadShader(Shader shader); // Unload shader from GPU memory (VRAM) - + // Screen-space-related functions Ray GetMouseRay(Vector2 mousePosition, Camera camera); // Get a ray trace from mouse position Matrix GetCameraMatrix(Camera camera); // Get camera transform matrix (view matrix) @@ -104,27 +104,27 @@ Vector2 GetScreenToWorld2D(Vector2 position, Camera2D camera); // Get the world space position for a 2d camera screen space position Vector2 GetWorldToScreenEx(Vector3 position, Camera 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 - + // Timing-related functions void SetTargetFPS(int fps); // Set target FPS (maximum) int GetFPS(void); // Get current FPS float GetFrameTime(void); // Get time in seconds for last frame drawn (delta time) double GetTime(void); // Get elapsed time in seconds since InitWindow() - + // Misc. functions int GetRandomValue(int min, int max); // Get a random value between min and max (both included) void SetRandomSeed(unsigned int seed); // Set the seed for the random number generator void TakeScreenshot(const char *fileName); // Takes a screenshot of current screen (filename extension defines format) void SetConfigFlags(unsigned int flags); // Setup init configuration flags (view FLAGS) - + void TraceLog(int logLevel, const char *text, ...); // Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR...) void SetTraceLogLevel(int logLevel); // Set the current threshold (minimum) log level void *MemAlloc(int size); // Internal memory allocator void *MemRealloc(void *ptr, int size); // Internal memory reallocator void MemFree(void *ptr); // Internal memory free - + void OpenURL(const char *url); // Open URL with default system browser (if available) - + // Set custom callbacks // WARNING: Callbacks setup is intended for advance users void SetTraceLogCallback(TraceLogCallback callback); // Set custom trace log @@ -132,7 +132,7 @@ void SetSaveFileDataCallback(SaveFileDataCallback callback); // Set custom file binary data saver void SetLoadFileTextCallback(LoadFileTextCallback callback); // Set custom file text data loader void SetSaveFileTextCallback(SaveFileTextCallback callback); // Set custom file text data saver - + // Files management functions unsigned char *LoadFileData(const char *fileName, unsigned int *bytesRead); // Load file data as byte array (read) void UnloadFileData(unsigned char *data); // Unload file data allocated by LoadFileData() @@ -161,81 +161,81 @@ FilePathList LoadDroppedFiles(void); // Load dropped filepaths void UnloadDroppedFiles(FilePathList files); // Unload dropped filepaths long GetFileModTime(const char *fileName); // Get file modification time (last write time) - + // Compression/Encoding functionality unsigned char *CompressData(const unsigned char *data, int dataSize, int *compDataSize); // Compress data (DEFLATE algorithm), memory must be MemFree() unsigned char *DecompressData(const unsigned char *compData, int compDataSize, int *dataSize); // Decompress data (DEFLATE algorithm), memory must be MemFree() char *EncodeDataBase64(const unsigned char *data, int dataSize, int *outputSize); // Encode data to Base64 string, memory must be MemFree() unsigned char *DecodeDataBase64(const unsigned char *data, int *outputSize); // Decode Base64 string data, memory must be MemFree() - + //------------------------------------------------------------------------------------ // Input Handling Functions (Module: core) //------------------------------------------------------------------------------------ - + // Input-related functions: keyboard - bool IsKeyPressed(int key); // Check if a key has been pressed once - bool IsKeyDown(int key); // Check if a key is being pressed - bool IsKeyReleased(int key); // Check if a key has been released once - bool IsKeyUp(int key); // Check if a key is NOT being pressed - void SetExitKey(int key); // Set a custom key to exit program (default is ESC) - int GetKeyPressed(void); // Get key pressed (keycode), call it multiple times for keys queued, returns 0 when the queue is empty - int GetCharPressed(void); // Get char pressed (unicode), call it multiple times for chars queued, returns 0 when the queue is empty - + bool IsKeyPressed(int key); // Check if a key has been pressed once + bool IsKeyDown(int key); // Check if a key is being pressed + bool IsKeyReleased(int key); // Check if a key has been released once + bool IsKeyUp(int key); // Check if a key is NOT being pressed + void SetExitKey(int key); // Set a custom key to exit program (default is ESC) + int GetKeyPressed(void); // Get key pressed (keycode), call it multiple times for keys queued, returns 0 when the queue is empty + int GetCharPressed(void); // Get char pressed (unicode), call it multiple times for chars queued, returns 0 when the queue is empty + // Input-related functions: gamepads - bool IsGamepadAvailable(int gamepad); // Check if a gamepad is available - const char *GetGamepadName(int gamepad); // Get gamepad internal name id - bool IsGamepadButtonPressed(int gamepad, int button); // Check if a gamepad button has been pressed once - bool IsGamepadButtonDown(int gamepad, int button); // Check if a gamepad button is being pressed - bool IsGamepadButtonReleased(int gamepad, int button); // Check if a gamepad button has been released once - bool IsGamepadButtonUp(int gamepad, int button); // Check if a gamepad button is NOT being pressed - int GetGamepadButtonPressed(void); // 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(const char *mappings); // Set internal gamepad mappings (SDL_GameControllerDB) - + bool IsGamepadAvailable(int gamepad); // Check if a gamepad is available + const char *GetGamepadName(int gamepad); // Get gamepad internal name id + bool IsGamepadButtonPressed(int gamepad, int button); // Check if a gamepad button has been pressed once + bool IsGamepadButtonDown(int gamepad, int button); // Check if a gamepad button is being pressed + bool IsGamepadButtonReleased(int gamepad, int button); // Check if a gamepad button has been released once + bool IsGamepadButtonUp(int gamepad, int button); // Check if a gamepad button is NOT being pressed + int GetGamepadButtonPressed(void); // 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(const char *mappings); // Set internal gamepad mappings (SDL_GameControllerDB) + // Input-related functions: mouse - bool IsMouseButtonPressed(int button); // Check if a mouse button has been pressed once - bool IsMouseButtonDown(int button); // Check if a mouse button is being pressed - bool IsMouseButtonReleased(int button); // Check if a mouse button has been released once - bool IsMouseButtonUp(int button); // Check if a mouse button is NOT being pressed - int GetMouseX(void); // Get mouse position X - int GetMouseY(void); // Get mouse position Y - Vector2 GetMousePosition(void); // Get mouse position XY - Vector2 GetMouseDelta(void); // 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(void); // Get mouse wheel movement for X or Y, whichever is larger - Vector2 GetMouseWheelMoveV(void); // Get mouse wheel movement for both X and Y - void SetMouseCursor(int cursor); // Set mouse cursor - - // Input-related functions: touch - int GetTouchX(void); // Get touch position X for touch point 0 (relative to screen size) - int GetTouchY(void); // 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(void); // Get number of touch points - + bool IsMouseButtonPressed(int button); // Check if a mouse button has been pressed once + bool IsMouseButtonDown(int button); // Check if a mouse button is being pressed + bool IsMouseButtonReleased(int button); // Check if a mouse button has been released once + bool IsMouseButtonUp(int button); // Check if a mouse button is NOT being pressed + int GetMouseX(void); // Get mouse position X + int GetMouseY(void); // Get mouse position Y + Vector2 GetMousePosition(void); // Get mouse position XY + Vector2 GetMouseDelta(void); // 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(void); // Get mouse wheel movement for X or Y, whichever is larger + Vector2 GetMouseWheelMoveV(void); // Get mouse wheel movement for both X and Y + void SetMouseCursor(int cursor); // Set mouse cursor + + // Input-related functions: touch + int GetTouchX(void); // Get touch position X for touch point 0 (relative to screen size) + int GetTouchY(void); // 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(void); // Get number of touch points + //------------------------------------------------------------------------------------ // Gestures and Touch Handling Functions (Module: rgestures) //------------------------------------------------------------------------------------ - void SetGesturesEnabled(unsigned int flags); // Enable a set of gestures using flags - bool IsGestureDetected(int gesture); // Check if a gesture have been detected - int GetGestureDetected(void); // Get latest detected gesture - float GetGestureHoldDuration(void); // Get gesture hold time in milliseconds - Vector2 GetGestureDragVector(void); // Get gesture drag vector - float GetGestureDragAngle(void); // Get gesture drag angle - Vector2 GetGesturePinchVector(void); // Get gesture pinch delta - float GetGesturePinchAngle(void); // Get gesture pinch angle - + void SetGesturesEnabled(unsigned int flags); // Enable a set of gestures using flags + bool IsGestureDetected(int gesture); // Check if a gesture have been detected + int GetGestureDetected(void); // Get latest detected gesture + float GetGestureHoldDuration(void); // Get gesture hold time in milliseconds + Vector2 GetGestureDragVector(void); // Get gesture drag vector + float GetGestureDragAngle(void); // Get gesture drag angle + Vector2 GetGesturePinchVector(void); // Get gesture pinch delta + float GetGesturePinchAngle(void); // Get gesture pinch angle + //------------------------------------------------------------------------------------ // Camera System Functions (Module: rcamera) //------------------------------------------------------------------------------------ - void SetCameraMode(Camera camera, int mode); // Set camera mode (multiple camera modes available) - void UpdateCamera(Camera *camera); // Update camera position for selected mode - - void SetCameraPanControl(int keyPan); // Set camera pan key to combine with mouse movement (free camera) - void SetCameraAltControl(int keyAlt); // Set camera alt key to combine with mouse movement (free camera) - void SetCameraSmoothZoomControl(int keySmoothZoom); // Set camera smooth zoom key to combine with mouse (free camera) + void SetCameraMode(Camera camera, int mode); // Set camera mode (multiple camera modes available) + void UpdateCamera(Camera *camera); // Update camera position for selected mode + + void SetCameraPanControl(int keyPan); // Set camera pan key to combine with mouse movement (free camera) + void SetCameraAltControl(int keyAlt); // Set camera alt key to combine with mouse movement (free camera) + void SetCameraSmoothZoomControl(int keySmoothZoom); // Set camera smooth zoom key to combine with mouse (free camera) void SetCameraMoveControls(int keyFront, int keyBack, int keyRight, int keyLeft, int keyUp, int keyDown); // Set camera move controls (1st person and 3rd person cameras) |
