Forráskód Böngészése

Improved modules description -IN PROGRESS-

Working in modules configuration flags...
Ray 8 éve
szülő
commit
05cff44d0a
15 módosított fájl, 269 hozzáadás és 139 törlés
  1. 37 19
      src/audio.c
  2. 3 1
      src/audio.h
  3. 11 3
      src/camera.h
  4. 37 18
      src/core.c
  5. 13 4
      src/gestures.h
  6. 7 6
      src/models.c
  7. 9 6
      src/physac.h
  8. 27 17
      src/raylib.h
  9. 13 12
      src/raymath.h
  10. 36 10
      src/rlgl.c
  11. 11 7
      src/rres.h
  12. 4 7
      src/shapes.c
  13. 21 15
      src/text.c
  14. 27 8
      src/textures.c
  15. 13 6
      src/utils.c

+ 37 - 19
src/audio.c

@@ -3,32 +3,50 @@
 *   raylib.audio
 *
 *   This module provides basic functionality to work with audio:
-*       Manage audio device (init/close)
-*       Load and Unload audio files (WAV, OGG, FLAC, XM, MOD)
-*       Play/Stop/Pause/Resume loaded audio
-*       Manage mixing channels
-*       Manage raw audio context
+*     Manage audio device (init/close)
+*     Load and Unload audio files (WAV, OGG, FLAC, XM, MOD)
+*     Play/Stop/Pause/Resume loaded audio
+*     Manage mixing channels
+*     Manage raw audio context
 *
