summaryrefslogtreecommitdiffhomepage
path: root/src/raylib.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/raylib.h')
-rw-r--r--src/raylib.h96
1 files changed, 40 insertions, 56 deletions
diff --git a/src/raylib.h b/src/raylib.h
index dade7aba..6a5f0ef8 100644
--- a/src/raylib.h
+++ b/src/raylib.h
@@ -4,19 +4,20 @@
*
* FEATURES:
* - NO external dependencies, all required libraries included with raylib
-* - Multiple platforms support: Windows, Linux, FreeBSD, OpenBSD, NetBSD, DragonFly, MacOS, UWP, Android, Raspberry Pi, HTML5.
+* - Multiplatform: Windows, Linux, FreeBSD, OpenBSD, NetBSD, DragonFly, MacOS, UWP, Android, Raspberry Pi, HTML5.
* - Written in plain C code (C99) in PascalCase/camelCase notation
* - Hardware accelerated with OpenGL (1.1, 2.1, 3.3 or ES2 - choose at compile)
* - Unique OpenGL abstraction layer (usable as standalone module): [rlgl]
-* - Powerful fonts module with Fonts support (XNA fonts, AngelCode fonts, TTF)
+* - Powerful fonts module (XNA SpriteFonts, BMFonts, TTF)
* - Outstanding texture formats support, including compressed formats (DXT, ETC, ASTC)
* - Full 3d support for 3d Shapes, Models, Billboards, Heightmaps and more!
* - Flexible Materials system, supporting classic maps and PBR maps
+* - Skeletal Animation support (CPU bones-based animation)
* - Shaders support, including Model shaders and Postprocessing shaders
* - Powerful math module for Vector, Matrix and Quaternion operations: [raymath]
* - Audio loading and playing with streaming support (WAV, OGG, MP3, FLAC, XM, MOD)
* - VR stereo rendering with configurable HMD device parameters
-* - Complete bindings to LUA (raylib-lua) and Go (raylib-go)
+* - Bindings to multiple programming languages available!
*
* NOTES:
* One custom font is loaded by default when InitWindow() [core]
@@ -24,24 +25,26 @@
* If using OpenGL 3.3 or ES2, several vertex buffers (VAO/VBO) are created to manage lines-triangles-quads
*
* DEPENDENCIES (included):
-* rglfw (github.com/glfw/glfw) for window/context management and input (only PLATFORM_DESKTOP) [core]
-* glad (github.com/Dav1dde/glad) for OpenGL extensions loading (3.3 Core profile, only PLATFORM_DESKTOP) [rlgl]
-* mini_al (github.com/dr-soft/mini_al) for audio device/context management [audio]
+* [core] rglfw (github.com/glfw/glfw) for window/context management and input (only PLATFORM_DESKTOP)
+* [rlgl] glad (github.com/Dav1dde/glad) for OpenGL 3.3 extensions loading (only PLATFORM_DESKTOP)
+* [raudio] miniaudio (github.com/dr-soft/miniaudio) for audio device/context management
*
* OPTIONAL DEPENDENCIES (included):
-* stb_image (Sean Barret) for images loading (BMP, TGA, PNG, JPEG, HDR...) [textures]
-* stb_image_resize (Sean Barret) for image resizing algorythms [textures]
-* stb_image_write (Sean Barret) for image writting (PNG) [utils]
-* stb_truetype (Sean Barret) for ttf fonts loading [text]
-* stb_rect_pack (Sean Barret) for rectangles packing [text]
-* stb_vorbis (Sean Barret) for OGG audio loading [audio]
-* stb_perlin (Sean Barret) for Perlin noise image generation [textures]
-* par_shapes (Philip Rideout) for parametric 3d shapes generation [models]
-* jar_xm (Joshua Reisenauer) for XM audio module loading [audio]
-* jar_mod (Joshua Reisenauer) for MOD audio module loading [audio]
-* dr_flac (David Reid) for FLAC audio file loading [audio]
-* dr_mp3 (David Reid) for MP3 audio file loading [audio]
-* rgif (Charlie Tangora, Ramon Santamaria) for GIF recording [core]
+* [core] rgif (Charlie Tangora, Ramon Santamaria) for GIF recording
+* [textures] stb_image (Sean Barret) for images loading (BMP, TGA, PNG, JPEG, HDR...)
+* [textures] stb_image_write (Sean Barret) for image writting (BMP, TGA, PNG, JPG)
+* [textures] stb_image_resize (Sean Barret) for image resizing algorythms
+* [textures] stb_perlin (Sean Barret) for Perlin noise image generation
+* [text] stb_truetype (Sean Barret) for ttf fonts loading
+* [text] stb_rect_pack (Sean Barret) for rectangles packing
+* [models] par_shapes (Philip Rideout) for parametric 3d shapes generation
+* [models] tinyobj_loader_c (Syoyo Fujita) for models loading (OBJ, MTL)
+* [models] cgltf (Johannes Kuhlmann) for models loading (glTF)
+* [raudio] stb_vorbis (Sean Barret) for OGG audio loading
+* [raudio] dr_flac (David Reid) for FLAC audio file loading
+* [raudio] dr_mp3 (David Reid) for MP3 audio file loading
+* [raudio] jar_xm (Joshua Reisenauer) for XM audio module loading
+* [raudio] jar_mod (Joshua Reisenauer) for MOD audio module loading
*
*
* LICENSE: zlib/libpng
@@ -275,7 +278,7 @@ typedef struct Camera3D {
int type; // Camera type, defines projection type: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC
} Camera3D;
-#define Camera Camera3D // Camera type fallback, defaults to Camera3D
+typedef Camera3D Camera; // Camera type fallback, defaults to Camera3D
// Camera2D type, defines a 2d camera
typedef struct Camera2D {
@@ -285,12 +288,6 @@ typedef struct Camera2D {
float zoom; // Camera zoom (scaling), should be 1.0f by default
} Camera2D;
-// Bounding box type
-typedef struct BoundingBox {
- Vector3 min; // Minimum vertex box-corner
- Vector3 max; // Maximum vertex box-corner
-} BoundingBox;
-
// Vertex data definning a mesh
// NOTE: Data stored in CPU memory (and GPU)
typedef struct Mesh {
@@ -390,6 +387,12 @@ typedef struct RayHitInfo {
Vector3 normal; // Surface normal of hit
} RayHitInfo;
+// Bounding box type
+typedef struct BoundingBox {
+ Vector3 min; // Minimum vertex box-corner
+ Vector3 max; // Maximum vertex box-corner
+} BoundingBox;
+
// Wave type, defines audio wave data
typedef struct Wave {
unsigned int sampleCount; // Number of samples
@@ -440,20 +443,9 @@ typedef struct VrDeviceInfo {
float chromaAbCorrection[4]; // HMD chromatic aberration correction parameters
} VrDeviceInfo;
-// VR Stereo rendering configuration for simulator
-typedef struct VrStereoConfig {
- RenderTexture2D stereoFbo; // VR stereo rendering framebuffer
- Shader distortionShader; // VR stereo rendering distortion shader
- Matrix eyesProjection[2]; // VR stereo rendering eyes projection matrices
- Matrix eyesViewOffset[2]; // VR stereo rendering eyes view offset matrices
- int eyeViewportRight[4]; // VR stereo rendering right eye viewport [x, y, w, h]
- int eyeViewportLeft[4]; // VR stereo rendering left eye viewport [x, y, w, h]
-} VrStereoConfig;
-
//----------------------------------------------------------------------------------
// Enumerators Definition
//----------------------------------------------------------------------------------
-
// System config flags
// NOTE: Used for bit masks
typedef enum {
@@ -469,14 +461,14 @@ typedef enum {
// Trace log type
typedef enum {
- LOG_ALL, // Display all logs
+ LOG_ALL = 0, // Display all logs
LOG_TRACE,
LOG_DEBUG,
LOG_INFO,
LOG_WARNING,
LOG_ERROR,
LOG_FATAL,
- LOG_NONE // Disable logging
+ LOG_NONE // Disable logging
} TraceLogType;
// Keyboard keys
@@ -858,16 +850,6 @@ typedef enum {
CAMERA_ORTHOGRAPHIC
} CameraType;
-// Head Mounted Display devices
-typedef enum {
- HMD_DEFAULT_DEVICE = 0,
- HMD_OCULUS_RIFT_DK2,
- HMD_OCULUS_RIFT_CV1,
- HMD_OCULUS_GO,
- HMD_VALVE_HTC_VIVE,
- HMD_SONY_PSVR
-} VrDeviceType;
-
// Type of n-patch
typedef enum {
NPT_9PATCH = 0, // Npatch defined by 3x3 tiles
@@ -943,7 +925,7 @@ RLAPI Ray GetMouseRay(Vector2 mousePosition, Camera camera); // Returns a r
RLAPI Vector2 GetWorldToScreen(Vector3 position, Camera camera); // Returns the screen space position for a 3d world space position
RLAPI Matrix GetCameraMatrix(Camera camera); // Returns camera transform matrix (view matrix)
-// timing-related functions
+// Timing-related functions
RLAPI void SetTargetFPS(int fps); // Set target FPS (maximum)
RLAPI int GetFPS(void); // Returns current FPS
RLAPI float GetFrameTime(void); // Returns time in seconds for last frame drawn
@@ -1208,11 +1190,13 @@ RLAPI void DrawTextRecEx(Font font, const char *text, Rectangle rec, float fontS
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 int GetGlyphIndex(Font font, int character); // Get index position for a unicode character on font
+RLAPI int GetNextCodepoint(const char* text, int* count); // Returns next codepoint in a UTF8 encoded `text` or 0x3f(`?`) on failure. `count` will hold the total number of bytes processed.
// Text strings management functions
// NOTE: Some strings allocate memory internally for returned strings, just be careful!
RLAPI bool TextIsEqual(const char *text1, const char *text2); // Check if two text string are equal
RLAPI unsigned int TextLength(const char *text); // Get text length, checks for '\0' ending
+RLAPI unsigned int TextCountCodepoints(const char *text); // Get total number of characters(codepoints) in a UTF8 encoded `text` until '\0' is found.
RLAPI const char *TextFormat(const char *text, ...); // Text formatting with variables (sprintf style)
RLAPI const char *TextSubtext(const char *text, int position, int length); // Get a piece of a text string
RLAPI const char *TextReplace(char *text, const char *replace, const char *by); // Replace text string (memory should be freed!)
@@ -1255,7 +1239,7 @@ RLAPI void DrawGizmo(Vector3 position);
// Model loading/unloading functions
RLAPI Model LoadModel(const char *fileName); // Load model from files (meshes and materials)
-RLAPI Model LoadModelFromMesh(Mesh mesh); // Load model from generated mesh
+RLAPI Model LoadModelFromMesh(Mesh mesh); // Load model from generated mesh (default material)
RLAPI void UnloadModel(Model model); // Unload model from memory (RAM and/or VRAM)
// Mesh loading/unloading functions
@@ -1328,7 +1312,7 @@ RLAPI Shader GetShaderDefault(void); // Get
RLAPI Texture2D GetTextureDefault(void); // Get default texture
// Shader configuration functions
-RLAPI int GetShaderLocation(Shader shader, const char *uniformName); // Get shader uniform location
+RLAPI int GetShaderLocation(Shader shader, const char *uniformName); // Get shader uniform location
RLAPI void SetShaderValue(Shader shader, int uniformLoc, const void *value, int uniformType); // Set shader uniform value
RLAPI void SetShaderValueV(Shader shader, int uniformLoc, const void *value, int uniformType, int count); // Set shader uniform value vector
RLAPI void SetShaderValueMatrix(Shader shader, int uniformLoc, Matrix mat); // Set shader uniform value (matrix 4x4)
@@ -1342,7 +1326,7 @@ RLAPI Matrix GetMatrixModelview(); // Get
RLAPI Texture2D GenTextureCubemap(Shader shader, Texture2D skyHDR, int size); // Generate cubemap texture from HDR texture
RLAPI Texture2D GenTextureIrradiance(Shader shader, Texture2D cubemap, int size); // Generate irradiance texture using cubemap data
RLAPI Texture2D GenTexturePrefilter(Shader shader, Texture2D cubemap, int size); // Generate prefilter texture using cubemap data
-RLAPI Texture2D GenTextureBRDF(Shader shader, int size); // Generate BRDF texture using cubemap data
+RLAPI Texture2D GenTextureBRDF(Shader shader, int size); // Generate BRDF texture
// Shading begin/end functions
RLAPI void BeginShaderMode(Shader shader); // Begin custom shader drawing
@@ -1353,10 +1337,10 @@ RLAPI void BeginScissorMode(int x, int y, int width, int height); // Beg
RLAPI void EndScissorMode(void); // End scissor mode
// VR control functions
-RLAPI VrDeviceInfo GetVrDeviceInfo(int vrDeviceType); // Get VR device information for some standard devices
-RLAPI void InitVrSimulator(VrDeviceInfo info); // Init VR simulator for selected device parameters
-RLAPI void UpdateVrTracking(Camera *camera); // Update VR tracking (position and orientation) and camera
+RLAPI void InitVrSimulator(void); // Init VR simulator for selected device parameters
RLAPI void CloseVrSimulator(void); // Close VR simulator for current device
+RLAPI void UpdateVrTracking(Camera *camera); // Update VR tracking (position and orientation) and camera
+RLAPI void SetVrConfiguration(VrDeviceInfo info, Shader distortion); // Set stereo rendering configuration parameters
RLAPI bool IsVrSimulatorReady(void); // Detect if VR simulator is ready
RLAPI void ToggleVrMode(void); // Enable/Disable VR experience
RLAPI void BeginVrDrawing(void); // Begin VR simulator stereo rendering