From 8f5ff64420dda659583c156b9c5e42e60384e247 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Sun, 19 Mar 2017 12:52:58 +0100 Subject: [PATCH] Working on file header comments... --- src/audio.c | 41 ++++++++++++++++++--------------- src/audio.h | 28 ++++++++++++---------- src/core.c | 11 +++++++-- src/easings.h | 2 +- src/models.c | 4 +++- src/raylib.h | 64 ++++++++++++++++++++++++++------------------------- src/utils.c | 19 +++++++++++---- src/utils.h | 6 +++++ 8 files changed, 105 insertions(+), 70 deletions(-) diff --git a/src/audio.c b/src/audio.c index 659ead0f..e0964e02 100644 --- a/src/audio.c +++ b/src/audio.c @@ -1,26 +1,24 @@ /********************************************************************************************** * -* raylib.audio +* raylib.audio - Basic funtionality to work with 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 +* DESCRIPTION: * -* 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) +* This module provides basic functionality to: +* - Manage audio device (init/close) +* - Load and unload audio files +* - Format wave data (sample rate, size, channels) +* - Play/Stop/Pause/Resume loaded audio +* - Manage mixing channels +* - Manage raw audio context * * CONFIGURATION: * * #define AUDIO_STANDALONE -* If defined, the module can be used as standalone library (independently of raylib). +* Define to use the module 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_WAV / SUPPORT_LOAD_WAV * #define SUPPORT_FILEFORMAT_OGG * #define SUPPORT_FILEFORMAT_XM * #define SUPPORT_FILEFORMAT_MOD @@ -29,6 +27,12 @@ * supported by default, to remove support, just comment unrequired #define in this module * * #define SUPPORT_RAW_AUDIO_BUFFERS +* Support creating raw audio buffers to send raw data. Buffers must be managed by the user, +* it means initialization, refilling and cleaning. +* +* LIMITATIONS: +* 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) * * DEPENDENCIES: * OpenAL Soft - Audio device management (http://kcat.strangesoft.net/openal.html) @@ -38,12 +42,11 @@ * dr_flac - FLAC audio file loading * * 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 +* Joshua Reisenauer (github: @kd7tck): +* - XM audio module support (jar_xm) +* - MOD audio module support (jar_mod) +* - Mixing channels support +* - Raw audio context support * * * LICENSE: zlib/libpng diff --git a/src/audio.h b/src/audio.h index 01ed9f72..a0279e3a 100644 --- a/src/audio.h +++ b/src/audio.h @@ -1,13 +1,16 @@ /********************************************************************************************** * -* raylib.audio +* raylib.audio - Basic funtionality to work with 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 +* DESCRIPTION: +* +* This module provides basic functionality to: +* - Manage audio device (init/close) +* - Load and unload audio files +* - Format wave data (sample rate, size, channels) +* - Play/Stop/Pause/Resume loaded audio +* - Manage mixing channels +* - Manage raw audio context * * DEPENDENCIES: * OpenAL Soft - Audio device management (http://kcat.strangesoft.net/openal.html) @@ -16,11 +19,12 @@ * jar_mod - MOD audio file loading * dr_flac - FLAC audio file loading * -* 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 +* CONTRIBUTORS: +* Joshua Reisenauer (github: @kd7tck): +* - XM audio module support (jar_xm) +* - MOD audio module support (jar_mod) +* - Mixing channels support +* - Raw audio context support * * * LICENSE: zlib/libpng diff --git a/src/core.c b/src/core.c index 38549354..f55a70db 100644 --- a/src/core.c +++ b/src/core.c @@ -2,7 +2,14 @@ * * 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 +* The following platforms are supported: +* Windows (win32/Win64) +* Linux (tested on Ubuntu) +* Mac (OSX) +* Android (API Level 9 or greater) +* Raspberry Pi (Raspbian) +* HTML5 (Chrome, Firefox) +* Oculus Rift CV1 * * CONFIGURATION: * @@ -2006,7 +2013,7 @@ static double GetTime(void) // Wait for some milliseconds (stop program execution) static void Wait(float ms) { -#define SUPPORT_BUSY_WAIT_LOOP +//#define SUPPORT_BUSY_WAIT_LOOP #if defined(SUPPORT_BUSY_WAIT_LOOP) double prevTime = GetTime(); double nextTime = 0.0; diff --git a/src/easings.h b/src/easings.h index 527970ab..9ad27313 100644 --- a/src/easings.h +++ b/src/easings.h @@ -122,7 +122,7 @@ EASEDEF float EaseCubicOut(float t, float b, float c, float d) { return (c*((t=t EASEDEF float EaseCubicInOut(float t, float b, float c, float d) { if ((t/=d/2) < 1) return (c/2*t*t*t + b); - return (c/2*((t-=2)*t*t + 2) + b); + return (c/2*((t-=2)*t*t + 2) + b); } // Quadratic Easing functions diff --git a/src/models.c b/src/models.c index bef19e10..8297358b 100644 --- a/src/models.c +++ b/src/models.c @@ -1,12 +1,14 @@ /********************************************************************************************** * -* raylib.models - Basic functions to draw 3d shapes and 3d models +* raylib.models - Basic functions to deal with 3d shapes and 3d models * * CONFIGURATION: * * #define SUPPORT_FILEFORMAT_OBJ / SUPPORT_LOAD_OBJ +* Selected desired fileformats to be supported for loading. * * #define SUPPORT_FILEFORMAT_MTL +* Selected desired fileformats to be supported for loading. * * * LICENSE: zlib/libpng diff --git a/src/raylib.h b/src/raylib.h index e679e011..4fd4b5df 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -1,43 +1,45 @@ /********************************************************************************************** * -* raylib v1.7.0 (www.raylib.com) +* raylib v1.7.0 * -* A simple and easy-to-use library to learn videogames programming +* A simple and easy-to-use library to learn videogames programming (www.raylib.com) * * 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) -* Unique OpenGL abstraction layer (usable as standalone module): [rlgl] -* Powerful fonts module with SpriteFonts support (XNA bitmap fonts, AngelCode fonts, TTF) -* Multiple textures support, including compressed formats and mipmaps generation -* Basic 3d support for Shapes, Models, Billboards, Heightmaps and Cubicmaps -* Powerful math module for Vector, Matrix and Quaternion operations: [raymath] -* Audio loading and playing with streaming support and mixing channels [audio] -* VR stereo rendering support with configurable HMD device parameters -* Multiple platforms support: Windows, Linux, Mac, Android, Raspberry Pi, HTML5 and Oculus Rift CV1 -* Custom color palette for fancy visuals on raywhite background -* Minimal external dependencies (GLFW3, OpenGL, OpenAL) -* Complete binding for Lua [rlua] +* - 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) +* - Unique OpenGL abstraction layer (usable as standalone module): [rlgl] +* - Powerful fonts module with SpriteFonts support (XNA bitmap fonts, AngelCode fonts, TTF) +* - Multiple textures support, including compressed formats and mipmaps generation +* - Basic 3d support for Shapes, Models, Billboards, Heightmaps and Cubicmaps +* - Powerful math module for Vector, Matrix and Quaternion operations: [raymath] +* - Audio loading and playing with streaming support and mixing channels [audio] +* - VR stereo rendering support with configurable HMD device parameters +* - Multiple platforms support: Windows, Linux, Mac, Android, Raspberry Pi, HTML5 and Oculus Rift CV1 +* - Custom color palette for fancy visuals on raywhite background +* - Minimal external dependencies (GLFW3, OpenGL, OpenAL) +* - Complete bindings for Lua, Go and Pascal * * 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) +* 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] -* stb_image_write (Sean Barret) for image writting (PNG) [utils] -* stb_truetype (Sean Barret) for ttf fonts loading [text] -* stb_vorbis (Sean Barret) for ogg audio loading [audio] -* jar_xm (Joshua Reisenauer) for XM audio module loading [audio] -* jar_mod (Joshua Reisenauer) for MOD audio module loading [audio] -* dr_flac (David Reid) for FLAC audio file loading [audio] -* OpenAL Soft for audio device/context management [audio] -* tinfl for data decompression (DEFLATE algorithm) [utils] +* GLFW3 (www.glfw.org) for window/context management and input [core] +* GLAD for OpenGL extensions loading (3.3 Core profile, only PLATFORM_DESKTOP) [rlgl] +* OpenAL Soft for audio device/context management [audio] +* +* OPTIONAL DEPENDENCIES: +* stb_image (Sean Barret) for images loading (JPEG, PNG, BMP, TGA) [textures] +* stb_image_write (Sean Barret) for image writting (PNG) [utils] +* stb_truetype (Sean Barret) for ttf fonts loading [text] +* stb_vorbis (Sean Barret) for ogg audio loading [audio] +* jar_xm (Joshua Reisenauer) for XM audio module loading [audio] +* jar_mod (Joshua Reisenauer) for MOD audio module loading [audio] +* dr_flac (David Reid) for FLAC audio file loading [audio] +* tinfl for data decompression (DEFLATE algorithm) [rres] * * * LICENSE: zlib/libpng diff --git a/src/utils.c b/src/utils.c index 9a2a723a..54923e34 100644 --- a/src/utils.c +++ b/src/utils.c @@ -4,14 +4,20 @@ * * CONFIGURATION: * -* #define SUPPORT_SAVE_PNG -* Enable saving PNG fileformat +* #define SUPPORT_SAVE_PNG (defined by default) +* Support saving image data as PNG fileformat * NOTE: Requires stb_image_write library * * #define SUPPORT_SAVE_BMP +* Support saving image data as BMP fileformat +* NOTE: Requires stb_image_write library +* +* #define SUPPORT_TRACELOG +* Show TraceLog() output messages +* NOTE: By default DEBUG traces not shown * -* #define DO_NOT_TRACE_DEBUG_MSGS -* Avoid showing DEBUG TraceLog() messages +* #define SUPPORT_TRACELOG_DEBUG +* Show TraceLog() DEBUG messages * * DEPENDENCIES: * stb_image_write - PNG writting functions @@ -129,18 +135,23 @@ void TraceLog(int msgType, const char *text, ...) } #if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI) + +#if defined(SUPPORT_SAVE_BMP) // Creates a BMP image file from an array of pixel data void SaveBMP(const char *fileName, unsigned char *imgData, int width, int height, int compSize) { stbi_write_bmp(fileName, width, height, compSize, imgData); } +#endif +#if defined(SUPPORT_SAVE_PNG) // Creates a PNG image file from an array of pixel data void SavePNG(const char *fileName, unsigned char *imgData, int width, int height, int compSize) { stbi_write_png(fileName, width, height, compSize, imgData, width*compSize); } #endif +#endif #if defined(PLATFORM_ANDROID) // Initialize asset manager from android app diff --git a/src/utils.h b/src/utils.h index 3ffd025c..037d7e94 100644 --- a/src/utils.h +++ b/src/utils.h @@ -33,6 +33,8 @@ #include "rres.h" +#define SUPPORT_SAVE_PNG + //---------------------------------------------------------------------------------- // Some basic Defines //---------------------------------------------------------------------------------- @@ -61,9 +63,13 @@ void TraceLog(int msgType, const char *text, ...); // Outputs a trace log messa const char *GetExtension(const char *fileName); // Returns extension of a filename #if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI) +#if defined(SUPPORT_SAVE_BMP) void SaveBMP(const char *fileName, unsigned char *imgData, int width, int height, int compSize); +#endif +#if defined(SUPPORT_SAVE_PNG) void SavePNG(const char *fileName, unsigned char *imgData, int width, int height, int compSize); #endif +#endif #if defined(PLATFORM_ANDROID) void InitAssetManager(AAssetManager *manager); // Initialize asset manager from android app