-*   External libs:
+*   NOTES:
+*
+*   Only up to two channels supported: MONO and STEREO (for additional channels, use AL_EXT_MCFORMATS)
+*   Only the following sample sizes supported: 8bit PCM, 16bit PCM, 32-bit float PCM (using AL_EXT_FLOAT32)
+*
+*   CONFIGURATION:
+*   
+*   #define AUDIO_STANDALONE
+*       If defined, the module can be used as standalone library (independently of raylib).
+*       Required types and functions are defined in the same module.
+*
+*   #define SUPPORT_FILEFORMAT_WAV  / SUPPORT_LOAD_WAV / ENABLE_LOAD_WAV
+*   #define SUPPORT_FILEFORMAT_OGG
+*   #define SUPPORT_FILEFORMAT_XM
+*   #define SUPPORT_FILEFORMAT_MOD
+*   #define SUPPORT_FILEFORMAT_FLAC
+*       Selected desired fileformats to be supported for loading. Some of those formats are 
+*       supported by default, to remove support, just comment unrequired #define in this module
+*
+*   #define SUPPORT_RAW_AUDIO_BUFFERS
+*
+*   DEPENDENCIES:
 *       OpenAL Soft - Audio device management (http://kcat.strangesoft.net/openal.html)
 *       stb_vorbis  - OGG audio files loading (http://www.nothings.org/stb_vorbis/)
 *       jar_xm      - XM module file loading
 *       jar_mod     - MOD audio file loading
 *       dr_flac     - FLAC audio file loading
 *
-*   Module Configuration Flags:
-*       AUDIO_STANDALONE    - Use this module as standalone library (independently of raylib)
-*
-*   Some design decisions:
-*       Support only up to two channels: MONO and STEREO (for additional channels, AL_EXT_MCFORMATS)
-*       Support only the following sample sizes: 8bit PCM, 16bit PCM, 32-bit float PCM (using AL_EXT_FLOAT32)
+*   CONTRIBUTORS:
 *
 *   Many thanks to Joshua Reisenauer (github: @kd7tck) for the following additions:
-*       XM audio module support (jar_xm)
-*       MOD audio module support (jar_mod)
-*       Mixing channels support
-*       Raw audio context support
+*     XM audio module support (jar_xm)
+*     MOD audio module support (jar_mod)
+*     Mixing channels support
+*     Raw audio context support
+*
 *
+*   LICENSE: zlib/libpng
 *
 *   Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
 *
@@ -246,11 +264,11 @@ Wave LoadWave(const char *fileName)
     else if (strcmp(GetExtension(fileName), "flac") == 0) wave = LoadFLAC(fileName);
     else if (strcmp(GetExtension(fileName),"rres") == 0)
     {
-        RRESData rres = LoadResource(fileName);
+        RRES rres = LoadResource(fileName, 0);
 
-        // NOTE: Parameters for RRES_WAVE type are: sampleCount, sampleRate, sampleSize, channels
+        // NOTE: Parameters for RRES_TYPE_WAVE are: sampleCount, sampleRate, sampleSize, channels
 
-        if (rres.type == RRES_WAVE) wave = LoadWaveEx(rres.data, rres.param1, rres.param2, rres.param3, rres.param4);
+        if (rres[0].type == RRES_TYPE_WAVE) wave = LoadWaveEx(rres[0].data, rres[0].param1, rres[0].param2, rres[0].param3, rres[0].param4);
         else TraceLog(WARNING, "[%s] Resource file does not contain wave data", fileName);
 
         UnloadResource(rres);

+ 3 - 1
src/audio.h

@@ -9,7 +9,7 @@
 *       Manage mixing channels
 *       Manage raw audio context
 *
-*   External libs:
+*   DEPENDENCIES:
 *       OpenAL Soft - Audio device management (http://kcat.strangesoft.net/openal.html)
 *       stb_vorbis  - OGG audio files loading (http://www.nothings.org/stb_vorbis/)
 *       jar_xm      - XM module file loading
@@ -23,6 +23,8 @@
 *       Raw audio context support
 *
 *
+*   LICENSE: zlib/libpng
+*
 *   Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
 *
 *   This software is provided "as-is", without any express or implied warranty. In no event

+ 11 - 3
src/camera.h

@@ -2,6 +2,10 @@
 *
 *   raylib Camera System - Camera Modes Setup and Control Functions
 *
+*   NOTE: Memory footprint of this library is aproximately 52 bytes (global variables)
+*
+*   CONFIGURATION:
+*
 *   #define CAMERA_IMPLEMENTATION
 *       Generates the implementation of the library into the included file.
 *       If not defined, the library is in header only mode and can be included in other headers 
@@ -11,10 +15,14 @@
 *       If defined, the library can be used as standalone as a camera system but some
 *       functions must be redefined to manage inputs accordingly.
 *
-*   NOTE: Memory footprint of this library is aproximately 52 bytes (global variables)
+*   CONTRIBUTORS:
+*       Marc Palau:         Initial implementation (2014)
+*       Ramon Santamaria:   Supervision, review, update and maintenance
+*
+*
+*   LICENSE: zlib/libpng
 *
-*   Initial design by Marc Palau (2014)
-*   Reviewed by Ramon Santamaria (2015-2016)
+*   Copyright (c) 2015-2016 Ramon Santamaria (@raysan5)
 *
 *   This software is provided "as-is", without any express or implied warranty. In no event
 *   will the authors be held liable for any damages arising from the use of this software.

+ 37 - 18
src/core.c

@@ -1,27 +1,46 @@
 /**********************************************************************************************
 *
-*   raylib.core
-*
-*   Basic functions to manage windows, OpenGL context and input on multiple platforms
+*   raylib.core - Basic functions to manage windows, OpenGL context and input on multiple platforms
 *
 *   The following platforms are supported: Windows, Linux, Mac (OSX), Android, Raspberry Pi, HTML5, Oculus Rift CV1
 *
-*   External libs:
+*   CONFIGURATION:
+*
+*   #define PLATFORM_DESKTOP
+*       Windowing and input system configured for desktop platforms: Windows, Linux, OSX (managed by GLFW3 library)
+*       NOTE: Oculus Rift CV1 requires PLATFORM_DESKTOP for mirror rendering - View [rlgl] module to enable it
+*
+*   #define PLATFORM_ANDROID
+*       Windowing and input system configured for Android device, app activity managed internally in this module.
+*       NOTE: OpenGL ES 2.0 is required and graphic device is managed by EGL
+*
+*   #define PLATFORM_RPI
+*       Windowing and input system configured for Raspberry Pi (tested on Raspbian), graphic device is managed by EGL 
+*       and inputs are processed is raw mode, reading from /dev/input/
+*
+*   #define PLATFORM_WEB
+*       Windowing and input system configured for HTML5 (run on browser), code converted from C to asm.js
+*       using emscripten compiler. OpenGL ES 2.0 required for direct translation to WebGL equivalent code.
+*
+*   #define LOAD_DEFAULT_FONT (defined by default)
+*       Default font is loaded on window initialization to be available for the user to render simple text.
+*       NOTE: If enabled, uses external module functions to load default raylib font (module: text)
+*
+*   #define INCLUDE_CAMERA_SYSTEM / SUPPORT_CAMERA_SYSTEM
+*
+*   #define INCLUDE_GESTURES_SYSTEM / SUPPORT_GESTURES_SYSTEM
+*
+*   #define SUPPORT_MOUSE_GESTURES
+*       Mouse gestures are directly mapped like touches and processed by gestures system.
+*
+*   DEPENDENCIES:
 *       GLFW3    - Manage graphic device, OpenGL context and inputs on PLATFORM_DESKTOP (Windows, Linux, OSX)
 *       raymath  - 3D math functionality (Vector3, Matrix, Quaternion)
 *       camera   - Multiple 3D camera modes (free, orbital, 1st person, 3rd person)
 *       gestures - Gestures system for touch-ready devices (or simulated from mouse inputs)
 *
-*   Module Configuration Flags:
-*       PLATFORM_DESKTOP     - Windows, Linux, Mac (OSX)
-*       PLATFORM_ANDROID     - Android (only OpenGL ES 2.0 devices), graphic device is managed by EGL and input system by Android activity.
-*       PLATFORM_RPI         - Rapsberry Pi (tested on Raspbian), graphic device is managed by EGL and input system is coded in raw mode.
-*       PLATFORM_WEB         - HTML5 (using emscripten compiler)
-*
-*       RL_LOAD_DEFAULT_FONT - Use external module functions to load default raylib font (module: text)
-*
-*   NOTE: Oculus Rift CV1 requires PLATFORM_DESKTOP for render mirror - View [rlgl] module to enable it
 *
+*   LICENSE: zlib/libpng
 *
 *   Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
 *
@@ -140,7 +159,7 @@
 #define MAX_GAMEPAD_BUTTONS       32        // Max bumber of buttons supported (per gamepad)
 #define MAX_GAMEPAD_AXIS          8         // Max number of axis supported (per gamepad)
 
-#define RL_LOAD_DEFAULT_FONT        // Load default font on window initialization (module: text)
+#define LOAD_DEFAULT_FONT        // Load default font on window initialization (module: text)
 
 //----------------------------------------------------------------------------------
 // Types and Structures Definition
@@ -256,7 +275,7 @@ static bool showLogo = false;               // Track if showing logo at init is
 //----------------------------------------------------------------------------------
 // Other Modules Functions Declaration (required by core)
 //----------------------------------------------------------------------------------
-#if defined(RL_LOAD_DEFAULT_FONT)
+#if defined(LOAD_DEFAULT_FONT)
 extern void LoadDefaultFont(void);          // [Module: text] Loads default font on InitWindow()
 extern void UnloadDefaultFont(void);        // [Module: text] Unloads default font from GPU memory
 #endif
@@ -338,7 +357,7 @@ void InitWindow(int width, int height, const char *title)
     // Init graphics device (display device and OpenGL context)
     InitGraphicsDevice(width, height);
 
-#if defined(RL_LOAD_DEFAULT_FONT)
+#if defined(LOAD_DEFAULT_FONT)
     // Load default font
     // NOTE: External function (defined in module: text)
     LoadDefaultFont();
@@ -450,7 +469,7 @@ void InitWindow(int width, int height, void *state)
 // Close Window and Terminate Context
 void CloseWindow(void)
 {
-#if defined(RL_LOAD_DEFAULT_FONT)
+#if defined(LOAD_DEFAULT_FONT)
     UnloadDefaultFont();
 #endif
 
@@ -2410,7 +2429,7 @@ static void AndroidCommandCallback(struct android_app *app, int32_t cmd)
                     // Init graphics device (display device and OpenGL context)
                     InitGraphicsDevice(screenWidth, screenHeight);
 
-                    #if defined(RL_LOAD_DEFAULT_FONT)
+                    #if defined(LOAD_DEFAULT_FONT)
                     // Load default font
                     // NOTE: External function (defined in module: text)
                     LoadDefaultFont();

+ 13 - 4
src/gestures.h

@@ -2,6 +2,10 @@
 *
 *   raylib Gestures System - Gestures Processing based on input gesture events (touch/mouse)
 *
+*   NOTE: Memory footprint of this library is aproximately 128 bytes (global variables)
+*
+*   CONFIGURATION:
+*
 *   #define GESTURES_IMPLEMENTATION
 *       Generates the implementation of the library into the included file.
 *       If not defined, the library is in header only mode and can be included in other headers 
@@ -11,11 +15,16 @@
 *       If defined, the library can be used as standalone to process gesture events with
 *       no external dependencies.
 *
-*   NOTE: Memory footprint of this library is aproximately 128 bytes
+*   CONTRIBUTORS:
+*       Marc Palau:         Initial implementation (2014)
+*       Albert Martos:      Complete redesign and testing (2015)
+*       Ian Eito:           Complete redesign and testing (2015)
+*       Ramon Santamaria:   Supervision, review, update and maintenance
+*
+*
+*   LICENSE: zlib/libpng
 *
-*   Initial design by Marc Palau (2014)
-*   Redesigned by Albert Martos and Ian Eito (2015)
-*   Reviewed by Ramon Santamaria (2015-2016)
+*   Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
 *
 *   This software is provided "as-is", without any express or implied warranty. In no event
 *   will the authors be held liable for any damages arising from the use of this software.

+ 7 - 6
src/models.c

@@ -1,14 +1,15 @@
 /**********************************************************************************************
 *
-*   raylib.models
+*   raylib.models - Basic functions to draw 3d shapes and 3d models
 *
-*   Basic functions to draw 3d shapes and load/draw 3d models (.OBJ)
+*   CONFIGURATION:
 *
-*   External libs:
-*       rlgl     - raylib OpenGL abstraction layer
+*   #define SUPPORT_FILEFORMAT_OBJ / SUPPORT_LOAD_OBJ
 *
-*   Module Configuration Flags:
-*       ...
+*   #define SUPPORT_FILEFORMAT_MTL
+*
+*
+*   LICENSE: zlib/libpng
 *
 *   Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
 *

+ 9 - 6
src/physac.h

@@ -1,11 +1,13 @@
 /**********************************************************************************************
 *
-*   Physac - 2D Physics library for videogames
+*   Physac v1.0 - 2D Physics library for videogames
 *
-*   Description: Physac is a small 2D physics engine written in pure C. The engine uses a fixed time-step thread loop 
-*   to simluate physics. A physics step contains the following phases: get collision information, apply dynamics, 
-*   collision solving and position correction. It uses a very simple struct for physic bodies with a position vector 
-*   to be used in any 3D rendering API.
+*   DESCRIPTION: 
+*
+*   Physac is a small 2D physics engine written in pure C. The engine uses a fixed time-step thread loop 
+*   to simluate physics. A physics step contains the following phases: get collision information, 
+*   apply dynamics, collision solving and position correction. It uses a very simple struct for physic 
+*   bodies with a position vector to be used in any 3D rendering API.
 * 
 *   CONFIGURATION:
 *   
@@ -37,7 +39,8 @@
 *       Otherwise it will include stdlib.h and use the C standard library malloc()/free() function.
 *
 *   VERY THANKS TO:
-*       - Ramón Santamaria (@raysan5)
+*       Ramón Santamaria (@raysan5)
+*
 *
 *   LICENSE: zlib/libpng
 *

+ 27 - 17
src/raylib.h

@@ -1,10 +1,10 @@
 /**********************************************************************************************
 *
-*   raylib 1.7.0 (www.raylib.com)
+*   raylib v1.7.0 (www.raylib.com)
 *
 *   A simple and easy-to-use library to learn videogames programming
 *
-*   Features:
+*   FEATURES:
 *     Library written in plain C code (C99)
 *     Uses PascalCase/camelCase notation
 *     Hardware accelerated with OpenGL (1.1, 2.1, 3.3 or ES 2.0)
@@ -20,7 +20,13 @@
 *     Minimal external dependencies (GLFW3, OpenGL, OpenAL)
 *     Complete binding for Lua [rlua]
 *
-*   External libs:
+*   NOTES:
+*     32bit Colors - All defined color are always RGBA (struct Color is 4 byte)
+*     One custom default font could be loaded automatically when InitWindow() [core]
+*     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 could be loaded automatically (internally defined)
+*
+*   DEPENDENCIES:
 *     GLFW3 (www.glfw.org) for window/context management and input [core]
 *     GLAD for OpenGL extensions loading (3.3 Core profile, only PLATFORM_DESKTOP) [rlgl]
 *     stb_image (Sean Barret) for images loading (JPEG, PNG, BMP, TGA) [textures]
@@ -33,13 +39,8 @@
 *     OpenAL Soft for audio device/context management [audio]
 *     tinfl for data decompression (DEFLATE algorithm) [utils]
 *
-*   Some design decisions:
-*     32bit Colors - All defined color are always RGBA (struct Color is 4 byte)
-*     One custom default font could be loaded automatically when InitWindow() [core]
-*     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 could be loaded automatically (internally defined)
 *
-*   -- LICENSE --
+*   LICENSE: zlib/libpng
 *
 *   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:
@@ -592,8 +593,9 @@ typedef enum {
     HMD_FOVE_VR,
 } VrDevice;
 
-// rRES data returned when reading a resource, it contains all required data for user (24 byte)
-typedef struct {
+// rRES data returned when reading a resource, 
+// it contains all required data for user (24 byte)
+typedef struct RRESData {
     unsigned int type;          // Resource type (4 byte)
 
     unsigned int param1;        // Resouce parameter 1 (4 byte)
@@ -604,14 +606,21 @@ typedef struct {
     void *data;                 // Resource data pointer (4 byte)
 } RRESData;
 
-typedef enum {
-    RRES_RAW = 0,
-    RRES_IMAGE,
-    RRES_WAVE,
-    RRES_VERTEX,
-    RRES_TEXT
+// RRESData type
+typedef enum { 
+    RRES_TYPE_RAW = 0, 
+    RRES_TYPE_IMAGE, 
+    RRES_TYPE_WAVE, 
+    RRES_TYPE_VERTEX, 
+    RRES_TYPE_TEXT,
+    RRES_TYPE_FONT_IMAGE,
+    RRES_TYPE_FONT_CHARDATA,    // CharInfo data array
+    RRES_TYPE_DIRECTORY
 } RRESDataType;
 
+// RRES type (pointer to RRESData array)
+typedef struct RRESData *RRES;
+
 #ifdef __cplusplus
 extern "C" {            // Prevents name mangling of functions
 #endif
@@ -758,6 +767,7 @@ RLAPI void DrawCircleV(Vector2 center, float radius, Color color);
 RLAPI void DrawCircleLines(int centerX, int centerY, float radius, Color color);                         // Draw circle outline
 RLAPI void DrawRectangle(int posX, int posY, int width, int height, Color color);                        // Draw a color-filled rectangle
 RLAPI void DrawRectangleRec(Rectangle rec, Color color);                                                 // Draw a color-filled rectangle
+RLAPI void DrawRectanglePro(Rectangle rec, Vector2 origin, float rotation, Color color);                 // Draw a color-filled rectangle with pro parameters
 RLAPI void DrawRectangleGradient(int posX, int posY, int width, int height, Color color1, Color color2); // Draw a gradient-filled rectangle
 RLAPI void DrawRectangleV(Vector2 position, Vector2 size, Color color);                                  // Draw a color-filled rectangle (Vector version)
 RLAPI void DrawRectangleLines(int posX, int posY, int width, int height, Color color);                   // Draw rectangle outline

+ 13 - 12
src/raymath.h

@@ -1,22 +1,23 @@
 /**********************************************************************************************
 *
-*   raymath (header only file)
+*   raymath v1.0 - Some useful functions to work with Vector3, Matrix and Quaternions
 *
-*   Some useful functions to work with Vector3, Matrix and Quaternions
+*   CONFIGURATION:
 *
-*   You must:
-*       #define RAYMATH_IMPLEMENTATION
-*   before you include this file in *only one* C or C++ file to create the implementation.
+*   #define RAYMATH_IMPLEMENTATION
+*       Generates the implementation of the library into the included file.
+*       If not defined, the library is in header only mode and can be included in other headers
+*       or source files without problems. But only ONE file should hold the implementation.
 *
-*   Example:
-*       #define RAYMATH_IMPLEMENTATION
-*       #include "raymath.h"
+*   #define RAYMATH_EXTERN_INLINE
+*       Inlines all functions code, so it runs faster. This requires lots of memory on system.
+*   
+*   #define RAYMATH_STANDALONE
+*       Avoid raylib.h header inclusion in this file. 
+*       Vector3 and Matrix data types are defined internally in raymath module.
 *
-*   You can also use:
-*       #define RAYMATH_EXTERN_INLINE       // Inlines all functions code, so it runs faster.
-*                                           // This requires lots of memory on system.
-*       #define RAYMATH_STANDALONE          // Not dependent on raylib.h structs: Vector3, Matrix.
 *
+*   LICENSE: zlib/libpng
 *
 *   Copyright (c) 2015 Ramon Santamaria (@raysan5)
 *

+ 36 - 10
src/rlgl.c

@@ -2,6 +2,8 @@
 *
 *   rlgl - raylib OpenGL abstraction layer
 *
+*   DESCRIPTION:
+*
 *   rlgl allows usage of OpenGL 1.1 style functions (rlVertex) that are internally mapped to
 *   selected OpenGL version (1.1, 2.1, 3.3 Core, ES 2.0).
 *
@@ -11,20 +13,44 @@
 *       rlglDraw()  - Process internal buffers and send required draw calls
 *       rlglClose() - De-initialize internal buffers data and other auxiliar resources
 *
-*   External libs:
+*   CONFIGURATION:
+*
+*   #define GRAPHICS_API_OPENGL_11
+*       Use OpenGL 1.1 backend
+*
+*   #define GRAPHICS_API_OPENGL_21
+*       Use OpenGL 2.1 backend
+*
+*   #define GRAPHICS_API_OPENGL_33
+*       Use OpenGL 3.3 Core profile backend
+*
+*   #define GRAPHICS_API_OPENGL_ES2
+*       Use OpenGL ES 2.0 backend
+*
+*   #define RLGL_STANDALONE
+*       Use rlgl as standalone library (no raylib dependency)
+*
+*   #define RLGL_NO_DISTORTION_SHADER
+*       Avoid stereo rendering distortion sahder (shader_distortion.h) inclusion
+*
+*   #define SUPPORT_SHADER_DEFAULT / ENABLE_SHADER_DEFAULT
+*
+*   #define SUPPORT_SHADER_DISTORTION
+*
+*
+*   #define SUPPORT_OCULUS_RIFT_CV1 / RLGL_OCULUS_SUPPORT
+*       Enable Oculus Rift CV1 functionality
+*
+*   #define SUPPORT_STEREO_RENDERING
+*
+*   #define RLGL_NO_DEFAULT_SHADER
+*
+*   DEPENDENCIES:
 *       raymath     - 3D math functionality (Vector3, Matrix, Quaternion)
 *       GLAD        - OpenGL extensions loading (OpenGL 3.3 Core only)
 *
-*   Module Configuration Flags:
-*       GRAPHICS_API_OPENGL_11  - Use OpenGL 1.1 backend
-*       GRAPHICS_API_OPENGL_21  - Use OpenGL 2.1 backend
-*       GRAPHICS_API_OPENGL_33  - Use OpenGL 3.3 Core profile backend
-*       GRAPHICS_API_OPENGL_ES2 - Use OpenGL ES 2.0 backend
-*
-*       RLGL_STANDALONE             - Use rlgl as standalone library (no raylib dependency)
-*       RLGL_NO_DISTORTION_SHADER   - Avoid stereo rendering distortion sahder (shader_distortion.h) inclusion
-*       RLGL_OCULUS_SUPPORT         - Enable Oculus Rift CV1 functionality
 *
+*   LICENSE: zlib/libpng
 *
 *   Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
 *

+ 11 - 7
src/rres.h

@@ -4,14 +4,18 @@
 *
 *   Basic functions to load/save rRES resource files
 *
-*   External libs:
-*       tinfl   -  DEFLATE decompression functions
+*   CONFIGURATION:
+*
+*   #define RREM_IMPLEMENTATION
+*       Generates the implementation of the library into the included file.
+*       If not defined, the library is in header only mode and can be included in other headers
+*       or source files without problems. But only ONE file should hold the implementation.
 *
-*   Module Configuration Flags:
+*   DEPENDENCIES:
+*       tinfl   -  DEFLATE decompression functions
 *
-*       #define RREM_IMPLEMENTATION
-*           Generates the implementation of the library into the included file.
 *
+*   LICENSE: zlib/libpng
 *
 *   Copyright (c) 2016-2017 Ramon Santamaria (@raysan5)
 *
@@ -81,7 +85,7 @@
         RRES_TYPE_VERTEX, 
         RRES_TYPE_TEXT,
         RRES_TYPE_FONT_IMAGE,
-        RRES_TYPE_FONT_DATA,        // Character { int value, recX, recY, recWidth, recHeight, offsetX, offsetY, xAdvance } 
+        RRES_TYPE_FONT_CHARDATA,        // Character { int value, recX, recY, recWidth, recHeight, offsetX, offsetY, xAdvance } 
         RRES_TYPE_DIRECTORY
     } RRESDataType;
     
@@ -243,7 +247,7 @@ static void *DecompressData(const unsigned char *data, unsigned long compSize, i
 // NOTE: Returns uncompressed data with parameters, search resource by id
 RRESDEF RRES LoadResource(const char *fileName, int rresId)
 {
-    RRES rres;
+    RRES rres = { 0 };
 
     RRESFileHeader fileHeader;
     RRESInfoHeader infoHeader;

+ 4 - 7
src/shapes.c

@@ -1,17 +1,14 @@
 /**********************************************************************************************
 *
-*   raylib.shapes
-*
-*   Basic functions to draw 2d Shapes and check collisions
-*
-*   DEPENDENCIES:
-*       rlgl     - raylib OpenGL abstraction layer
+*   raylib.shapes - Basic functions to draw 2d Shapes and check collisions
 *
 *   CONFIGURATION:
 *
 *   #define SUPPORT_QUADS_ONLY
+*       Draw shapes using only QUADS, vertex are accumulated in QUADS arrays (like textures)
 *
-    #define SUPPORT_TRIANGLES_ONLY
+*   #define SUPPORT_TRIANGLES_ONLY
+*       Draw shapes using only TRIANGLES, vertex are accumulated in TRIANGLES arrays
 *
 *
 *   LICENSE: zlib/libpng

+ 21 - 15
src/text.c

@@ -1,14 +1,22 @@
 /**********************************************************************************************
 *
-*   raylib.text
+*   raylib.text - Basic functions to load SpriteFonts and draw Text
 *
-*   Basic functions to load SpriteFonts and draw Text
+*   CONFIGURATION:
 *
-*   External libs:
+*   #define SUPPORT_FILEFORMAT_FNT
+*   #define SUPPORT_FILEFORMAT_TTF / INCLUDE_STB_TRUETYPE
+*   #define SUPPORT_FILEFORMAT_IMAGE_FONT
+*       Selected desired fileformats to be supported for loading. Some of those formats are 
+*       supported by default, to remove support, just comment unrequired #define in this module
+*
+*   #define INCLUDE_DEFAULT_FONT / SUPPORT_DEFAULT_FONT
+*
+*   DEPENDENCIES:
 *       stb_truetype - Load TTF file and rasterize characters data
 *
-*   Module Configuration Flags:
-*       ...
+*
+*   LICENSE: zlib/libpng
 *
 *   Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
 *
@@ -262,30 +270,28 @@ SpriteFont LoadSpriteFont(const char *fileName)
     else if (strcmp(GetExtension(fileName),"rres") == 0)
     {
         // TODO: Read multiple resource blocks from file (RRES_FONT_IMAGE, RRES_FONT_CHARDATA)
-        RRESData rres = LoadResource(fileName);
+        RRES rres = LoadResource(fileName, 0);
 
         // Load sprite font texture
-        /*
-        if (rres.type == RRES_FONT_IMAGE) 
+        if (rres[0].type == RRES_TYPE_FONT_IMAGE) 
         {
             // NOTE: Parameters for RRES_FONT_IMAGE type are: width, height, format, mipmaps
-            Image image = LoadImagePro(rres.data, rres.param1, rres.param2, rres.param3);
+            Image image = LoadImagePro(rres[0].data, rres[0].param1, rres[0].param2, rres[0].param3);
             spriteFont.texture = LoadTextureFromImage(image);
             UnloadImage(image);
         }
         
         // Load sprite characters data
-        if (rres.type == RRES_FONT_CHARDATA) 
+        if (rres[1].type == RRES_TYPE_FONT_CHARDATA) 
         {
             // NOTE: Parameters for RRES_FONT_CHARDATA type are: fontSize, charsCount
-            spriteFont.baseSize = rres.param1;
-            spriteFont.charsCount = rres.param2;
-            spriteFont.chars = rres.data;
+            spriteFont.baseSize = rres[1].param1;
+            spriteFont.charsCount = rres[1].param2;
+            spriteFont.chars = rres[1].data;
         }
-        */
 
         // TODO: Do not free rres.data memory (chars info data!)
-        UnloadResource(rres);
+        //UnloadResource(rres[0]);
     }
     else
     {

+ 27 - 8
src/textures.c

@@ -1,16 +1,35 @@
 /**********************************************************************************************
 *
-*   raylib.textures
+*   raylib.textures - Basic functions to load and draw Textures (2d)
 *
-*   Basic functions to load and draw Textures (2d)
+*   CONFIGURATION:
 *
-*   External libs:
+*   #define SUPPORT_STB_IMAGE / INCLUDE_STB_IMAGE
+*
+*   #define SUPPORT_FILEFORMAT_BMP / SUPPORT_LOAD_BMP
+*   #define SUPPORT_FILEFORMAT_PNG / SUPPORT_LOAD_PNG
+*   #define SUPPORT_FILEFORMAT_TGA
+*   #define SUPPORT_FILEFORMAT_JPG / ENABLE_LOAD_JPG
+*   #define SUPPORT_FILEFORMAT_GIF
+*   #define SUPPORT_FILEFORMAT_HDR
+*   #define SUPPORT_FILEFORMAT_DDS / ENABLE_LOAD_DDS
+*   #define SUPPORT_FILEFORMAT_PKM
+*   #define SUPPORT_FILEFORMAT_KTX
+*   #define SUPPORT_FILEFORMAT_PVR
+*   #define SUPPORT_FILEFORMAT_ASTC
+*       Selected desired fileformats to be supported for loading. Some of those formats are 
+*       supported by default, to remove support, just comment unrequired #define in this module
+*
+*   #define SUPPORT_IMAGE_RESIZE / INCLUDE_STB_IMAGE_RESIZE
+*   #define SUPPORT_IMAGE_MANIPULATION
+*
+*   DEPENDENCIES:
 *       stb_image        - Multiple image formats loading (JPEG, PNG, BMP, TGA, PSD, GIF, PIC)
 *                          NOTE: stb_image has been slightly modified to support Android platform.
 *       stb_image_resize - Multiple image resize algorythms
 *
-*   Module Configuration Flags:
-*       ...
+*
+*   LICENSE: zlib/libpng
 *
 *   Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
 *
@@ -143,11 +162,11 @@ Image LoadImage(const char *fileName)
     else if (strcmp(GetExtension(fileName),"astc") == 0) image = LoadASTC(fileName);
     else if (strcmp(GetExtension(fileName),"rres") == 0)
     {
-        RRESData rres = LoadResource(fileName);
+        RRES rres = LoadResource(fileName, 0);
 
-        // NOTE: Parameters for RRES_IMAGE type are: width, height, format, mipmaps
+        // NOTE: Parameters for RRES_TYPE_IMAGE are: width, height, format, mipmaps
 
-        if (rres.type == RRES_IMAGE) image = LoadImagePro(rres.data, rres.param1, rres.param2, rres.param3);
+        if (rres[0].type == RRES_TYPE_IMAGE) image = LoadImagePro(rres[0].data, rres[0].param1, rres[0].param2, rres[0].param3);
         else TraceLog(WARNING, "[%s] Resource file does not contain image data", fileName);
 
         UnloadResource(rres);

+ 13 - 6
src/utils.c

@@ -1,16 +1,23 @@
 /**********************************************************************************************
 *
-*   raylib.utils
+*   raylib.utils - Some common utility functions
 *
-*   Some utility functions
+*   CONFIGURATION:
 *
-*   External libs:
-*       tinfl           - zlib DEFLATE algorithm decompression
+*   #define SUPPORT_SAVE_PNG
+*       Enable saving PNG fileformat
+*       NOTE: Requires stb_image_write library
+*
+*   #define SUPPORT_SAVE_BMP
+*
+*   #define DO_NOT_TRACE_DEBUG_MSGS
+*       Avoid showing DEBUG TraceLog() messages
+*
+*   DEPENDENCIES:
 *       stb_image_write - PNG writting functions
 *
-*   Module Configuration Flags:
-*       DO_NOT_TRACE_DEBUG_MSGS - Avoid showing DEBUG TraceLog() messages
 *
+*   LICENSE: zlib/libpng
 *
 *   Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
 *