From 9bf411f5805e246c790beb0556a6912f6ca33452 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Tue, 6 Oct 2015 17:30:03 +0200 Subject: Added a bunch of image manipulation functions: Renamed functions (for coherence with new ones): - ImageConvertToPOT() -> ImageToPOT() - ImageConvertFormat() -> ImageFormat() New functions added (IN PROGRESS): - ImageCopy() - ImageCrop() - ImageResize() (Uses stb_image_resize.h) - ImageDraw() - ImageDrawText() - ImageDrawTextEx() - ImageFlipVertical() - ImageFlipHorizontal() - ImageColorInvert() - ImageColorGrayscale() - ImageColorContrast() - ImageColorBrightness() --- src/raylib.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index b14ae082..74e6208f 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -547,8 +547,20 @@ void UnloadImage(Image image); void UnloadTexture(Texture2D texture); // Unload texture from GPU memory Color *GetImageData(Image image); // Get pixel data from image as a Color struct array Image GetTextureData(Texture2D texture); // Get pixel data from GPU texture and return an Image -void ImageConvertToPOT(Image *image, Color fillColor); // Convert image to POT (power-of-two) -void ImageConvertFormat(Image *image, int newFormat); // Convert image data to desired format +void ImageToPOT(Image *image, Color fillColor); // Convert image to POT (power-of-two) +void ImageFormat(Image *image, int newFormat); // Convert image data to desired format +Image ImageCopy(Image image); // Create an image duplicate (useful for transformations) +void ImageCrop(Image *image, Rectangle crop); // Crop an image to a defined rectangle +void ImageResize(Image *image, int newWidth, int newHeight); // Resize and image (bilinear filtering) +void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec); // Draw a source image within a destination image +void ImageDrawText(Image *dst, const char *text, Vector2 position, int size, Color color); // Draw text within an image +void ImageDrawTextEx(Image *dst, SpriteFont font, const char *text, Vector2 position, int size, Color color); +void ImageFlipVertical(Image *image); +void ImageFlipHorizontal(Image *image); +void ImageColorInvert(Image *image); +void ImageColorGrayscale(Image *image); +void ImageColorContrast(Image *image, float contrast); +void ImageColorBrightness(Image *image, int brightness); void GenTextureMipmaps(Texture2D texture); // Generate GPU mipmaps for a texture void DrawTexture(Texture2D texture, int posX, int posY, Color tint); // Draw a Texture2D -- cgit v1.2.3 From afdf357fbee7f01535bddefb4e62cb1308ed55b5 Mon Sep 17 00:00:00 2001 From: Ray Date: Sun, 25 Oct 2015 01:50:15 +0200 Subject: Added some image manipulation functions Added (or completed functions): Image ImageText(const char *text, int fontSize, Color color); Image ImageTextEx(SpriteFont font, const char *text, int fontSize, int spacing, Color tint); void ImageFlipVertical(Image *image); void ImageFlipHorizontal(Image *image); void ImageColorTint(Image *image, Color color); void ImageColorInvert(Image *image); void ImageColorGrayscale(Image *image); void ImageColorContrast(Image *image, float contrast); void ImageColorBrightness(Image *image, int brightness); --- src/raylib.h | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index 74e6208f..9067c77d 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -547,20 +547,21 @@ void UnloadImage(Image image); void UnloadTexture(Texture2D texture); // Unload texture from GPU memory Color *GetImageData(Image image); // Get pixel data from image as a Color struct array Image GetTextureData(Texture2D texture); // Get pixel data from GPU texture and return an Image -void ImageToPOT(Image *image, Color fillColor); // Convert image to POT (power-of-two) -void ImageFormat(Image *image, int newFormat); // Convert image data to desired format +void ImageToPOT(Image *image, Color fillColor); // Convert image to POT (power-of-two) +void ImageFormat(Image *image, int newFormat); // Convert image data to desired format Image ImageCopy(Image image); // Create an image duplicate (useful for transformations) void ImageCrop(Image *image, Rectangle crop); // Crop an image to a defined rectangle void ImageResize(Image *image, int newWidth, int newHeight); // Resize and image (bilinear filtering) void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec); // Draw a source image within a destination image -void ImageDrawText(Image *dst, const char *text, Vector2 position, int size, Color color); // Draw text within an image -void ImageDrawTextEx(Image *dst, SpriteFont font, const char *text, Vector2 position, int size, Color color); -void ImageFlipVertical(Image *image); -void ImageFlipHorizontal(Image *image); -void ImageColorInvert(Image *image); -void ImageColorGrayscale(Image *image); -void ImageColorContrast(Image *image, float contrast); -void ImageColorBrightness(Image *image, int brightness); +Image ImageText(const char *text, int fontSize, Color color); // Create an image from text (default font) +Image ImageTextEx(SpriteFont font, const char *text, int fontSize, int spacing, Color tint); // Create an image from text (custom sprite font) +void ImageFlipVertical(Image *image); // Flip image vertically +void ImageFlipHorizontal(Image *image); // Flip image horizontally +void ImageColorTint(Image *image, Color color); // Modify image color: tint +void ImageColorInvert(Image *image); // Modify image color: invert +void ImageColorGrayscale(Image *image); // Modify bimage color: grayscale +void ImageColorContrast(Image *image, float contrast); // Modify image color: contrast (-100 to 100) +void ImageColorBrightness(Image *image, int brightness); // Modify image color: brightness (-255 to 255) void GenTextureMipmaps(Texture2D texture); // Generate GPU mipmaps for a texture void DrawTexture(Texture2D texture, int posX, int posY, Color tint); // Draw a Texture2D -- cgit v1.2.3 From 932396922db13b0c118a0b493d4e34b0f6db3b97 Mon Sep 17 00:00:00 2001 From: Joshua Reisenauer Date: Mon, 26 Oct 2015 00:21:52 -0700 Subject: Added Alpha Numeric Mapping For Develop Branch GLFW mappings. --- src/raylib.h | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index 9067c77d..15642256 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -117,6 +117,44 @@ #define KEY_RIGHT_CONTROL 345 #define KEY_RIGHT_ALT 346 +// Keyboard Alhpa Numeric Keys +#define KEY_ZERO 48 +#define KEY_ONE 49 +#define KEY_TWO 50 +#define KEY_THREE 51 +#define KEY_FOUR 52 +#define KEY_FIVE 53 +#define KEY_SIX 54 +#define KEY_SEVEN 55 +#define KEY_EIGHT 56 +#define KEY_NINE 57 +#define KEY_A 65 +#define KEY_B 66 +#define KEY_C 67 +#define KEY_D 68 +#define KEY_E 69 +#define KEY_F 70 +#define KEY_G 71 +#define KEY_H 72 +#define KEY_I 73 +#define KEY_J 74 +#define KEY_K 75 +#define KEY_L 76 +#define KEY_M 77 +#define KEY_N 78 +#define KEY_O 79 +#define KEY_P 80 +#define KEY_Q 81 +#define KEY_R 82 +#define KEY_S 83 +#define KEY_T 84 +#define KEY_U 85 +#define KEY_V 86 +#define KEY_W 87 +#define KEY_X 88 +#define KEY_Y 89 +#define KEY_Z 90 + // Mouse Buttons #define MOUSE_LEFT_BUTTON 0 #define MOUSE_RIGHT_BUTTON 1 -- cgit v1.2.3 From 580c0a72966b0dbc6eae26e8b01657e732ec266a Mon Sep 17 00:00:00 2001 From: Ray Date: Fri, 30 Oct 2015 11:30:32 +0100 Subject: Moved gestures touch functionality back to core Required gestures module when compiling for Android and Web --- src/raylib.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index 9067c77d..d3729a91 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -458,13 +458,14 @@ bool IsGamepadButtonUp(int gamepad, int button); // Detect if a gamepad b #endif #if defined(PLATFORM_ANDROID) || defined(PLATFORM_WEB) -//------------------------------------------------------------------------------------ -// Gestures and Touch Handling Functions (Module: gestures) -//------------------------------------------------------------------------------------ int GetTouchX(void); // Returns touch position X (relative to screen size) int GetTouchY(void); // Returns touch position Y (relative to screen size) Vector2 GetTouchPosition(void); // Returns touch position XY (relative to screen size) +//------------------------------------------------------------------------------------ +// Gestures and Touch Handling Functions (Module: gestures) +//------------------------------------------------------------------------------------ +Vector2 GetRawTouchPosition(void); // Gewt touch position (raw) #if defined(PLATFORM_WEB) void InitGesturesSystem(void); // Init gestures system (web) #elif defined(PLATFORM_ANDROID) -- cgit v1.2.3 From 76024b5036f060a19a1a2eea49c401d6db81cda8 Mon Sep 17 00:00:00 2001 From: Ray Date: Wed, 4 Nov 2015 18:33:46 +0100 Subject: Added some texture functionality (view details) LoadTextureEx() - Simplified parameters UpdateTexture() - Added, allows updating GPU texture data --- src/raylib.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index 419989d0..0b07e523 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -579,7 +579,7 @@ Image LoadImageEx(Color *pixels, int width, int height); Image LoadImageRaw(const char *fileName, int width, int height, int format, int headerSize); // Load image data from RAW file Image LoadImageFromRES(const char *rresName, int resId); // Load an image from rRES file (raylib Resource) Texture2D LoadTexture(const char *fileName); // Load an image as texture into GPU memory -Texture2D LoadTextureEx(void *data, int width, int height, int textureFormat, int mipmapCount); // Load a texture from raw data into GPU memory +Texture2D LoadTextureEx(void *data, int width, int height, int textureFormat); // Load a texture from raw data into GPU memory Texture2D LoadTextureFromRES(const char *rresName, int resId); // Load an image as texture from rRES file (raylib Resource) Texture2D LoadTextureFromImage(Image image); // Load a texture from image data void UnloadImage(Image image); // Unload image from CPU memory (RAM) @@ -602,6 +602,7 @@ void ImageColorGrayscale(Image *image); void ImageColorContrast(Image *image, float contrast); // Modify image color: contrast (-100 to 100) void ImageColorBrightness(Image *image, int brightness); // Modify image color: brightness (-255 to 255) void GenTextureMipmaps(Texture2D texture); // Generate GPU mipmaps for a texture +void UpdateTexture(Texture2D texture, void *pixels); // Update GPU texture with new data void DrawTexture(Texture2D texture, int posX, int posY, Color tint); // Draw a Texture2D void DrawTextureV(Texture2D texture, Vector2 position, Color tint); // Draw a Texture2D with position defined as Vector2 -- cgit v1.2.3 From c17c1ccaea53a9591ddc0e57fb55644904e0d49e Mon Sep 17 00:00:00 2001 From: Ray Date: Thu, 5 Nov 2015 13:42:18 +0100 Subject: Corrected html5 glfw3 bug Mouse button values are inverted! --- src/raylib.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index 0b07e523..d8655451 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -157,8 +157,13 @@ // Mouse Buttons #define MOUSE_LEFT_BUTTON 0 -#define MOUSE_RIGHT_BUTTON 1 -#define MOUSE_MIDDLE_BUTTON 2 +#if defined(PLATFORM_WEB) + #define MOUSE_RIGHT_BUTTON 2 + #define MOUSE_MIDDLE_BUTTON 1 +#else + #define MOUSE_RIGHT_BUTTON 1 + #define MOUSE_MIDDLE_BUTTON 2 +#endif // Gamepad Number #define GAMEPAD_PLAYER1 0 -- cgit v1.2.3 From 1b39b2e2612dfd7613e3bfb6948e8d27472ab8c1 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Mon, 14 Dec 2015 23:30:27 +0100 Subject: Added BeginDrawingEx() BeginDrawing() function with extended parameters --- src/raylib.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index d8655451..daf8133c 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -442,6 +442,7 @@ int GetScreenHeight(void); // Get current scree void ClearBackground(Color color); // Sets Background Color void BeginDrawing(void); // Setup drawing canvas to start drawing +void BeginDrawingEx(int blendMode, Shader shader, Matrix transform); // Setup drawing canvas with extended parameters void EndDrawing(void); // End canvas drawing and Swap Buffers (Double Buffering) void Begin3dMode(Camera cam); // Initializes 3D mode for drawing (Camera setup) @@ -508,7 +509,7 @@ Vector2 GetTouchPosition(void); // Returns touch positio //------------------------------------------------------------------------------------ // Gestures and Touch Handling Functions (Module: gestures) //------------------------------------------------------------------------------------ -Vector2 GetRawTouchPosition(void); // Gewt touch position (raw) +Vector2 GetRawTouchPosition(void); // Get touch position (raw) #if defined(PLATFORM_WEB) void InitGesturesSystem(void); // Init gestures system (web) #elif defined(PLATFORM_ANDROID) -- cgit v1.2.3 From 4db2da91850fcc55ec08df253e533e236eb91451 Mon Sep 17 00:00:00 2001 From: victorfisac Date: Mon, 21 Dec 2015 16:42:13 +0100 Subject: Added new matrix location points and extra functions - New model and view transformation matrix added, useful for shaders. Modelview matrix not deleted to keep opengl 1.1 pipeline compatibility. - New extra function added DrawModelWiresEx() to set a rotation and scale transformations to a wire model drawing. - Other writing and little audio.c bug fixed. --- src/raylib.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index daf8133c..cf401cca 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -329,7 +329,9 @@ typedef struct Shader { // Uniforms int projectionLoc; // Projection matrix uniform location point (vertex shader) - int modelviewLoc; // ModeView matrix uniform location point (vertex shader) + int modelviewLoc; // ModelView matrix uniform location point (vertex shader) + int modelLoc; // Model transformation matrix uniform location point (vertex shader) + int viewLoc; // View transformation matrix uniform location point (vertex shader) int tintColorLoc; // Color uniform location point (fragment shader) int mapDiffuseLoc; // Diffuse map texture uniform location point (fragment shader) @@ -666,6 +668,7 @@ void SetModelTexture(Model *model, Texture2D texture); void DrawModel(Model model, Vector3 position, float scale, Color tint); // Draw a model (with texture if set) void DrawModelEx(Model model, Vector3 position, float rotationAngle, Vector3 rotationAxis, Vector3 scale, Color tint); // Draw a model with extended parameters void DrawModelWires(Model model, Vector3 position, float scale, Color color); // Draw a model wires (with texture if set) +void DrawModelWiresEx(Model model, Vector3 position, float rotationAngle, Vector3 rotationAxis, Vector3 scale, Color tint); // Draw a model wires (with texture if set) with extended parameters void DrawBillboard(Camera camera, Texture2D texture, Vector3 center, float size, Color tint); // Draw a billboard texture void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle sourceRec, Vector3 center, float size, Color tint); // Draw a billboard texture defined by sourceRec -- cgit v1.2.3 From 1bcb5ddd505e5c4bdac6f254e931e9c3145be88d Mon Sep 17 00:00:00 2001 From: victorfisac Date: Mon, 21 Dec 2015 17:25:22 +0100 Subject: Added lighting engine module - New lighting engine module which contains new data types Light and Material. These data types and functions facilitates making a basic 3D iluminated program with a light and a model. - Added lighting engine module example (currently included in raylib.h; it might be compiled by separate and include lighting.h in game source C file). - Corrected some opengl defines control structures and added some TODO to fix raylib-opengl 1.1 source build (note: now source can be compiled without errors, but rlglReadPixels() won't work properly). Note: most of functions of phong version 330 shader are not in v100 shaders, so I couldn't write a version 100 phong shader. These functions are included from version 150. --- src/raylib.h | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index cf401cca..04ece42e 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -368,6 +368,26 @@ typedef struct Wave { short channels; } Wave; +// Light type +typedef struct Light { + float position[3]; + float rotation[3]; + float intensity[1]; + float ambientColor[3]; + float diffuseColor[3]; + float specularColor[3]; + float specularIntensity[1]; +} Light; + +// Material type +typedef struct Material { + float ambientColor[3]; + float diffuseColor[3]; + float specularColor[3]; + float glossiness[1]; + float normalDepth[1]; +} Material; + // Texture formats // NOTE: Support depends on OpenGL version and platform typedef enum { @@ -702,6 +722,26 @@ void SetShaderMap(Shader *shader, int mapLocation, Texture2D texture, int textur void SetBlendMode(int mode); // Set blending mode (alpha, additive, multiplied) +//---------------------------------------------------------------------------------- +// Lighting System Functions (engine-module: lighting) +// NOTE: light and material structs uses float pointers instead of vectors to be compatible with SetShaderValue() +//---------------------------------------------------------------------------------- +// Lights functions +void SetLightPosition(Light *light, Vector3 position); // Set light position converting position vector to float pointer +void SetLightRotation(Light *light, Vector3 rotation); // Set light rotation converting rotation vector to float pointer +void SetLightIntensity(Light *light, float intensity); // Set light intensity value +void SetLightAmbientColor(Light *light, Vector3 color); // Set light ambient color value (it will be multiplied by material ambient color) +void SetLightDiffuseColor(Light *light, Vector3 color); // Set light diffuse color (light color) +void SetLightSpecularColor(Light *light, Vector3 color); // Set light specular color (it will be multiplied by material specular color) +void SetLightSpecIntensity(Light *light, float specIntensity); // Set light specular intensity (specular color scalar multiplier) + +// Materials functions +void SetMaterialAmbientColor(Material *material, Vector3 color); // Set material ambient color value (it will be multiplied by light ambient color) +void SetMaterialDiffuseColor(Material *material, Vector3 color); // Set material diffuse color (material color, should use DrawModel() tint parameter) +void SetMaterialSpecularColor(Material *material, Vector3 color); // Set material specular color (it will be multiplied by light specular color) +void SetMaterialGlossiness(Material *material, float glossiness); // Set material glossiness value (recommended values: 0 - 100) +void SetMaterialNormalDepth(Material *material, float depth); // Set normal map depth (B component from RGB type map scalar multiplier) + //------------------------------------------------------------------------------------ // Audio Loading and Playing Functions (Module: audio) //------------------------------------------------------------------------------------ -- cgit v1.2.3 From e683fe88b9ab0fde76521a0367cdff4c229ac60c Mon Sep 17 00:00:00 2001 From: victorfisac Date: Mon, 21 Dec 2015 21:12:35 +0100 Subject: Added physics engine-module and example - Added new physics engine-module with four new data types: Physics, Transform, Rigidbody and Collider. This library contains functions to apply physics calculations to a position vector calculating collisions automatically. - Fixed some writing mistakes of lighting module. --- src/raylib.h | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index 04ece42e..4eefa3ea 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -433,6 +433,44 @@ typedef enum { // Camera system modes typedef enum { CAMERA_CUSTOM = 0, CAMERA_FREE, CAMERA_ORBITAL, CAMERA_FIRST_PERSON, CAMERA_THIRD_PERSON } CameraMode; +// Collider types +typedef enum { RectangleCollider, CircleCollider } ColliderType; + +// Physics struct +typedef struct Physics { + bool enabled; + bool debug; // Should be used by programmer for testing purposes + Vector2 gravity; +} Physics; + +// Transform struct +typedef struct Transform { + Vector2 position; + float rotation; + Vector2 scale; +} Transform; + +// Rigidbody struct +typedef struct Rigidbody { + bool enabled; + float mass; + Vector2 acceleration; + Vector2 velocity; + bool isGrounded; + bool isContact; // Avoid freeze player when touching floor + bool applyGravity; + float friction; // 0.0f to 1.0f + float bounciness; // 0.0f to 1.0f +} Rigidbody; + +// Collider struct +typedef struct Collider { + bool enabled; + ColliderType type; + Rectangle bounds; // Just used for RectangleCollider type + int radius; // Just used for CircleCollider type +} Collider; + #ifdef __cplusplus extern "C" { // Prevents name mangling of functions #endif @@ -742,6 +780,25 @@ void SetMaterialSpecularColor(Material *material, Vector3 color); // Set m void SetMaterialGlossiness(Material *material, float glossiness); // Set material glossiness value (recommended values: 0 - 100) void SetMaterialNormalDepth(Material *material, float depth); // Set normal map depth (B component from RGB type map scalar multiplier) +//---------------------------------------------------------------------------------- +// Physics System Functions (engine-module: physics) +//---------------------------------------------------------------------------------- +void InitPhysics(); // Initialize all internal physics values +void SetPhysics(Physics settings); // Set physics settings values using Physics data type to overwrite internal physics settings + +void AddRigidbody(int index, Rigidbody rigidbody); // Initialize a new rigidbody with parameters to internal index slot +void AddCollider(int index, Collider collider); // Initialize a new Collider with parameters to internal index slot + +void ApplyPhysics(int index, Vector2 *position); // Apply physics to internal rigidbody, physics calculations are applied to position pointer parameter +void SetRigidbodyEnabled(int index, bool state); // Set enabled state to a defined rigidbody +void SetRigidbodyVelocity(int index, Vector2 velocity); // Set velocity of rigidbody (without considering of mass value) +void AddRigidbodyForce(int index, Vector2 force); // Set rigidbody force (considering mass value) + +void SetColliderEnabled(int index, bool state); // Set enabled state to a defined collider + +Rigidbody GetRigidbody(int index); // Returns the internal rigidbody data defined by index parameter +Collider GetCollider(int index); // Returns the internal collider data defined by index parameter + //------------------------------------------------------------------------------------ // Audio Loading and Playing Functions (Module: audio) //------------------------------------------------------------------------------------ -- cgit v1.2.3 From 5dbb93dbb476c35d8f8aab24d9c3507640b171e8 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Wed, 30 Dec 2015 13:32:41 +0100 Subject: Added function: ImageDither() Corrected some code details --- src/raylib.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index 4eefa3ea..785ebebb 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -654,6 +654,7 @@ Color *GetImageData(Image image); Image GetTextureData(Texture2D texture); // Get pixel data from GPU texture and return an Image void ImageToPOT(Image *image, Color fillColor); // Convert image to POT (power-of-two) void ImageFormat(Image *image, int newFormat); // Convert image data to desired format +void ImageDither(Image *image, int rBpp, int gBpp, int bBpp, int aBpp); // Dither image data to 16bpp or lower (Floyd-Steinberg dithering) Image ImageCopy(Image image); // Create an image duplicate (useful for transformations) void ImageCrop(Image *image, Rectangle crop); // Crop an image to a defined rectangle void ImageResize(Image *image, int newWidth, int newHeight); // Resize and image (bilinear filtering) @@ -692,6 +693,7 @@ Vector2 MeasureTextEx(SpriteFont spriteFont, const char *text, int fontSize, int void DrawFPS(int posX, int posY); // Shows current FPS on top-left corner const char *FormatText(const char *text, ...); // Formatting of text with variables to 'embed' +const char *SubText(const char *text, int position, int length); // Get a piece of a text string //------------------------------------------------------------------------------------ // Basic 3d Shapes Drawing Functions (Module: models) -- cgit v1.2.3 From fa057f512f6bcfb84a7f736d10c45da50793c8d9 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Sat, 2 Jan 2016 10:45:51 +0100 Subject: Improved fonts support Added LoadBMFont() to load AngelCode fonts (.fnt) Implemented LoadTTF() to load .ttf fonts (crappy packaging) --- src/raylib.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index 785ebebb..1113958d 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -1,6 +1,6 @@ /********************************************************************************************** * -* raylib 1.3.0 (www.raylib.com) +* raylib 1.4.0 (www.raylib.com) * * A simple and easy-to-use library to learn videogames programming * @@ -291,6 +291,8 @@ typedef struct SpriteFont { int numChars; // Number of characters int *charValues; // Characters values array Rectangle *charRecs; // Characters rectangles within the texture + Vector2 *charOffsets; // Characters offsets (on drawing) + int *charAdvanceX; // Characters x advance (on drawing) } SpriteFont; // Camera type, defines a camera position/orientation in 3d space -- cgit v1.2.3 From d32feaa6685584e9856aa94f4d5bf80b7f5b861c Mon Sep 17 00:00:00 2001 From: raysan5 Date: Sun, 3 Jan 2016 13:01:21 +0100 Subject: Reviewed Android inputs and gestures system Corrected Android processing for some inputs (BACK button, VOLUME buttons) Redesigned Gestures system (some work still required) SetEnabledGestures() - Only support desired gestures (requires some review) --- src/raylib.h | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index 1113958d..864a240a 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -70,7 +70,7 @@ #endif #if defined(PLATFORM_ANDROID) - #include // Defines android_app struct + typedef struct android_app; // Define android_app struct (android_native_app_glue.h) #endif //---------------------------------------------------------------------------------- @@ -432,6 +432,17 @@ typedef enum { GESTURE_PINCH_OUT = 1024 } Gestures; +typedef enum { TOUCH_UP, TOUCH_DOWN, TOUCH_MOVE } TouchAction; + +// Gesture events +// NOTE: MAX_TOUCH_POINTS fixed to 4 +typedef struct { + int touchAction; + int pointCount; + int pointerId[4]; + Vector2 position[4]; +} GestureEvent; + // Camera system modes typedef enum { CAMERA_CUSTOM = 0, CAMERA_FREE, CAMERA_ORBITAL, CAMERA_FIRST_PERSON, CAMERA_THIRD_PERSON } CameraMode; @@ -571,16 +582,11 @@ Vector2 GetTouchPosition(void); // Returns touch positio //------------------------------------------------------------------------------------ // Gestures and Touch Handling Functions (Module: gestures) //------------------------------------------------------------------------------------ -Vector2 GetRawTouchPosition(void); // Get touch position (raw) -#if defined(PLATFORM_WEB) -void InitGesturesSystem(void); // Init gestures system (web) -#elif defined(PLATFORM_ANDROID) -void InitGesturesSystem(struct android_app *app); // Init gestures system (android) -#endif void UpdateGestures(void); // Update gestures detected (must be called every frame) bool IsGestureDetected(void); // Check if a gesture have been detected int GetGestureType(void); // Get latest detected gesture void SetGesturesEnabled(unsigned int gestureFlags); // Enable a set of gestures using flags +void ProcessGestureEvent(GestureEvent event); // Process gesture event and translate it into gestures float GetGestureDragIntensity(void); // Get gesture drag intensity float GetGestureDragAngle(void); // Get gesture drag angle -- cgit v1.2.3 From a299bc289b36a40efcf9d02597d5122546458021 Mon Sep 17 00:00:00 2001 From: victorfisac Date: Sun, 3 Jan 2016 17:53:29 +0100 Subject: Improved and added functions to physac engine module - Improved physics calculations. - Added AddForceAtPosition function (added to all enabled rigidbodies). - Updated raylib header. --- src/raylib.h | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index 864a240a..99a6979c 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -793,21 +793,23 @@ void SetMaterialNormalDepth(Material *material, float depth); // Set n //---------------------------------------------------------------------------------- // Physics System Functions (engine-module: physics) //---------------------------------------------------------------------------------- -void InitPhysics(); // Initialize all internal physics values -void SetPhysics(Physics settings); // Set physics settings values using Physics data type to overwrite internal physics settings +void InitPhysics(); // Initialize all internal physics values +void SetPhysics(Physics settings); // Set physics settings values using Physics data type to overwrite internal physics settings -void AddRigidbody(int index, Rigidbody rigidbody); // Initialize a new rigidbody with parameters to internal index slot -void AddCollider(int index, Collider collider); // Initialize a new Collider with parameters to internal index slot +void AddRigidbody(int index, Rigidbody rigidbody); // Initialize a new rigidbody with parameters to internal index slot +void AddCollider(int index, Collider collider); // Initialize a new Collider with parameters to internal index slot -void ApplyPhysics(int index, Vector2 *position); // Apply physics to internal rigidbody, physics calculations are applied to position pointer parameter -void SetRigidbodyEnabled(int index, bool state); // Set enabled state to a defined rigidbody -void SetRigidbodyVelocity(int index, Vector2 velocity); // Set velocity of rigidbody (without considering of mass value) -void AddRigidbodyForce(int index, Vector2 force); // Set rigidbody force (considering mass value) +void ApplyPhysics(int index, Vector2 *position); // Apply physics to internal rigidbody, physics calculations are applied to position pointer parameter +void SetRigidbodyEnabled(int index, bool state); // Set enabled state to a defined rigidbody +void SetRigidbodyVelocity(int index, Vector2 velocity); // Set velocity of rigidbody (without considering of mass value) +void SetRigidbodyAcceleration(int index, Vector2 acceleration); // Set acceleration of rigidbody (without considering of mass value) +void AddRigidbodyForce(int index, Vector2 force); // Set rigidbody force (considering mass value) +void AddForceAtPosition(Vector2 position, float intensity, float radius); // Add a force to all enabled rigidbodies at a position -void SetColliderEnabled(int index, bool state); // Set enabled state to a defined collider +void SetColliderEnabled(int index, bool state); // Set enabled state to a defined collider -Rigidbody GetRigidbody(int index); // Returns the internal rigidbody data defined by index parameter -Collider GetCollider(int index); // Returns the internal collider data defined by index parameter +Rigidbody GetRigidbody(int index); // Returns the internal rigidbody data defined by index parameter +Collider GetCollider(int index); // Returns the internal collider data defined by index parameter //------------------------------------------------------------------------------------ // Audio Loading and Playing Functions (Module: audio) -- cgit v1.2.3 From 70d405b41bcbbd73b9f752f4dc3910100abd1a36 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Mon, 4 Jan 2016 15:12:34 +0100 Subject: Added functionality: Storage values Two new functions added to save/load values as binary data: - StorageSaveValue() - StorageLoadValue() --- src/raylib.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index 99a6979c..f1203537 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -540,6 +540,9 @@ bool IsFileDropped(void); // Check if a file h char **GetDroppedFiles(int *count); // Retrieve dropped files into window void ClearDroppedFiles(void); // Clear dropped files paths buffer +void StorageSaveValue(int position, int value); // Storage save integer value (to defined position) +int StorageLoadValue(int position); // Storage load integer value (from defined position) + //------------------------------------------------------------------------------------ // Input Handling Functions (Module: core) //------------------------------------------------------------------------------------ -- cgit v1.2.3 From ea500923565f66326e0ace470184374f158781d8 Mon Sep 17 00:00:00 2001 From: victorfisac Date: Mon, 4 Jan 2016 21:00:20 +0100 Subject: Add Android physic buttons input detection - Added functions for detect when pressed, during down and when released. - Added defines for back, menu, volume up and down button numbers. --- src/raylib.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index f1203537..641eac4b 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -186,6 +186,12 @@ // TODO: Review Xbox360 USB Controller Buttons +// Android Physic Buttons +#define ANDROID_BACK 4 +#define ANDROID_MENU 82 +#define ANDROID_VOLUME_UP 24 +#define ANDROID_VOLUME_DOWN 25 + // Some Basic Colors // NOTE: Custom raylib color palette for amazing visuals on WHITE background #define LIGHTGRAY (Color){ 200, 200, 200, 255 } // Light Gray @@ -581,6 +587,9 @@ bool IsGamepadButtonUp(int gamepad, int button); // Detect if a gamepad b int GetTouchX(void); // Returns touch position X (relative to screen size) int GetTouchY(void); // Returns touch position Y (relative to screen size) Vector2 GetTouchPosition(void); // Returns touch position XY (relative to screen size) +bool IsButtonPressed(int button); // Detect if an android physic button has been pressed +bool IsButtonDown(int button); // Detect if an android physic button is being pressed +bool IsButtonReleased(int button); // Detect if an android physic button has been released //------------------------------------------------------------------------------------ // Gestures and Touch Handling Functions (Module: gestures) -- cgit v1.2.3 From fe0cf8f9a9d6cafa40a1baf8b3cdace0268ccb82 Mon Sep 17 00:00:00 2001 From: victorfisac Date: Tue, 5 Jan 2016 13:58:20 +0100 Subject: Added some comments and fixed spaces --- src/raylib.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index 641eac4b..72211b59 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -589,7 +589,7 @@ int GetTouchY(void); // Returns touch positio Vector2 GetTouchPosition(void); // Returns touch position XY (relative to screen size) bool IsButtonPressed(int button); // Detect if an android physic button has been pressed bool IsButtonDown(int button); // Detect if an android physic button is being pressed -bool IsButtonReleased(int button); // Detect if an android physic button has been released +bool IsButtonReleased(int button); // Detect if an android physic button has been released //------------------------------------------------------------------------------------ // Gestures and Touch Handling Functions (Module: gestures) @@ -805,7 +805,7 @@ void SetMaterialNormalDepth(Material *material, float depth); // Set n //---------------------------------------------------------------------------------- // Physics System Functions (engine-module: physics) //---------------------------------------------------------------------------------- -void InitPhysics(); // Initialize all internal physics values +void InitPhysics(void); // Initialize all internal physics values void SetPhysics(Physics settings); // Set physics settings values using Physics data type to overwrite internal physics settings void AddRigidbody(int index, Rigidbody rigidbody); // Initialize a new rigidbody with parameters to internal index slot -- cgit v1.2.3 From 1793f2c3b87f1ed487216e23f3074085753ee346 Mon Sep 17 00:00:00 2001 From: victorfisac Date: Thu, 7 Jan 2016 16:18:24 +0100 Subject: Added collision check between ray and box - Added CheckCollisionRayBox() function. - Updated and improved core 3d picking example (currently working as expected). --- src/raylib.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index 72211b59..b6900a97 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -756,6 +756,7 @@ void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle sourceRec, Vec bool CheckCollisionSpheres(Vector3 centerA, float radiusA, Vector3 centerB, float radiusB); // Detect collision between two spheres bool CheckCollisionBoxes(Vector3 minBBox1, Vector3 maxBBox1, Vector3 minBBox2, Vector3 maxBBox2); // Detect collision between two boxes bool CheckCollisionBoxSphere(Vector3 minBBox, Vector3 maxBBox, Vector3 centerSphere, float radiusSphere); // Detect collision between box and sphere +bool CheckCollisionRayBox(Ray ray, Vector3 minBBox, Vector3 maxBBox); // Detect collision between ray and box Vector3 ResolveCollisionCubicmap(Image cubicmap, Vector3 mapPosition, Vector3 *playerPosition, float radius); // Detect collision of player radius with cubicmap // NOTE: Return the normal vector of the impacted surface -- cgit v1.2.3 From 5e7686695fcfe32bbf956990ced0a02b7c881af1 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Mon, 11 Jan 2016 13:29:55 +0100 Subject: Review Light/Material system Simplified for the user (more intuitive and clear) Removed lighting module dependency --- src/raylib.h | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index b6900a97..4d8d104d 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -378,22 +378,22 @@ typedef struct Wave { // Light type typedef struct Light { - float position[3]; - float rotation[3]; - float intensity[1]; - float ambientColor[3]; - float diffuseColor[3]; - float specularColor[3]; - float specularIntensity[1]; + Vector3 position; + Vector3 direction; + float intensity; + float specIntensity; + Color diffuse; + Color ambient; + Color specular; } Light; // Material type typedef struct Material { - float ambientColor[3]; - float diffuseColor[3]; - float specularColor[3]; - float glossiness[1]; - float normalDepth[1]; + Color diffuse; + Color ambient; + Color specular; + float glossiness; + float normalDepth; } Material; // Texture formats @@ -535,6 +535,9 @@ float GetFrameTime(void); // Returns time in s Color GetColor(int hexValue); // Returns a Color struct from hexadecimal value int GetHexValue(Color color); // Returns hexadecimal value for a Color +float *ColorToFloat(Color color); // Converts Color to float array and normalizes +float *VectorToFloat(Vector3 vec); // Converts Vector3 to float array (defined in raymath module) +float *MatrixToVector(Matrix mat); // Converts Matrix to float array (defined in raymath module) int GetRandomValue(int min, int max); // Returns a random value between min and max (both included) Color Fade(Color color, float alpha); // Color fade-in or fade-out, alpha goes from 0.0f to 1.0f -- cgit v1.2.3 From 4cc394c376c83926da67afe14855d2a3e2b06cfd Mon Sep 17 00:00:00 2001 From: victorfisac Date: Mon, 11 Jan 2016 15:59:26 +0100 Subject: Added world to screen conversion - Added function WorldToScreen(...). - Added world to screen example. - Review GetMouseRay() comment. - Removed deprecated lighting functions from raylib header. --- src/raylib.h | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index 4d8d104d..d6b28e53 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -527,7 +527,8 @@ void EndDrawing(void); // End canvas drawin void Begin3dMode(Camera cam); // Initializes 3D mode for drawing (Camera setup) void End3dMode(void); // Ends 3D mode and returns to default 2D orthographic mode -Ray GetMouseRay(Vector2 mousePosition, Camera camera); // TODO: Returns a ray trace from mouse position +Ray GetMouseRay(Vector2 mousePosition, Camera camera); // Returns a ray trace from mouse position +Vector2 WorldToScreen(Vector3 position, Camera camera); // Returns the screen space position from a 3d world space position void SetTargetFPS(int fps); // Set target FPS (maximum) float GetFPS(void); // Returns current FPS @@ -786,26 +787,6 @@ void SetShaderMap(Shader *shader, int mapLocation, Texture2D texture, int textur void SetBlendMode(int mode); // Set blending mode (alpha, additive, multiplied) -//---------------------------------------------------------------------------------- -// Lighting System Functions (engine-module: lighting) -// NOTE: light and material structs uses float pointers instead of vectors to be compatible with SetShaderValue() -//---------------------------------------------------------------------------------- -// Lights functions -void SetLightPosition(Light *light, Vector3 position); // Set light position converting position vector to float pointer -void SetLightRotation(Light *light, Vector3 rotation); // Set light rotation converting rotation vector to float pointer -void SetLightIntensity(Light *light, float intensity); // Set light intensity value -void SetLightAmbientColor(Light *light, Vector3 color); // Set light ambient color value (it will be multiplied by material ambient color) -void SetLightDiffuseColor(Light *light, Vector3 color); // Set light diffuse color (light color) -void SetLightSpecularColor(Light *light, Vector3 color); // Set light specular color (it will be multiplied by material specular color) -void SetLightSpecIntensity(Light *light, float specIntensity); // Set light specular intensity (specular color scalar multiplier) - -// Materials functions -void SetMaterialAmbientColor(Material *material, Vector3 color); // Set material ambient color value (it will be multiplied by light ambient color) -void SetMaterialDiffuseColor(Material *material, Vector3 color); // Set material diffuse color (material color, should use DrawModel() tint parameter) -void SetMaterialSpecularColor(Material *material, Vector3 color); // Set material specular color (it will be multiplied by light specular color) -void SetMaterialGlossiness(Material *material, float glossiness); // Set material glossiness value (recommended values: 0 - 100) -void SetMaterialNormalDepth(Material *material, float depth); // Set normal map depth (B component from RGB type map scalar multiplier) - //---------------------------------------------------------------------------------- // Physics System Functions (engine-module: physics) //---------------------------------------------------------------------------------- -- cgit v1.2.3 From fb6ef2c2f4fe22552908d339cda541453e43faec Mon Sep 17 00:00:00 2001 From: raysan5 Date: Wed, 13 Jan 2016 17:13:28 +0100 Subject: Vertex shaders optimization --- src/raylib.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index d6b28e53..1a99f007 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -336,8 +336,8 @@ typedef struct Shader { int colorLoc; // Color attibute location point (vertex shader) // Uniforms - int projectionLoc; // Projection matrix uniform location point (vertex shader) - int modelviewLoc; // ModelView matrix uniform location point (vertex shader) + int mvpLoc; // ModelView-Projection matrix uniform location point (vertex shader) + int modelLoc; // Model transformation matrix uniform location point (vertex shader) int viewLoc; // View transformation matrix uniform location point (vertex shader) int tintColorLoc; // Color uniform location point (fragment shader) -- cgit v1.2.3 From fd05d3e3531964a38ea84df920264a1ed14bb777 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Mon, 18 Jan 2016 13:36:18 +0100 Subject: Rename VertexData struct to Mesh Reviewed vertex type variables --- src/raylib.h | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index 1a99f007..16311df8 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -308,17 +308,27 @@ typedef struct Camera { Vector3 up; } Camera; +// Bounding box type +typedef struct BoundingBox { + Vector3 min; + Vector3 max; +} BoundingBox; + // Vertex data definning a mesh -// NOTE: If using OpenGL 1.1, data loaded in CPU; if OpenGL 3.3+ data loaded in GPU (vaoId) -typedef struct VertexData { - int vertexCount; - float *vertices; // 3 components per vertex - float *texcoords; // 2 components per vertex - float *normals; // 3 components per vertex - unsigned char *colors; // 4 components per vertex - unsigned int vaoId; - unsigned int vboId[4]; -} VertexData; +typedef struct Mesh { + int vertexCount; // num vertices + float *vertices; // vertex position (XYZ - 3 components per vertex) + float *texcoords; // vertex texture coordinates (UV - 2 components per vertex) + float *texcoords2; // vertex second texture coordinates (useful for lightmaps) + float *normals; // vertex normals (XYZ - 3 components per vertex) + float *tangents; // vertex tangents (XYZ - 3 components per vertex) + unsigned char *colors; // vertex colors (RGBA - 4 components per vertex) + + BoundingBox bounds; // mesh limits defined by min and max points + + unsigned int vaoId; // OpenGL Vertex Array Object id + unsigned int vboId[6]; // OpenGL Vertex Buffer Objects id (6 types of vertex data) +} Mesh; // Shader type (generic shader) typedef struct Shader { @@ -349,7 +359,7 @@ typedef struct Shader { // 3d Model type typedef struct Model { - VertexData mesh; + Mesh mesh; Matrix transform; Texture2D texture; // Only for OpenGL 1.1, on newer versions this should be in the shader Shader shader; @@ -742,7 +752,7 @@ void DrawGizmo(Vector3 position); // Model 3d Loading and Drawing Functions (Module: models) //------------------------------------------------------------------------------------ Model LoadModel(const char *fileName); // Load a 3d model (.OBJ) -Model LoadModelEx(VertexData data); // Load a 3d model (from vertex data) +Model LoadModelEx(Mesh data); // Load a 3d model (from vertex data) //Model LoadModelFromRES(const char *rresName, int resId); // TODO: Load a 3d model from rRES file (raylib Resource) Model LoadHeightmap(Image heightmap, float maxHeight); // Load a heightmap image as a 3d model Model LoadCubicmap(Image cubicmap); // Load a map image as a 3d model (cubes based) -- cgit v1.2.3 From efa1c96d19095c801a01dbf9b0214a82b7ae8c11 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Wed, 20 Jan 2016 18:20:05 +0100 Subject: Adapted raymath as single header library Added support for single header implementation and also inline functions support --- src/raylib.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index 16311df8..0a768fe4 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -547,8 +547,8 @@ float GetFrameTime(void); // Returns time in s Color GetColor(int hexValue); // Returns a Color struct from hexadecimal value int GetHexValue(Color color); // Returns hexadecimal value for a Color float *ColorToFloat(Color color); // Converts Color to float array and normalizes -float *VectorToFloat(Vector3 vec); // Converts Vector3 to float array (defined in raymath module) -float *MatrixToVector(Matrix mat); // Converts Matrix to float array (defined in raymath module) +float *VectorToFloat(Vector3 vec); // Converts Vector3 to float array +float *MatrixToFloat(Matrix mat); // Converts Matrix to float array int GetRandomValue(int min, int max); // Returns a random value between min and max (both included) Color Fade(Color color, float alpha); // Color fade-in or fade-out, alpha goes from 0.0f to 1.0f -- cgit v1.2.3 From c5663ca015e550ab8e2a43c10fa72db0aab7cac8 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Wed, 20 Jan 2016 19:09:48 +0100 Subject: Some formatting tweaks --- src/raylib.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index 0a768fe4..5798d907 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -463,12 +463,12 @@ typedef struct { typedef enum { CAMERA_CUSTOM = 0, CAMERA_FREE, CAMERA_ORBITAL, CAMERA_FIRST_PERSON, CAMERA_THIRD_PERSON } CameraMode; // Collider types -typedef enum { RectangleCollider, CircleCollider } ColliderType; +typedef enum { COLLIDER_CIRCLE, COLLIDER_RECTANGLE, COLLIDER_CAPSULE } ColliderType; // Physics struct typedef struct Physics { bool enabled; - bool debug; // Should be used by programmer for testing purposes + bool debug; // Should be used by programmer for testing purposes Vector2 gravity; } Physics; @@ -496,8 +496,8 @@ typedef struct Rigidbody { typedef struct Collider { bool enabled; ColliderType type; - Rectangle bounds; // Just used for RectangleCollider type - int radius; // Just used for CircleCollider type + Rectangle bounds; // Used for COLLIDER_RECTANGLE and COLLIDER_CAPSULE + int radius; // Used for COLLIDER_CIRCLE and COLLIDER_CAPSULE } Collider; #ifdef __cplusplus -- cgit v1.2.3 From fcd30c5649f28d0d9c867712898fc5537f176c85 Mon Sep 17 00:00:00 2001 From: victorfisac Date: Wed, 20 Jan 2016 19:28:47 +0100 Subject: Added ray-sphere collision detection --- src/raylib.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index 5798d907..bebf4bc5 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -770,6 +770,8 @@ void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle sourceRec, Vec bool CheckCollisionSpheres(Vector3 centerA, float radiusA, Vector3 centerB, float radiusB); // Detect collision between two spheres bool CheckCollisionBoxes(Vector3 minBBox1, Vector3 maxBBox1, Vector3 minBBox2, Vector3 maxBBox2); // Detect collision between two boxes bool CheckCollisionBoxSphere(Vector3 minBBox, Vector3 maxBBox, Vector3 centerSphere, float radiusSphere); // Detect collision between box and sphere +bool CheckCollisionRaySphere(Ray ray, Vector3 spherePosition, float sphereRadius); // Detect collision between ray and sphere +bool CheckCollisionRaySphereEx(Ray ray, Vector3 spherePosition, float sphereRadius, Vector3 *collisionPoint); // Detect collision between ray and sphere with extended parameters and collision point detection bool CheckCollisionRayBox(Ray ray, Vector3 minBBox, Vector3 maxBBox); // Detect collision between ray and box Vector3 ResolveCollisionCubicmap(Image cubicmap, Vector3 mapPosition, Vector3 *playerPosition, float radius); // Detect collision of player radius with cubicmap // NOTE: Return the normal vector of the impacted surface -- cgit v1.2.3 From 6e9d3eb0f99c8ce00b769dbd03cc011216b97068 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Sat, 23 Jan 2016 12:37:42 +0100 Subject: Review comments --- src/raylib.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index bebf4bc5..49a320d4 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -7,10 +7,10 @@ * Features: * Library written in plain C code (C99) * Uses C# PascalCase/camelCase notation -* Hardware accelerated with OpenGL (1.1, 3.3+ or ES2) +* Hardware accelerated with OpenGL (1.1, 3.3 or ES2) * Unique OpenGL abstraction layer [rlgl] -* Powerful fonts module with SpriteFonts support -* Multiple textures support, including DDS and mipmaps generation +* Powerful fonts module with SpriteFonts support (including AngelCode fonts and TTF) +* Multiple textures support, including compressed formats and mipmaps generation * Basic 3d support for Shapes, Models, Heightmaps and Billboards * Powerful math module for Vector and Matrix operations [raymath] * Audio loading and playing with streaming support (WAV and OGG) @@ -18,20 +18,21 @@ * * Used external libs: * GLFW3 (www.glfw.org) for window/context management and input -* GLEW for OpenGL extensions loading (3.3+ and ES2) +* GLAD for OpenGL extensions loading (3.3 Core profile) * stb_image (Sean Barret) for images loading (JPEG, PNG, BMP, TGA, PSD, GIF, HDR, PIC) * stb_image_write (Sean Barret) for image writting (PNG) * stb_vorbis (Sean Barret) for ogg audio loading +* stb_truetype (Sean Barret) for ttf fonts loading * OpenAL Soft for audio device/context management * tinfl for data decompression (DEFLATE algorithm) * * Some design decisions: -* 32bit Colors - All defined color are always RGBA -* SpriteFonts - All loaded sprite-font images are converted to RGBA and POT textures +* 32bit Colors - All defined color are always RGBA (struct Color is 4 byte) * One custom default font is loaded automatically when InitWindow() -* If using OpenGL 3.3+ or ES2, one default shader is loaded automatically (internally defined) +* If using OpenGL 3.3 or ES2, several vertex buffers (VAO/VBO) are created to manage lines-triangles-quads +* If using OpenGL 3.3 or ES2, two default shaders are loaded automatically (internally defined) * -* -- LICENSE (raylib v1.2, September 2014) -- +* -- LICENSE -- * * raylib is licensed under an unmodified zlib/libpng license, which is an OSI-certified, * BSD-like license that allows static linking with closed source software: -- cgit v1.2.3 From 08da91047e8a2c593c3bc40b31c4796ae6cbb26d Mon Sep 17 00:00:00 2001 From: raysan5 Date: Sat, 23 Jan 2016 13:22:13 +0100 Subject: Some code tweaks --- src/raylib.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index 49a320d4..73200556 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -18,7 +18,7 @@ * * Used external libs: * GLFW3 (www.glfw.org) for window/context management and input -* GLAD for OpenGL extensions loading (3.3 Core profile) +* GLAD for OpenGL extensions loading (3.3 Core profile, only PLATFORM_DESKTOP) * stb_image (Sean Barret) for images loading (JPEG, PNG, BMP, TGA, PSD, GIF, HDR, PIC) * stb_image_write (Sean Barret) for image writting (PNG) * stb_vorbis (Sean Barret) for ogg audio loading -- cgit v1.2.3 From 41959eeae10d7d01fbd2abc19ccae4fc65aae031 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Sun, 24 Jan 2016 19:17:08 +0100 Subject: Added support for mouse gestures (need testing) Mouse input is interpreted as touches to allow mouse gestures detection... and get an unified inputs system for all platforms! --- src/raylib.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index 73200556..41fa3f7d 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -598,13 +598,15 @@ bool IsGamepadButtonReleased(int gamepad, int button); // Detect if a gamepad b bool IsGamepadButtonUp(int gamepad, int button); // Detect if a gamepad button is NOT being pressed #endif -#if defined(PLATFORM_ANDROID) || defined(PLATFORM_WEB) int GetTouchX(void); // Returns touch position X (relative to screen size) int GetTouchY(void); // Returns touch position Y (relative to screen size) Vector2 GetTouchPosition(void); // Returns touch position XY (relative to screen size) + +#if defined(PLATFORM_ANDROID) bool IsButtonPressed(int button); // Detect if an android physic button has been pressed bool IsButtonDown(int button); // Detect if an android physic button is being pressed bool IsButtonReleased(int button); // Detect if an android physic button has been released +#endif //------------------------------------------------------------------------------------ // Gestures and Touch Handling Functions (Module: gestures) @@ -621,7 +623,6 @@ Vector2 GetGestureDragVector(void); // Get gesture drag vect int GetGestureHoldDuration(void); // Get gesture hold time in frames float GetGesturePinchDelta(void); // Get gesture pinch delta float GetGesturePinchAngle(void); // Get gesture pinch angle -#endif //------------------------------------------------------------------------------------ // Camera System Functions (Module: camera) -- cgit v1.2.3 From 3113a20390a1e4d81e9f832e7aa1d022afdb56d1 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Mon, 25 Jan 2016 11:12:31 +0100 Subject: Added bounding box calculation --- src/raylib.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index 41fa3f7d..097c8865 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -765,10 +765,12 @@ void DrawModel(Model model, Vector3 position, float scale, Color tint); void DrawModelEx(Model model, Vector3 position, float rotationAngle, Vector3 rotationAxis, Vector3 scale, Color tint); // Draw a model with extended parameters void DrawModelWires(Model model, Vector3 position, float scale, Color color); // Draw a model wires (with texture if set) void DrawModelWiresEx(Model model, Vector3 position, float rotationAngle, Vector3 rotationAxis, Vector3 scale, Color tint); // Draw a model wires (with texture if set) with extended parameters +void DrawBoundingBox(BoundingBox box); // Draw bounding box (wires) void DrawBillboard(Camera camera, Texture2D texture, Vector3 center, float size, Color tint); // Draw a billboard texture void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle sourceRec, Vector3 center, float size, Color tint); // Draw a billboard texture defined by sourceRec +BoundingBox CalculateBoundingBox(Mesh mesh); // Calculate mesh bounding box limits bool CheckCollisionSpheres(Vector3 centerA, float radiusA, Vector3 centerB, float radiusB); // Detect collision between two spheres bool CheckCollisionBoxes(Vector3 minBBox1, Vector3 maxBBox1, Vector3 minBBox2, Vector3 maxBBox2); // Detect collision between two boxes bool CheckCollisionBoxSphere(Vector3 minBBox, Vector3 maxBBox, Vector3 centerSphere, float radiusSphere); // Detect collision between box and sphere -- cgit v1.2.3 From 99f99bea470ace9577950db8976aa092a678635d Mon Sep 17 00:00:00 2001 From: raysan5 Date: Mon, 25 Jan 2016 13:54:09 +0100 Subject: Simplified shader matrix uniforms --- src/raylib.h | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index 097c8865..48aeda54 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -358,12 +358,31 @@ typedef struct Shader { int mapSpecularLoc; // Specular map texture uniform location point (fragment shader) } Shader; +// Material type +// TODO: Redesign material-shaders-textures system +typedef struct Material { + //Shader shader; + + //Texture2D texDiffuse; // Diffuse texture + //Texture2D texNormal; // Normal texture + //Texture2D texSpecular; // Specular texture + + Color colDiffuse; + Color colAmbient; + Color colSpecular; + + float glossiness; + float normalDepth; +} Material; + // 3d Model type +// TODO: Replace shader/testure by material typedef struct Model { Mesh mesh; Matrix transform; Texture2D texture; // Only for OpenGL 1.1, on newer versions this should be in the shader Shader shader; + //Material material; } Model; // Ray type (useful for raycast) @@ -387,26 +406,6 @@ typedef struct Wave { short channels; } Wave; -// Light type -typedef struct Light { - Vector3 position; - Vector3 direction; - float intensity; - float specIntensity; - Color diffuse; - Color ambient; - Color specular; -} Light; - -// Material type -typedef struct Material { - Color diffuse; - Color ambient; - Color specular; - float glossiness; - float normalDepth; -} Material; - // Texture formats // NOTE: Support depends on OpenGL version and platform typedef enum { @@ -535,11 +534,12 @@ void BeginDrawing(void); // Setup drawing can void BeginDrawingEx(int blendMode, Shader shader, Matrix transform); // Setup drawing canvas with extended parameters void EndDrawing(void); // End canvas drawing and Swap Buffers (Double Buffering) -void Begin3dMode(Camera cam); // Initializes 3D mode for drawing (Camera setup) +void Begin3dMode(Camera camera); // Initializes 3D mode for drawing (Camera setup) void End3dMode(void); // Ends 3D mode and returns to default 2D orthographic mode Ray GetMouseRay(Vector2 mousePosition, Camera camera); // Returns a ray trace from mouse position Vector2 WorldToScreen(Vector3 position, Camera camera); // Returns the screen space position from a 3d world space position +Matrix GetCameraMatrix(Camera camera); // Returns camera transform matrix (view matrix) void SetTargetFPS(int fps); // Set target FPS (maximum) float GetFPS(void); // Returns current FPS -- cgit v1.2.3 From 13925f7bd4ad6b71f03a24024057819eb1032e05 Mon Sep 17 00:00:00 2001 From: Constantine Tarasenkov Date: Fri, 29 Jan 2016 09:09:18 +0300 Subject: Add functions to disable and enable cursor --- src/raylib.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index 48aeda54..6c1a8999 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -586,6 +586,8 @@ int GetMouseWheelMove(void); // Returns mouse wheel m void ShowCursor(void); // Shows cursor void HideCursor(void); // Hides cursor +void EnableCursor(void); // Enables cursor +void DisableCursor(void); // Disables cursor bool IsCursorHidden(void); // Returns true if cursor is not visible #endif -- cgit v1.2.3 From 728e1715cc52fb25081f3ce17cb5b3f72f7eb218 Mon Sep 17 00:00:00 2001 From: Ray Date: Tue, 2 Feb 2016 16:43:42 +0100 Subject: Redesigned gestures system... ...and improved mouse gestures support Some testing still required... --- src/raylib.h | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index 6c1a8999..a22c3f83 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -435,17 +435,17 @@ typedef enum { BLEND_ALPHA = 0, BLEND_ADDITIVE, BLEND_MULTIPLIED } BlendMode; // Gestures type // NOTE: It could be used as flags to enable only some gestures typedef enum { - GESTURE_NONE = 1, - GESTURE_TAP = 2, - GESTURE_DOUBLETAP = 4, - GESTURE_HOLD = 8, - GESTURE_DRAG = 16, - GESTURE_SWIPE_RIGHT = 32, - GESTURE_SWIPE_LEFT = 64, - GESTURE_SWIPE_UP = 128, - GESTURE_SWIPE_DOWN = 256, - GESTURE_PINCH_IN = 512, - GESTURE_PINCH_OUT = 1024 + GESTURE_NONE = 0, + GESTURE_TAP = 1, + GESTURE_DOUBLETAP = 2, + GESTURE_HOLD = 4, + GESTURE_DRAG = 8, + GESTURE_SWIPE_RIGHT = 16, + GESTURE_SWIPE_LEFT = 32, + GESTURE_SWIPE_UP = 64, + GESTURE_SWIPE_DOWN = 128, + GESTURE_PINCH_IN = 256, + GESTURE_PINCH_OUT = 512 } Gestures; typedef enum { TOUCH_UP, TOUCH_DOWN, TOUCH_MOVE } TouchAction; @@ -781,7 +781,6 @@ bool CheckCollisionRaySphereEx(Ray ray, Vector3 spherePosition, float sphereRadi bool CheckCollisionRayBox(Ray ray, Vector3 minBBox, Vector3 maxBBox); // Detect collision between ray and box Vector3 ResolveCollisionCubicmap(Image cubicmap, Vector3 mapPosition, Vector3 *playerPosition, float radius); // Detect collision of player radius with cubicmap // NOTE: Return the normal vector of the impacted surface - //------------------------------------------------------------------------------------ // Shaders System Functions (Module: rlgl) // NOTE: This functions are useless when using OpenGL 1.1 -- cgit v1.2.3 From df5c64d0beee06df8c87a43e5341b6b98f82839f Mon Sep 17 00:00:00 2001 From: Ray Date: Tue, 2 Feb 2016 18:41:01 +0100 Subject: Functions parameters reorganize: Axis and Angle sin(), cos() functions cached and replaced by float c99 versions sinf(), cos() --- src/raylib.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index a22c3f83..c306518d 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -764,9 +764,9 @@ void UnloadModel(Model model); void SetModelTexture(Model *model, Texture2D texture); // Link a texture to a model void DrawModel(Model model, Vector3 position, float scale, Color tint); // Draw a model (with texture if set) -void DrawModelEx(Model model, Vector3 position, float rotationAngle, Vector3 rotationAxis, Vector3 scale, Color tint); // Draw a model with extended parameters +void DrawModelEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint); // Draw a model with extended parameters void DrawModelWires(Model model, Vector3 position, float scale, Color color); // Draw a model wires (with texture if set) -void DrawModelWiresEx(Model model, Vector3 position, float rotationAngle, Vector3 rotationAxis, Vector3 scale, Color tint); // Draw a model wires (with texture if set) with extended parameters +void DrawModelWiresEx(Model model, Vector3 position, Vector3 rotationAxis, float rotationAngle, Vector3 scale, Color tint); // Draw a model wires (with texture if set) with extended parameters void DrawBoundingBox(BoundingBox box); // Draw bounding box (wires) void DrawBillboard(Camera camera, Texture2D texture, Vector3 center, float size, Color tint); // Draw a billboard texture -- cgit v1.2.3 From 646f1c3f716dd817ff717d35480a744a8be46ead Mon Sep 17 00:00:00 2001 From: Ray Date: Wed, 3 Feb 2016 17:45:28 +0100 Subject: Some formating tweaks --- src/raylib.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index c306518d..3d8100b3 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -81,8 +81,8 @@ #define PI 3.14159265358979323846 #endif -#define DEG2RAD (PI / 180.0f) -#define RAD2DEG (180.0f / PI) +#define DEG2RAD (PI/180.0f) +#define RAD2DEG (180.0f/PI) // raylib Config Flags #define FLAG_FULLSCREEN_MODE 1 -- cgit v1.2.3 From a847df921f94a7fd118fcb608b23f11d8255c236 Mon Sep 17 00:00:00 2001 From: Ray Date: Wed, 10 Feb 2016 10:31:06 +0100 Subject: Reviewed gestures module --- src/raylib.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index 3d8100b3..55a68ad1 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -600,9 +600,9 @@ bool IsGamepadButtonReleased(int gamepad, int button); // Detect if a gamepad b bool IsGamepadButtonUp(int gamepad, int button); // Detect if a gamepad button is NOT being pressed #endif -int GetTouchX(void); // Returns touch position X (relative to screen size) -int GetTouchY(void); // Returns touch position Y (relative to screen size) -Vector2 GetTouchPosition(void); // Returns touch position XY (relative to screen size) +int GetTouchX(void); // Returns touch position X for touch point 0 (relative to screen size) +int GetTouchY(void); // Returns touch position Y for touch point 0 (relative to screen size) +Vector2 GetTouchPosition(int index) // Returns touch position XY for a touch point index (relative to screen size) #if defined(PLATFORM_ANDROID) bool IsButtonPressed(int button); // Detect if an android physic button has been pressed @@ -622,9 +622,10 @@ void ProcessGestureEvent(GestureEvent event); // Process gesture event float GetGestureDragIntensity(void); // Get gesture drag intensity float GetGestureDragAngle(void); // Get gesture drag angle Vector2 GetGestureDragVector(void); // Get gesture drag vector -int GetGestureHoldDuration(void); // Get gesture hold time in frames +float GetGestureHoldDuration(void); // Get gesture hold time in ms float GetGesturePinchDelta(void); // Get gesture pinch delta float GetGesturePinchAngle(void); // Get gesture pinch angle +int GetTouchPointsCount(void); // Get touch points count //------------------------------------------------------------------------------------ // Camera System Functions (Module: camera) -- cgit v1.2.3 From 84a6724b33efd9ddea9782c3df88855cff2d9d3a Mon Sep 17 00:00:00 2001 From: Ray Date: Wed, 10 Feb 2016 11:24:02 +0100 Subject: Fixed a bug --- src/raylib.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index 55a68ad1..a5dd6ad2 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -602,7 +602,7 @@ bool IsGamepadButtonUp(int gamepad, int button); // Detect if a gamepad b int GetTouchX(void); // Returns touch position X for touch point 0 (relative to screen size) int GetTouchY(void); // Returns touch position Y for touch point 0 (relative to screen size) -Vector2 GetTouchPosition(int index) // Returns touch position XY for a touch point index (relative to screen size) +Vector2 GetTouchPosition(int index); // Returns touch position XY for a touch point index (relative to screen size) #if defined(PLATFORM_ANDROID) bool IsButtonPressed(int button); // Detect if an android physic button has been pressed -- cgit v1.2.3 From 685273675bc9247e215c213939c017e506296a70 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Thu, 11 Feb 2016 15:51:04 +0100 Subject: Improved LoadHeightmap() --- src/raylib.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index a5dd6ad2..f9241533 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -759,7 +759,7 @@ void DrawGizmo(Vector3 position); Model LoadModel(const char *fileName); // Load a 3d model (.OBJ) Model LoadModelEx(Mesh data); // Load a 3d model (from vertex data) //Model LoadModelFromRES(const char *rresName, int resId); // TODO: Load a 3d model from rRES file (raylib Resource) -Model LoadHeightmap(Image heightmap, float maxHeight); // Load a heightmap image as a 3d model +Model LoadHeightmap(Image heightmap, Vector3 size); // Load a heightmap image as a 3d model Model LoadCubicmap(Image cubicmap); // Load a map image as a 3d model (cubes based) void UnloadModel(Model model); // Unload 3d model from memory void SetModelTexture(Model *model, Texture2D texture); // Link a texture to a model -- cgit v1.2.3 From cbbe9485294032d680579809976f7035785d3694 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Fri, 12 Feb 2016 19:02:23 +0100 Subject: Some code tweaks --- src/raylib.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index f9241533..c2067a0e 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -166,6 +166,9 @@ #define MOUSE_MIDDLE_BUTTON 2 #endif +// Touch points registered +#define MAX_TOUCH_POINTS 2 + // Gamepad Number #define GAMEPAD_PLAYER1 0 #define GAMEPAD_PLAYER2 1 @@ -348,9 +351,6 @@ typedef struct Shader { // Uniforms int mvpLoc; // ModelView-Projection matrix uniform location point (vertex shader) - - int modelLoc; // Model transformation matrix uniform location point (vertex shader) - int viewLoc; // View transformation matrix uniform location point (vertex shader) int tintColorLoc; // Color uniform location point (fragment shader) int mapDiffuseLoc; // Diffuse map texture uniform location point (fragment shader) @@ -448,15 +448,16 @@ typedef enum { GESTURE_PINCH_OUT = 512 } Gestures; +// Touch action (fingers or mouse) typedef enum { TOUCH_UP, TOUCH_DOWN, TOUCH_MOVE } TouchAction; // Gesture events -// NOTE: MAX_TOUCH_POINTS fixed to 4 +// NOTE: MAX_TOUCH_POINTS fixed to 2 typedef struct { int touchAction; int pointCount; - int pointerId[4]; - Vector2 position[4]; + int pointerId[MAX_TOUCH_POINTS]; + Vector2 position[MAX_TOUCH_POINTS]; } GestureEvent; // Camera system modes @@ -798,6 +799,7 @@ bool IsPosproShaderEnabled(void); // Check if int GetShaderLocation(Shader shader, const char *uniformName); // Get shader uniform location void SetShaderValue(Shader shader, int uniformLoc, float *value, int size); // Set shader uniform value (float) void SetShaderValuei(Shader shader, int uniformLoc, int *value, int size); // Set shader uniform value (int) +void SetShaderValueMatrix(Shader shader, int uniformLoc, Matrix mat); // Set shader uniform value (matrix 4x4) void SetShaderMapDiffuse(Shader *shader, Texture2D texture); // Default diffuse shader map texture assignment void SetShaderMapNormal(Shader *shader, const char *uniformName, Texture2D texture); // Normal map texture shader assignment void SetShaderMapSpecular(Shader *shader, const char *uniformName, Texture2D texture); // Specular map texture shader assignment -- cgit v1.2.3 From ed1906440560d5b6b6e2cb1c1927e53b28e302db Mon Sep 17 00:00:00 2001 From: raysan5 Date: Sat, 13 Feb 2016 17:09:53 +0100 Subject: Reviewed physics module A deeper revision required, not clear enough for the user Key: Create a PhysicObjects pool --- src/raylib.h | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index c2067a0e..43819b14 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -466,13 +466,6 @@ typedef enum { CAMERA_CUSTOM = 0, CAMERA_FREE, CAMERA_ORBITAL, CAMERA_FIRST_PERS // Collider types typedef enum { COLLIDER_CIRCLE, COLLIDER_RECTANGLE, COLLIDER_CAPSULE } ColliderType; -// Physics struct -typedef struct Physics { - bool enabled; - bool debug; // Should be used by programmer for testing purposes - Vector2 gravity; -} Physics; - // Transform struct typedef struct Transform { Vector2 position; @@ -808,10 +801,10 @@ void SetShaderMap(Shader *shader, int mapLocation, Texture2D texture, int textur void SetBlendMode(int mode); // Set blending mode (alpha, additive, multiplied) //---------------------------------------------------------------------------------- -// Physics System Functions (engine-module: physics) +// Physics System Functions (engine-module: physac) //---------------------------------------------------------------------------------- -void InitPhysics(void); // Initialize all internal physics values -void SetPhysics(Physics settings); // Set physics settings values using Physics data type to overwrite internal physics settings +void InitPhysics(int maxPhysicElements); // Initialize all internal physics values +void UnloadPhysics(); // Unload physic elements arrays void AddRigidbody(int index, Rigidbody rigidbody); // Initialize a new rigidbody with parameters to internal index slot void AddCollider(int index, Collider collider); // Initialize a new Collider with parameters to internal index slot -- cgit v1.2.3 From 0018522031b8b06c447d49273bf288ec5e7a8a63 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Sat, 13 Feb 2016 19:14:22 +0100 Subject: Updated show-logo and start reviewing RPI inputs --- src/raylib.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index 43819b14..f5a3cc31 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -118,7 +118,7 @@ #define KEY_RIGHT_CONTROL 345 #define KEY_RIGHT_ALT 346 -// Keyboard Alhpa Numeric Keys +// Keyboard Alpha Numeric Keys #define KEY_ZERO 48 #define KEY_ONE 49 #define KEY_TWO 50 -- cgit v1.2.3 From afd2ffb74a84bf48b9129c613e1673ceae0bd46b Mon Sep 17 00:00:00 2001 From: Ray Date: Wed, 17 Feb 2016 13:00:48 +0100 Subject: Updated gestures module Using normalized [0..1] input points --- src/raylib.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index f5a3cc31..def56ee2 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -607,19 +607,18 @@ bool IsButtonReleased(int button); // Detect if an android //------------------------------------------------------------------------------------ // Gestures and Touch Handling Functions (Module: gestures) //------------------------------------------------------------------------------------ +void ProcessGestureEvent(GestureEvent event); // Process gesture event and translate it into gestures void UpdateGestures(void); // Update gestures detected (must be called every frame) bool IsGestureDetected(void); // Check if a gesture have been detected int GetGestureType(void); // Get latest detected gesture void SetGesturesEnabled(unsigned int gestureFlags); // Enable a set of gestures using flags -void ProcessGestureEvent(GestureEvent event); // Process gesture event and translate it into gestures +int GetTouchPointsCount(void); // Get touch points count -float GetGestureDragIntensity(void); // Get gesture drag intensity -float GetGestureDragAngle(void); // Get gesture drag angle +float GetGestureHoldDuration(void); // Get gesture hold time in milliseconds Vector2 GetGestureDragVector(void); // Get gesture drag vector -float GetGestureHoldDuration(void); // Get gesture hold time in ms -float GetGesturePinchDelta(void); // Get gesture pinch delta +float GetGestureDragAngle(void); // Get gesture drag angle +Vector2 GetGesturePinchVector(void); // Get gesture pinch delta float GetGesturePinchAngle(void); // Get gesture pinch angle -int GetTouchPointsCount(void); // Get touch points count //------------------------------------------------------------------------------------ // Camera System Functions (Module: camera) -- cgit v1.2.3 From 8aab52aeda47ce283d1446be27a7e2e20f027434 Mon Sep 17 00:00:00 2001 From: Ray San Date: Thu, 18 Feb 2016 14:05:48 +0100 Subject: Redesigned RPI input system -IN PROGRESS- --- src/raylib.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index def56ee2..0dc8c6df 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -583,9 +583,7 @@ void HideCursor(void); // Hides cursor void EnableCursor(void); // Enables cursor void DisableCursor(void); // Disables cursor bool IsCursorHidden(void); // Returns true if cursor is not visible -#endif -#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB) bool IsGamepadAvailable(int gamepad); // Detect if a gamepad is available Vector2 GetGamepadMovement(int gamepad); // Return axis movement vector for a gamepad bool IsGamepadButtonPressed(int gamepad, int button); // Detect if a gamepad button has been pressed once -- cgit v1.2.3 From 98c60838fed28958519144840a21f012995d6799 Mon Sep 17 00:00:00 2001 From: Ray San Date: Fri, 19 Feb 2016 19:57:25 +0100 Subject: Reviewed RPI inputs --- src/raylib.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/raylib.h') diff --git a/src/raylib.h b/src/raylib.h index 0dc8c6df..c4d4392d 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -111,6 +111,8 @@ #define KEY_F8 297 #define KEY_F9 298 #define KEY_F10 299 +#define KEY_F11 300 +#define KEY_F12 301 #define KEY_LEFT_SHIFT 340 #define KEY_LEFT_CONTROL 341 #define KEY_LEFT_ALT 342 -- cgit v1.2.3