summaryrefslogtreecommitdiffhomepage
path: root/src/raylib.h
diff options
context:
space:
mode:
authorMurray Campbell <[email protected]>2018-10-24 14:33:53 -0500
committerGitHub <[email protected]>2018-10-24 14:33:53 -0500
commit03fb5499a0f2c4b45ed1b2655a6e1e77221ed46a (patch)
tree346e60c85c667b4e7650b7d3cd1c7ee3c8a54be5 /src/raylib.h
parent9c6a98aa61b0a43c0d85347b3da26f90dd5c42fc (diff)
parent72431c6c36a166b00e52527962ab4d978ab0111d (diff)
downloadraylib-03fb5499a0f2c4b45ed1b2655a6e1e77221ed46a.tar.gz
raylib-03fb5499a0f2c4b45ed1b2655a6e1e77221ed46a.zip
Merge pull request #7 from raysan5/master
pull
Diffstat (limited to 'src/raylib.h')
-rw-r--r--src/raylib.h46
1 files changed, 31 insertions, 15 deletions
diff --git a/src/raylib.h b/src/raylib.h
index a44b77ee..be2383b1 100644
--- a/src/raylib.h
+++ b/src/raylib.h
@@ -223,7 +223,7 @@
#define MOUSE_MIDDLE_BUTTON 2
// Touch points registered
-#define MAX_TOUCH_POINTS 2
+#define MAX_TOUCH_POINTS 10
// Gamepad Number
#define GAMEPAD_PLAYER1 0
@@ -311,7 +311,7 @@
// NOTE: MSC C++ compiler does not support compound literals (C99 feature)
// Plain structures in C++ (without constructors) can be initialized from { } initializers.
-#ifdef __cplusplus
+#if defined(__cplusplus)
#define CLITERAL
#else
#define CLITERAL (Color)
@@ -354,11 +354,11 @@
//----------------------------------------------------------------------------------
// Structures Definition
//----------------------------------------------------------------------------------
-#ifndef __cplusplus
// Boolean type
- #ifndef bool
- typedef enum { false, true } bool;
- #endif
+#if defined(__STDC__) && __STDC_VERSION__ >= 199901L
+ #include <stdbool.h>
+#elif !defined(__cplusplus) && !defined(bool)
+ typedef enum { false, true } bool;
#endif
// Vector2 type
@@ -786,7 +786,7 @@ typedef enum {
// Callbacks to be implemented by users
typedef void (*TraceLogCallback)(int msgType, const char *text, va_list args);
-#ifdef __cplusplus
+#if defined(__cplusplus)
extern "C" { // Prevents name mangling of functions
#endif
@@ -814,6 +814,13 @@ RLAPI void SetWindowMinSize(int width, int height); // Set window
RLAPI void SetWindowSize(int width, int height); // Set window dimensions
RLAPI int GetScreenWidth(void); // Get current screen width
RLAPI int GetScreenHeight(void); // Get current screen height
+RLAPI void *GetWindowHandle(void); // Get native window handle
+RLAPI int GetMonitorCount(void); // Get number of connected monitors
+RLAPI int GetMonitorWidth(int monitor); // Get primary monitor width
+RLAPI int GetMonitorHeight(int monitor); // Get primary monitor height
+RLAPI int GetMonitorPhysicalWidth(int monitor); // Get primary monitor physical width in millimetres
+RLAPI int GetMonitorPhysicalHeight(int monitor); // Get primary monitor physical height in millimetres
+RLAPI const char *GetMonitorName(int monitor); // Get the human-readable, UTF-8 encoded name of the primary monitor
// Cursor-related functions
RLAPI void ShowCursor(void); // Shows cursor
@@ -861,15 +868,20 @@ RLAPI void TakeScreenshot(const char *fileName); // Takes a scr
RLAPI int GetRandomValue(int min, int max); // Returns a random value between min and max (both included)
// Files management functions
+RLAPI bool FileExists(const char *fileName); // Check if file exists
RLAPI bool IsFileExtension(const char *fileName, const char *ext);// Check file extension
RLAPI const char *GetExtension(const char *fileName); // Get pointer to extension for a filename string
RLAPI const char *GetFileName(const char *filePath); // Get pointer to filename for a path string
+RLAPI const char *GetFileNameWithoutExt(const char *filePath); // Get filename string without extension (memory should be freed)
RLAPI const char *GetDirectoryPath(const char *fileName); // Get full path for a given fileName (uses static string)
RLAPI const char *GetWorkingDirectory(void); // Get current working directory (uses static string)
+RLAPI char **GetDirectoryFiles(const char *dirPath, int *count); // Get filenames in a directory path (memory should be freed)
+RLAPI void ClearDirectoryFiles(void); // Clear directory files paths buffers (free memory)
RLAPI bool ChangeDirectory(const char *dir); // Change working directory, returns true if success
RLAPI bool IsFileDropped(void); // Check if a file has been dropped into window
-RLAPI char **GetDroppedFiles(int *count); // Get dropped files names
-RLAPI void ClearDroppedFiles(void); // Clear dropped files paths buffer
+RLAPI char **GetDroppedFiles(int *count); // Get dropped files names (memory should be freed)
+RLAPI void ClearDroppedFiles(void); // Clear dropped files paths buffer (free memory)
+RLAPI long GetFileModTime(const char *fileName); // Get file modification time (last write time)
// Persistent storage management
RLAPI void StorageSaveValue(int position, int value); // Save integer value to storage file (to defined position)
@@ -1010,11 +1022,12 @@ RLAPI void ImageAlphaClear(Image *image, Color color, float threshold);
RLAPI void ImageAlphaCrop(Image *image, float threshold); // Crop image depending on alpha value
RLAPI void ImageAlphaPremultiply(Image *image); // Premultiply alpha channel
RLAPI void ImageCrop(Image *image, Rectangle crop); // Crop an image to a defined rectangle
-RLAPI void ImageResize(Image *image, int newWidth, int newHeight); // Resize image (bilinear filtering)
+RLAPI void ImageResize(Image *image, int newWidth, int newHeight); // Resize image (Bicubic scaling algorithm)
RLAPI void ImageResizeNN(Image *image, int newWidth,int newHeight); // Resize image (Nearest-Neighbor scaling algorithm)
RLAPI void ImageResizeCanvas(Image *image, int newWidth, int newHeight, int offsetX, int offsetY, Color color); // Resize canvas and fill with color
RLAPI void ImageMipmaps(Image *image); // Generate all mipmap levels for a provided image
RLAPI void ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp); // Dither image data to 16bpp or lower (Floyd-Steinberg dithering)
+RLAPI Color *ImageExtractPalette(Image image, int maxPaletteSize, int *extractCount); // Extract color palette from image to maximum size (memory should be freed)
RLAPI Image ImageText(const char *text, int fontSize, Color color); // Create an image from text (default font)
RLAPI Image ImageTextEx(Font font, const char *text, float fontSize, float spacing, Color tint); // Create an image from text (custom sprite font)
RLAPI void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec); // Draw a source image within a destination image
@@ -1064,21 +1077,24 @@ RLAPI Font GetFontDefault(void);
RLAPI Font LoadFont(const char *fileName); // Load font from file into GPU memory (VRAM)
RLAPI Font LoadFontEx(const char *fileName, int fontSize, int charsCount, int *fontChars); // Load font from file with extended parameters
RLAPI CharInfo *LoadFontData(const char *fileName, int fontSize, int *fontChars, int charsCount, int type); // Load font data for further use
-RLAPI Image GenImageFontAtlas(CharInfo *chars, int fontSize, int charsCount, int padding, int packMethod); // Generate image font atlas using chars info
+RLAPI Image GenImageFontAtlas(CharInfo *chars, int charsCount, int fontSize, int padding, int packMethod); // Generate image font atlas using chars info
RLAPI void UnloadFont(Font font); // Unload Font from GPU memory (VRAM)
// Text drawing functions
RLAPI void DrawFPS(int posX, int posY); // Shows current FPS
RLAPI void DrawText(const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font)
-RLAPI void DrawTextEx(Font font, const char* text, Vector2 position, float fontSize, float spacing, Color tint); // Draw text using font and additional parameters
+RLAPI void DrawTextEx(Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint); // Draw text using font and additional parameters
// Text misc. functions
RLAPI int MeasureText(const char *text, int fontSize); // Measure string width for default font
RLAPI Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing); // Measure string size for Font
-RLAPI const char *FormatText(const char *text, ...); // Formatting of text with variables to 'embed'
-RLAPI const char *SubText(const char *text, int position, int length); // Get a piece of a text string
RLAPI int GetGlyphIndex(Font font, int character); // Get index position for a unicode character on font
+// Text string edition functions
+RLAPI const char *FormatText(const char *text, ...); // Formatting of text with variables to 'embed'
+RLAPI const char *SubText(const char *text, int position, int length); // Get a piece of a text string
+RLAPI char **SplitText(char *text, char delimiter, int *strCount); // Split text string into multiple strings (memory should be freed manually!)
+
//------------------------------------------------------------------------------------
// Basic 3d Shapes Drawing Functions (Module: models)
//------------------------------------------------------------------------------------
@@ -1264,7 +1280,7 @@ RLAPI void StopAudioStream(AudioStream stream); // Stop au
RLAPI void SetAudioStreamVolume(AudioStream stream, float volume); // Set volume for audio stream (1.0 is max level)
RLAPI void SetAudioStreamPitch(AudioStream stream, float pitch); // Set pitch for audio stream (1.0 is base level)
-#ifdef __cplusplus
+#if defined(__cplusplus)
}
#endif