summaryrefslogtreecommitdiffhomepage
path: root/cheatsheet/raylib_core.c
diff options
context:
space:
mode:
authorRay <[email protected]>2020-01-30 18:21:19 +0100
committerRay <[email protected]>2020-01-30 18:21:19 +0100
commita10421b42ab818e1d1d4115e01e2d49fe61374c1 (patch)
treeaaa998e8c7515aba334d9354047a5f4ca73fccfe /cheatsheet/raylib_core.c
parentc4e5184fb9788128d66f8f8a36885cd36dbf74f4 (diff)
downloadraylib.com-a10421b42ab818e1d1d4115e01e2d49fe61374c1.tar.gz
raylib.com-a10421b42ab818e1d1d4115e01e2d49fe61374c1.zip
Updated raylib cheatsheet
Diffstat (limited to 'cheatsheet/raylib_core.c')
-rw-r--r--cheatsheet/raylib_core.c43
1 files changed, 28 insertions, 15 deletions
diff --git a/cheatsheet/raylib_core.c b/cheatsheet/raylib_core.c
index c1ac75b..b23acff 100644
--- a/cheatsheet/raylib_core.c
+++ b/cheatsheet/raylib_core.c
@@ -24,17 +24,18 @@
int GetMonitorHeight(int monitor); // Get primary monitor height
int GetMonitorPhysicalWidth(int monitor); // Get primary monitor physical width in millimetres
int GetMonitorPhysicalHeight(int monitor); // Get primary monitor physical height in millimetres
+ Vector2 GetWindowPosition(void); // Get window position XY on monitor
const char *GetMonitorName(int monitor); // Get the human-readable, UTF-8 encoded name of the primary monitor
const char *GetClipboardText(void); // Get clipboard text content
void SetClipboardText(const char *text); // Set clipboard text content
-
- // Cursor-related functions
+
+ // Cursor-related functions
void ShowCursor(void); // Shows cursor
void HideCursor(void); // Hides cursor
bool IsCursorHidden(void); // Check if cursor is not visible
void EnableCursor(void); // Enables cursor (unlock cursor)
void DisableCursor(void); // Disables cursor (lock cursor)
-
+
// Drawing-related functions
void ClearBackground(Color color); // Set background color (framebuffer clear color)
void BeginDrawing(void); // Setup canvas (framebuffer) to start drawing
@@ -45,42 +46,51 @@
void EndMode3D(void); // Ends 3D mode and returns to default 2D orthographic mode
void BeginTextureMode(RenderTexture2D target); // Initializes render texture for drawing
void EndTextureMode(void); // Ends drawing to render texture
-
+ void BeginScissorMode(int x, int y, int width, int height); // Begin scissor mode (define screen area for following drawing)
+ void EndScissorMode(void); // End scissor mode
+
// Screen-space-related functions
Ray GetMouseRay(Vector2 mousePosition, Camera camera); // Returns a ray trace from mouse position
- Vector2 GetWorldToScreen(Vector3 position, Camera camera); // Returns the screen space position for a 3d world space position
Matrix GetCameraMatrix(Camera camera); // Returns camera transform matrix (view matrix)
-
+ Matrix GetCameraMatrix2D(Camera2D camera); // Returns camera 2d transform matrix
+ Vector2 GetWorldToScreen(Vector3 position, Camera camera); // Returns the screen space position for a 3d world space position
+ Vector2 GetWorldToScreenEx(Vector3 position, Camera camera, int width, int height); // Returns size position for a 3d world space position
+ Vector2 GetWorldToScreen2D(Vector2 position, Camera2D camera ); // Returns the screen space position for a 2d camera world space position
+ Vector2 GetScreenToWorld2D(Vector2 position, Camera2D camera ); // Returns the world space position for a 2d camera screen space position
+
// Timing-related functions
void SetTargetFPS(int fps); // Set target FPS (maximum)
int GetFPS(void); // Returns current FPS
float GetFrameTime(void); // Returns time in seconds for last frame drawn
double GetTime(void); // Returns elapsed time in seconds since InitWindow()
-
+
// Color-related functions
int ColorToInt(Color color); // Returns hexadecimal value for a Color
Vector4 ColorNormalize(Color color); // Returns color normalized as float [0..1]
+ Color ColorFromNormalized(Vector4 normalized); // Returns color from normalized values [0..1]
Vector3 ColorToHSV(Color color); // Returns HSV values for a Color
Color ColorFromHSV(Vector3 hsv); // Returns a Color from HSV values
Color GetColor(int hexValue); // Returns a Color struct from hexadecimal value
Color Fade(Color color, float alpha); // Color fade-in or fade-out, alpha goes from 0.0f to 1.0f
-
+
// Misc. functions
- void SetConfigFlags(unsigned char flags); // Setup window configuration flags (view FLAGS)
+ void SetConfigFlags(unsigned int flags); // Setup window configuration flags (view FLAGS)
void SetTraceLogLevel(int logType); // Set the current threshold (minimum) log level
void SetTraceLogExit(int logType); // Set the exit threshold (minimum) log level
void SetTraceLogCallback(TraceLogCallback callback); // Set a trace log callback to enable custom logging
void TraceLog(int logType, const char *text, ...); // Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR)
void TakeScreenshot(const char *fileName); // Takes a screenshot of current screen (saved a .png)
int GetRandomValue(int min, int max); // Returns a random value between min and max (both included)
-
+
// Files management functions
bool FileExists(const char *fileName); // Check if file exists
bool IsFileExtension(const char *fileName, const char *ext); // Check file extension
+ bool DirectoryExists(const char *dirPath); // Check if a directory path exists
const char *GetExtension(const char *fileName); // Get pointer to extension for a filename string
const char *GetFileName(const char *filePath); // Get pointer to filename for a path string
- const char *GetFileNameWithoutExt(const char *filePath); // Get filename string without extension (memory should be freed)
- const char *GetDirectoryPath(const char *fileName); // Get full path for a given fileName (uses static string)
+ const char *GetFileNameWithoutExt(const char *filePath); // Get filename string without extension (uses static string)
+ const char *GetDirectoryPath(const char *filePath); // Get full path for a given fileName with path (uses static string)
+ const char *GetPrevDirectoryPath(const char *dirPath); // Get previous directory path for a given path (uses static string)
const char *GetWorkingDirectory(void); // Get current working directory (uses static string)
char **GetDirectoryFiles(const char *dirPath, int *count); // Get filenames in a directory path (memory should be freed)
void ClearDirectoryFiles(void); // Clear directory files paths buffers (free memory)
@@ -89,11 +99,14 @@
char **GetDroppedFiles(int *count); // Get dropped files names (memory should be freed)
void ClearDroppedFiles(void); // Clear dropped files paths buffer (free memory)
long GetFileModTime(const char *fileName); // Get file modification time (last write time)
-
- // Persistent storage management
+
+ unsigned char *CompressData(unsigned char *data, int dataLength, int *compDataLength); // Compress data (DEFLATE algorythm)
+ unsigned char *DecompressData(unsigned char *compData, int compDataLength, int *dataLength); // Decompress data (DEFLATE algorythm)
+
+ // Persistent storage management
void StorageSaveValue(int position, int value); // Save integer value to storage file (to defined position)
int StorageLoadValue(int position); // Load integer value from storage file (from defined position)
-
+
void OpenURL(const char *url); // Open URL with default system browser (if available)
//------------------------------------------------------------------------------------